aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-05-18 15:28:00 +0100
committerMatthew Wild <mwild1@gmail.com>2013-05-18 15:28:00 +0100
commit5950b8bdd2cf6554204090fa6a69867d8236e749 (patch)
tree5725d0d9608d98db15f09e3a9d75c49e5244defd /plugins
parent651c67dc6b70b1e0fac99e1f864656d335974f69 (diff)
downloadprosody-5950b8bdd2cf6554204090fa6a69867d8236e749.tar.gz
prosody-5950b8bdd2cf6554204090fa6a69867d8236e749.zip
mod_muc: Add getter/setter for 'whois' (fixes traceback)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/muc.lib.lua17
1 files changed, 14 insertions, 3 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 833b1154..6b3bdcb0 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -357,6 +357,19 @@ function room_mt:set_historylength(length)
end
+local valid_whois = { moderators = true, anyone = true };
+
+function room_mt:set_whois(whois)
+ if valid_whois[whois] and self._data.whois ~= whois then
+ self._data.whois = whois;
+ if self.save then self:save(true); end
+ end
+end
+
+function room_mt:get_whois()
+ return self._data.whois;
+end
+
local function construct_stanza_id(room, stanza)
local from_jid, to_nick = stanza.attr.from, stanza.attr.to;
local from_nick = room._jid_nick[from_jid];
@@ -661,8 +674,6 @@ function room_mt:get_form_layout()
return module:fire_event("muc-config-form", { room = self, form = form }) or form;
end
-local valid_whois = { moderators = true, anyone = true };
-
function room_mt:process_form(origin, stanza)
local query = stanza.tags[1];
local form;
@@ -708,7 +719,7 @@ function room_mt:process_form(origin, stanza)
:tag('x', {xmlns='http://jabber.org/protocol/muc#user'}):up()
:tag('status', {code = '104'}):up();
if changed.whois then
- local code = (whois == 'moderators') and "173" or "172";
+ local code = (self:get_whois() == 'moderators') and "173" or "172";
msg.tags[1]:tag('status', {code = code}):up();
end
self:broadcast_message(msg, false)