MUC: Assign priorities to config form hooks so they have a consistent order on each...
[prosody.git] / plugins / muc / subject.lib.lua
index 45aa6934ebf4d15b6ea583acedecf65599dbf2d3..6f118b43f1397d1f42aeaca06df76c013d63b599 100644 (file)
@@ -35,7 +35,7 @@ module:hook("muc-config-form", function(event)
                label = "Allow Occupants to Change Subject?";
                value = get_changesubject(event.room);
        });
-end);
+end, 100-8);
 
 module:hook("muc-config-submitted/muc#roomconfig_changesubject", function(event)
        if set_changesubject(event.room, event.value) then
@@ -76,12 +76,13 @@ module:hook("muc-occupant-groupchat", function(event)
        local stanza = event.stanza;
        local subject = stanza:get_child("subject");
        if subject then
+               local room = event.room;
                local occupant = event.occupant;
                -- Role check for subject changes
                local role_rank = valid_roles[occupant and occupant.role or "none"];
                if role_rank >= valid_roles.moderator or
-                       ( role_rank >= valid_roles.participant and get_changesubject(event.room) ) then -- and participant
-                       set_subject(event.room, occupant.nick, subject:get_text());
+                       ( role_rank >= valid_roles.participant and get_changesubject(room) ) then -- and participant
+                       set_subject(room, occupant.nick, subject:get_text());
                        room:save();
                        return true;
                else