Mercurial > prosody-hg
comparison plugins/muc/muc.lib.lua @ 5334:da7857891eb8
MUC: Fix affiliation check for admins, and bring it in line with the spec (thanks Maranda).
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Tue, 26 Feb 2013 20:31:41 +0500 |
| parents | 87f07dd0bbfb |
| children | bb81c13d2c6f |
comparison
equal
deleted
inserted
replaced
| 5333:760c345dc7a1 | 5334:da7857891eb8 |
|---|---|
| 985 if target_affiliation == affiliation then -- no change, shortcut | 985 if target_affiliation == affiliation then -- no change, shortcut |
| 986 if callback then callback(); end | 986 if callback then callback(); end |
| 987 return true; | 987 return true; |
| 988 end | 988 end |
| 989 if actor_affiliation ~= "owner" then | 989 if actor_affiliation ~= "owner" then |
| 990 if actor_affiliation ~= "admin" or target_affiliation == "owner" or target_affiliation == "admin" then | 990 if affiliation == "owner" or affiliation == "admin" or actor_affiliation ~= "admin" or target_affiliation == "owner" or target_affiliation == "admin" then |
| 991 return nil, "cancel", "not-allowed"; | 991 return nil, "cancel", "not-allowed"; |
| 992 end | 992 end |
| 993 elseif target_affiliation == "owner" and jid_bare(actor) == jid then -- self change | 993 elseif target_affiliation == "owner" and jid_bare(actor) == jid then -- self change |
| 994 local is_last = true; | 994 local is_last = true; |
| 995 for j, aff in pairs(self._affiliations) do if j ~= jid and aff == "owner" then is_last = false; break; end end | 995 for j, aff in pairs(self._affiliations) do if j ~= jid and aff == "owner" then is_last = false; break; end end |
