MUC: Assign priorities to config form hooks so they have a consistent order on each...
[prosody.git] / plugins / muc / name.lib.lua
index 49d1246717899aa366be5ab63e259cd8b680617b..2dcb979a244de5cd807e1253c15405e411d5c252 100644 (file)
@@ -17,7 +17,6 @@ local function set_name(room, name)
        if name == "" or name == (jid_split(room.jid)) then name = nil; end
        if room._data.name == name then return false; end
        room._data.name = name;
-       if room.save then room:save(true); end
        return true;
 end
 
@@ -32,11 +31,10 @@ module:hook("muc-config-form", function(event)
                label = "Name";
                value = get_name(event.room) or "";
        });
-end);
+end, 100-1);
 
-module:hook("muc-config-submitted", function(event)
-       local new = event.fields["muc#roomconfig_roomname"];
-       if new ~= nil and set_name(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_roomname", function(event)
+       if set_name(event.room, event.value) then
                event.status_codes["104"] = true;
        end
 end);