Software /
code /
prosody
Changeset
3259:a5b9209efb23
MUC: Replaced direct access of room's internal persistence state with :set_persistent(boolean) and :is_persistent() in various functions.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 13 Jun 2010 21:41:49 +0500 |
parents | 3258:bc07564bec6d |
children | 3260:19b655a8671c |
files | plugins/muc/muc.lib.lua |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua Sun Jun 13 21:38:31 2010 +0500 +++ b/plugins/muc/muc.lib.lua Sun Jun 13 21:41:49 2010 +0500 @@ -482,7 +482,7 @@ :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 @@ 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 @@ 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 @@ 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