Changeset

5542:329ebdfb39a2

MUC: Allow actor == true to set roles (like affiliations)
author Matthew Wild <mwild1@gmail.com>
date Mon, 29 Apr 2013 11:25:12 +0100
parents 5541:1997671d5e46
children 5543:d3f5165c4113 5544:d911d9fb3929
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Mon Apr 29 11:21:37 2013 +0100
+++ b/plugins/muc/muc.lib.lua	Mon Apr 29 11:25:12 2013 +0100
@@ -1053,11 +1053,12 @@
 	return session and session.role or nil;
 end
 function room_mt:can_set_role(actor_jid, occupant_jid, role)
-	local actor = self._occupants[self._jid_nick[actor_jid]];
 	local occupant = self._occupants[occupant_jid];
-	
 	if not occupant or not actor then return nil, "modify", "not-acceptable"; end
 
+	if actor_jid == true then return true; end
+
+	local actor = self._occupants[self._jid_nick[actor_jid]];
 	if actor.role == "moderator" then
 		if occupant.affiliation ~= "owner" and occupant.affiliation ~= "admin" then
 			if actor.affiliation == "owner" or actor.affiliation == "admin" then