From 1d9c7a936132c1b810f0d80a275b19b0d529eb3a Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 13 Jun 2010 21:41:49 +0500 Subject: MUC: Replaced direct access of room's internal persistence state with :set_persistent(boolean) and :is_persistent() in various functions. --- plugins/muc/muc.lib.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'plugins/muc/muc.lib.lua') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 74cec635..52bcd489 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -482,7 +482,7 @@ function room_mt:send_form(origin, stanza) :tag("instructions"):text(title):up() :tag("field", {type='hidden', var='FORM_TYPE'}):tag("value"):text("http://jabber.org/protocol/muc#roomconfig"):up():up() :tag("field", {type='boolean', label='Make Room Persistent?', var='muc#roomconfig_persistentroom'}) - :tag("value"):text(self._data.persistent and "1" or "0"):up() + :tag("value"):text(self:is_persistent() and "1" or "0"):up() :up() :tag("field", {type='boolean', label='Make Room Publicly Searchable?', var='muc#roomconfig_publicroom'}) :tag("value"):text(self._data.hidden and "0" or "1"):up() @@ -533,8 +533,7 @@ function room_mt:process_form(origin, stanza) local persistent = fields['muc#roomconfig_persistentroom']; if persistent == "0" or persistent == "false" then persistent = nil; elseif persistent == "1" or persistent == "true" then persistent = true; else origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end - dirty = dirty or (self._data.persistent ~= persistent) - self._data.persistent = persistent; + dirty = dirty or (self:is_persistent() ~= persistent) module:log("debug", "persistent=%s", tostring(persistent)); local moderated = fields['muc#roomconfig_moderatedroom']; @@ -570,6 +569,7 @@ function room_mt:process_form(origin, stanza) end self:set_moderated(moderated); self:set_members_only(membersonly); + self:set_persistent(persistent); if self.save then self:save(true); end origin.send(st.reply(stanza)); @@ -606,8 +606,7 @@ function room_mt:destroy(newjid, reason, password) end self._occupants[nick] = nil; end - self._data.persistent = nil; - if self.save then self:save(true); end + self:set_persistent(false); end function room_mt:handle_to_room(origin, stanza) -- presence changes and groupchat messages, along with disco/etc -- cgit v1.2.3