Software /
code /
prosody
Changeset
3262:330010ef078f
MUC: Updated code to use :set_hidden() and :is_hidden().
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 13 Jun 2010 21:58:46 +0500 |
parents | 3261:fe1c93296abd |
children | 3263:4973b737d4c7 |
files | plugins/muc/mod_muc.lua plugins/muc/muc.lib.lua |
diffstat | 2 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua Sun Jun 13 21:54:47 2010 +0500 +++ b/plugins/muc/mod_muc.lua Sun Jun 13 21:58:46 2010 +0500 @@ -78,7 +78,7 @@ local function get_disco_items(stanza) local reply = st.iq({type='result', id=stanza.attr.id, from=muc_host, to=stanza.attr.from}):query("http://jabber.org/protocol/disco#items"); for jid, room in pairs(rooms) do - if not room._data.hidden then + if not room:is_hidden() then reply:tag("item", {jid=jid, name=jid}):up(); end end
--- a/plugins/muc/muc.lib.lua Sun Jun 13 21:54:47 2010 +0500 +++ b/plugins/muc/muc.lib.lua Sun Jun 13 21:58:46 2010 +0500 @@ -496,7 +496,7 @@ :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() + :tag("value"):text(self:is_hidden() and "0" or "1"):up() :up() :tag("field", {type='list-single', label='Who May Discover Real JIDs?', var='muc#roomconfig_whois'}) :tag("value"):text(self._data.whois or 'moderators'):up() @@ -562,8 +562,7 @@ local public = fields['muc#roomconfig_publicroom']; if public == "0" or public == "false" then public = nil; elseif public == "1" or public == "true" then public = true; else origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end - dirty = dirty or (self._data.hidden ~= (not public and true or nil)) - self._data.hidden = not public and true or nil; + dirty = dirty or (self:is_hidden() ~= (not public and true or nil)) local whois = fields['muc#roomconfig_whois']; if not valid_whois[whois] then @@ -581,6 +580,7 @@ self:set_moderated(moderated); self:set_members_only(membersonly); self:set_persistent(persistent); + self:set_hidden(not public); if self.save then self:save(true); end origin.send(st.reply(stanza));