Changeset

2819:49e9a8d57981

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 2818:85c77568c447
children 2820:0ad29a5485d6
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