MUC: Assign priorities to config form hooks so they have a consistent order on each...
[prosody.git] / plugins / muc / password.lib.lua
index 48486d730b57f0398a9cf1e0860e393289295d22..02ecdc1a57b318e625627dbb7703981674801e2e 100644 (file)
@@ -17,7 +17,6 @@ local function set_password(room, password)
        if password == "" then password = nil; end
        if room._data.password == password then return false; end
        room._data.password = password;
-       if room.save then room:save(true); end
        return true;
 end
 
@@ -32,11 +31,10 @@ module:hook("muc-config-form", function(event)
                label = "Password";
                value = get_password(event.room) or "";
        });
-end);
+end, 100-7);
 
-module:hook("muc-config-submitted", function(event)
-       local new = event.fields["muc#roomconfig_roomsecret"];
-       if new ~= nil and set_password(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_roomsecret", function(event)
+       if set_password(event.room, event.value) then
                event.status_codes["104"] = true;
        end
 end);