plugins/muc/muc.lib: Fix passing actor along as a boolean (thanks fippo)
authordaurnimator <quae@daurnimator.com>
Wed, 15 Oct 2014 14:28:16 -0400
changeset 6478 3c815a64042b
parent 6477 ee13d7dfa988
child 6479 fb8a9873728b
plugins/muc/muc.lib: Fix passing actor along as a boolean (thanks fippo)
plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Tue Oct 14 10:59:54 2014 +0100
+++ b/plugins/muc/muc.lib.lua	Wed Oct 15 14:28:16 2014 -0400
@@ -1000,7 +1000,9 @@
 	local target_affiliation = self._affiliations[jid]; -- Raw; don't want to check against host
 	local is_downgrade = valid_affiliations[target_affiliation or "none"] > valid_affiliations[affiliation or "none"];
 
-	if actor ~= true then
+	if actor == true then
+		actor = nil -- So we can pass it safely to 'publicise_occupant_status' below
+	else
 		local actor_affiliation = self:get_affiliation(actor);
 		if actor_affiliation == "owner" then
 			if jid_bare(actor) == jid then -- self change
@@ -1098,7 +1100,9 @@
 	end
 	role = role ~= "none" and role or nil; -- coerces `role == false` to `nil`
 
-	if actor ~= true then
+	if actor == true then
+		actor = nil -- So we can pass it safely to 'publicise_occupant_status' below
+	else
 		-- Can't do anything to other owners or admins
 		local occupant_affiliation = self:get_affiliation(occupant.bare_jid);
 		if occupant_affiliation == "owner" and occupant_affiliation == "admin" then