MUC: Only allow moderators to change the room subject.

Wed, 25 Nov 2009 22:00:33 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Wed, 25 Nov 2009 22:00:33 +0500
changeset 2213
13375e6c4ecb
parent 2212
f9af31dbfeb8
child 2214
a4c8b5763d0a
child 2218
dbbb5ed41365

MUC: Only allow moderators to change the room subject.

plugins/muc/muc.lib.lua file | annotate | diff | comparison | revisions
--- a/plugins/muc/muc.lib.lua	Wed Nov 25 21:42:05 2009 +0500
+++ b/plugins/muc/muc.lib.lua	Wed Nov 25 22:00:33 2009 +0500
@@ -529,7 +529,12 @@
 			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

mercurial