aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-06-13 21:58:46 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-06-13 21:58:46 +0500
commite5779b6d702f612c3af74721c177a971051a967f (patch)
tree03ec0aadaeb39fac1d8e6cc39e0548bd8a15e06d /plugins
parent3766587466a76c53265f07bc34223834072adbe0 (diff)
downloadprosody-e5779b6d702f612c3af74721c177a971051a967f.tar.gz
prosody-e5779b6d702f612c3af74721c177a971051a967f.zip
MUC: Updated code to use :set_hidden() and :is_hidden().
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/mod_muc.lua2
-rw-r--r--plugins/muc/muc.lib.lua6
2 files changed, 4 insertions, 4 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index de23aebb..c0945daa 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -78,7 +78,7 @@ end
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
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 6e80235b..87353ad1 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -496,7 +496,7 @@ function room_mt:send_form(origin, stanza)
: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 @@ function room_mt:process_form(origin, stanza)
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 @@ function room_mt:process_form(origin, stanza)
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));