# HG changeset patch
# User daurnimator <quae@daurnimator.com>
# Date 1409930454 14400
# Node ID 8528d1da461f4a51af7f54e3beaa8e823b6fa0aa
# Parent  4d334d00c63568a6caa960a8ce005f952ffdca1e
plugins/muc/muc.lib: Use get_affilation() inside of set_affiliation(), so that the override in mod_muc works

diff -r 4d334d00c635 -r 8528d1da461f plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Fri Sep 05 11:19:16 2014 -0400
+++ b/plugins/muc/muc.lib.lua	Fri Sep 05 11:20:54 2014 -0400
@@ -984,10 +984,9 @@
 	local is_downgrade = valid_affiliations[target_affiliation or "none"] > valid_affiliations[affiliation or "none"];
 
 	if actor ~= true then
-		local actor_bare = jid_bare(actor);
-		local actor_affiliation = self._affiliations[actor_bare];
+		local actor_affiliation = self:get_affiliation(actor);
 		if actor_affiliation == "owner" then
-			if actor_bare == jid then -- self change
+			if jid_bare(actor) == jid then -- self change
 				-- need at least one owner
 				local is_last = true;
 				for j, aff in pairs(self._affiliations) do if j ~= jid and aff == "owner" then is_last = false; break; end end