From 906e49003903ef31a24eba95b20f9d4b1fc21431 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 2 Apr 2014 15:14:52 -0400 Subject: plugins/muc/muc.lib: Move description functions out to own file --- plugins/muc/muc.lib.lua | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'plugins/muc/muc.lib.lua') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 07069130..ef572cfd 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -429,9 +429,6 @@ end); module:hook("muc-disco#info", function(event) event.reply:tag("feature", {var = event.room:get_whois() ~= "anyone" and "muc_semianonymous" or "muc_nonanonymous"}):up(); end); -module:hook("muc-disco#info", function(event) - table.insert(event.form, { name = "muc#roominfo_description", label = "Description", value = event.room:get_description() }); -end); module:hook("muc-disco#info", function(event) local count = 0; for _ in event.room:each_occupant() do count = count + 1; end table.insert(event.form, { name = "muc#roominfo_occupants", label = "Number of occupants", value = tostring(count) }); @@ -495,16 +492,6 @@ end function room_mt:get_name() return self._data.name or jid_split(self.jid); end -function room_mt:set_description(description) - if description == "" or type(description) ~= "string" then description = nil; end - if self._data.description ~= description then - self._data.description = description; - if self.save then self:save(true); end - end -end -function room_mt:get_description() - return self._data.description; -end function room_mt:set_password(password) if password == "" or type(password) ~= "string" then password = nil; end if self._data.password ~= password then @@ -926,14 +913,6 @@ module:hook("muc-config-form", function(event) value = event.room:get_name() or "", }); end); -module:hook("muc-config-form", function(event) - table.insert(event.form, { - name = 'muc#roomconfig_roomdesc', - type = 'text-single', - label = 'Description', - value = event.room:get_description() or "", - }); -end); module:hook("muc-config-form", function(event) table.insert(event.form, { name = 'muc#roomconfig_persistentroom', @@ -1049,9 +1028,6 @@ end module:hook("muc-config-submitted", function(event) event.update_option("name", "muc#roomconfig_roomname"); end); -module:hook("muc-config-submitted", function(event) - event.update_option("description", "muc#roomconfig_roomdesc"); -end); module:hook("muc-config-submitted", function(event) event.update_option("persistent", "muc#roomconfig_persistentroom"); end); @@ -1558,6 +1534,10 @@ function room_mt:set_role(actor, occupant_jid, role, reason) return true; end +local description = module:require "muc/description"; +room_mt.get_description = description.get; +room_mt.set_description = description.set; + local _M = {}; -- module "muc" function _M.new_room(jid, config) -- cgit v1.2.3