Comparison

plugins/muc/muc.lib.lua @ 6392:8528d1da461f

plugins/muc/muc.lib: Use get_affilation() inside of set_affiliation(), so that the override in mod_muc works
author daurnimator <quae@daurnimator.com>
date Fri, 05 Sep 2014 11:20:54 -0400
parent 6391:4d334d00c635
child 6393:fff6ca13cb0f
comparison
equal deleted inserted replaced
6391:4d334d00c635 6392:8528d1da461f
982 982
983 local target_affiliation = self._affiliations[jid]; -- Raw; don't want to check against host 983 local target_affiliation = self._affiliations[jid]; -- Raw; don't want to check against host
984 local is_downgrade = valid_affiliations[target_affiliation or "none"] > valid_affiliations[affiliation or "none"]; 984 local is_downgrade = valid_affiliations[target_affiliation or "none"] > valid_affiliations[affiliation or "none"];
985 985
986 if actor ~= true then 986 if actor ~= true then
987 local actor_bare = jid_bare(actor); 987 local actor_affiliation = self:get_affiliation(actor);
988 local actor_affiliation = self._affiliations[actor_bare];
989 if actor_affiliation == "owner" then 988 if actor_affiliation == "owner" then
990 if actor_bare == jid then -- self change 989 if jid_bare(actor) == jid then -- self change
991 -- need at least one owner 990 -- need at least one owner
992 local is_last = true; 991 local is_last = true;
993 for j, aff in pairs(self._affiliations) do if j ~= jid and aff == "owner" then is_last = false; break; end end 992 for j, aff in pairs(self._affiliations) do if j ~= jid and aff == "owner" then is_last = false; break; end end
994 if is_last then 993 if is_last then
995 return nil, "cancel", "conflict"; 994 return nil, "cancel", "conflict";