MUC: Allow actor == true to set roles (like affiliations)
authorMatthew Wild <mwild1@gmail.com>
Mon, 29 Apr 2013 10:25:12 +0000 (11:25 +0100)
committerMatthew Wild <mwild1@gmail.com>
Mon, 29 Apr 2013 10:25:12 +0000 (11:25 +0100)
plugins/muc/muc.lib.lua

index d3e6b1ee7576250d32c432d3f7e00e8a885f5b18..a5aba3c8d31986854e946282b5d940c3fe0292ac 100644 (file)
@@ -1053,11 +1053,12 @@ function room_mt:get_role(nick)
        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