MUC: Assign priorities to config form hooks so they have a consistent order on each...
[prosody.git] / plugins / muc / description.lib.lua
index 30852922f44cd7f0461f984845712bed72889784..d4bc1a71bf65cbd90cf0031ef689c6424b216fa1 100644 (file)
@@ -15,7 +15,6 @@ local function set_description(room, description)
        if description == "" then description = nil; end
        if get_description(room) == description then return false; end
        room._data.description = description;
-       if room.save then room:save(true); end
        return true;
 end
 
@@ -28,11 +27,10 @@ local function add_form_option(event)
        });
 end
 module:hook("muc-disco#info", add_form_option);
-module:hook("muc-config-form", add_form_option);
+module:hook("muc-config-form", add_form_option, 100-2);
 
-module:hook("muc-config-submitted", function(event)
-       local new = event.fields["muc#roomconfig_roomdesc"];
-       if new ~= nil and set_description(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_roomdesc", function(event)
+       if set_description(event.room, event.value) then
                event.status_codes["104"] = true;
        end
 end);