Changeset

2174:13375e6c4ecb

MUC: Only allow moderators to change the room subject.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 25 Nov 2009 22:00:33 +0500
parents 2173:f9af31dbfeb8
children 2214:a4c8b5763d0a 2216:dbbb5ed41365
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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