MUC: Only allow moderators to change the room subject.
authorWaqas Hussain <waqas20@gmail.com>
Wed, 25 Nov 2009 17:00:33 +0000 (22:00 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Wed, 25 Nov 2009 17:00:33 +0000 (22:00 +0500)
plugins/muc/muc.lib.lua

index 7907c0c3ea54674b6e70c28fffdff72e6eff34ac..098fef98d49d7b74cbd876afec47a6325871145d 100644 (file)
@@ -529,7 +529,12 @@ function room_mt:handle_to_room(origin, stanza) -- presence changes and groupcha
                        stanza.attr.from = current_nick;
                        local subject = getText(stanza, {"subject"});
                        if subject then
-                               self:set_subject(current_nick, subject); -- TODO use broadcast_message_stanza
+                               if occupant.role == "moderator" then
+                                       self:set_subject(current_nick, subject); -- TODO use broadcast_message_stanza
+                               else
+                                       stanza.attr.from = from;
+                                       origin.send(st.error_reply(stanza, "cancel", "forbidden"));
+                               end
                        else
                                self:broadcast_message(stanza, true);
                        end