# HG changeset patch # User Matthew Wild # Date 1368887280 -3600 # Node ID 1b326a1e4da6a5548caf13fe120ab7ad6e5b7339 # Parent b9c836dc8f2a74a03265980c23ec43b33c5884d9 mod_muc: Add getter/setter for 'whois' (fixes traceback) diff -r b9c836dc8f2a -r 1b326a1e4da6 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Sat May 18 12:03:03 2013 +0100 +++ b/plugins/muc/muc.lib.lua Sat May 18 15:28:00 2013 +0100 @@ -357,6 +357,19 @@ 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 @@ 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 @@ :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)