X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmuc%2Fwhois.lib.lua;h=4acf288c3ca27fbdd179495b3de68458c7eb1dcc;hb=74c88eed6701d02bf77a59aeedb8d8204c41bc17;hp=f89e60876fadd4e6bf09986a5cadeb8a8a23ec2a;hpb=79a152bb61900a86c486b62d59be60fa845f8afc;p=prosody.git diff --git a/plugins/muc/whois.lib.lua b/plugins/muc/whois.lib.lua index f89e6087..4acf288c 100644 --- a/plugins/muc/whois.lib.lua +++ b/plugins/muc/whois.lib.lua @@ -20,7 +20,6 @@ local function set_whois(room, whois) assert(valid_whois[whois], "Invalid whois value") if get_whois(room) == whois then return false; end room._data.whois = whois; - if room.save then room:save(true); end return true; end @@ -39,12 +38,11 @@ module:hook("muc-config-form", function(event) { value = 'anyone', label = 'Anyone', default = whois == 'anyone' } } }); -end); +end, 100-9); -module:hook("muc-config-submitted", function(event) - local new = event.fields["muc#roomconfig_whois"]; - if new ~= nil and set_whois(event.room, new) then - local code = (new == 'moderators') and "173" or "172"; +module:hook("muc-config-submitted/muc#roomconfig_whois", function(event) + if set_whois(event.room, event.value) then + local code = (event.value == 'moderators') and "173" or "172"; event.status_codes[code] = true; end end);