MUC: Assign priorities to config form hooks so they have a consistent order on each...
[prosody.git] / plugins / muc / hidden.lib.lua
index 5ce43db8e71f11c00a990b193bea68ebe339d268..b2fe6216f6e0cdca3988604c4108bccea075fc30 100644 (file)
@@ -15,7 +15,6 @@ local function set_hidden(room, hidden)
        hidden = hidden and true or nil;
        if get_hidden(room) == hidden then return false; end
        room._data.hidden = hidden;
-       if room.save then room:save(true); end
        return true;
 end
 
@@ -26,11 +25,10 @@ module:hook("muc-config-form", function(event)
                label = "Make Room Publicly Searchable?";
                value = not get_hidden(event.room);
        });
-end);
+end, 100-5);
 
-module:hook("muc-config-submitted", function(event)
-       local new = event.fields["muc#roomconfig_publicroom"];
-       if new ~= nil and set_hidden(event.room, not new) then
+module:hook("muc-config-submitted/muc#roomconfig_publicroom", function(event)
+       if set_hidden(event.room, not event.value) then
                event.status_codes["104"] = true;
        end
 end);