Software / code / prosody
Comparison
plugins/muc/muc.lib.lua @ 1743:d00b144f4bcf
MUC: An admin or owner MUST NOT be able to revoke moderation privileges from another admin or owner.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Mon, 07 Sep 2009 20:31:35 +0500 |
| parent | 1742:1483a62d69bb |
| child | 1744:265863a5612b |
comparison
equal
deleted
inserted
replaced
| 1742:1483a62d69bb | 1743:d00b144f4bcf |
|---|---|
| 452 function room_mt:set_role(actor, nick, role, callback) | 452 function room_mt:set_role(actor, nick, role, callback) |
| 453 if role and role ~= "moderator" and role ~= "participant" and role ~= "visitor" then return nil, "modify", "not-acceptable"; end | 453 if role and role ~= "moderator" and role ~= "participant" and role ~= "visitor" then return nil, "modify", "not-acceptable"; end |
| 454 if self:get_affiliation(actor) ~= "owner" then return nil, "cancel", "not-allowed"; end | 454 if self:get_affiliation(actor) ~= "owner" then return nil, "cancel", "not-allowed"; end |
| 455 local occupant = self._occupants[nick]; | 455 local occupant = self._occupants[nick]; |
| 456 if not occupant then return nil, "modify", "not-acceptable"; end | 456 if not occupant then return nil, "modify", "not-acceptable"; end |
| 457 if jid_bare(actor) == occupant.jid then return nil, "cancel", "not-allowed"; end | 457 if occupant.affiliation == "owner" or occupant.affiliation == "admin" then return nil, "cancel", "not-allowed"; end |
| 458 local p = st.presence({from = nick, type = "unavailable"}) | 458 local p = st.presence({from = nick, type = "unavailable"}) |
| 459 :tag("x", {xmlns = "http://jabber.org/protocol/muc#user"}) | 459 :tag("x", {xmlns = "http://jabber.org/protocol/muc#user"}) |
| 460 :tag("item", {affiliation=occupant.affiliation, nick=nick, role=role or "none"}):up(); | 460 :tag("item", {affiliation=occupant.affiliation, nick=nick, role=role or "none"}):up(); |
| 461 if not role then -- kick | 461 if not role then -- kick |
| 462 self._occupants[nick] = nil; | 462 self._occupants[nick] = nil; |