MUC: Assign priorities to config form hooks so they have a consistent order on each...
[prosody.git] / plugins / muc / persistent.lib.lua
index ccf6fffe41effa35c53d87802da9ccba9e747d1d..abceafe1cb784018ef3cc70746aa72adf9d0e916 100644 (file)
@@ -15,7 +15,6 @@ local function set_persistent(room, persistent)
        persistent = persistent and true or nil;
        if get_persistent(room) == persistent then return false; end
        room._data.persistent = persistent;
-       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 Persistent?";
                value = get_persistent(event.room);
        });
-end);
+end, 100-3);
 
-module:hook("muc-config-submitted", function(event)
-       local new = event.fields["muc#roomconfig_persistentroom"];
-       if new ~= nil and set_persistent(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_persistentroom", function(event)
+       if set_persistent(event.room, event.value) then
                event.status_codes["104"] = true;
        end
 end);