diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-09-07 20:41:42 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-09-07 20:41:42 +0500 |
commit | f8a4bc6a99c8121a72bde35a3a5dc4005db5b5c4 (patch) | |
tree | 15a8621f0eb23005b257a256e3d231bd77e2712e /plugins | |
parent | f82a33e4f5a92516f11ed48e46efd2414c737ebb (diff) | |
download | prosody-f8a4bc6a99c8121a72bde35a3a5dc4005db5b5c4.tar.gz prosody-f8a4bc6a99c8121a72bde35a3a5dc4005db5b5c4.zip |
MUC: Fixed: Unavailable presence was being sent for all role and affiliation changes. Now sent only for kicked occupants.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/muc/muc.lib.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 832e36de..5ab2c567 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -445,12 +445,13 @@ function room_mt:set_affiliation(actor, jid, affiliation, callback) if jid_bare(actor) == jid then return nil, "cancel", "not-allowed"; end self._affiliations[jid] = affiliation; local role = self:get_default_role(affiliation); - local p = st.presence({type = "unavailable"}) + local p = st.presence() :tag("x", {xmlns = "http://jabber.org/protocol/muc#user"}) :tag("item", {affiliation=affiliation or "none", role=role or "none"}):up(); local x = p.tags[1]; local item = x.tags[1]; if not role then -- getting kicked + p.attr.type = "unavailable"; if affiliation == "outcast" then x:tag("status", {code="301"}):up(); -- banned else @@ -492,10 +493,11 @@ function room_mt:set_role(actor, nick, role, callback) local occupant = self._occupants[nick]; if not occupant then return nil, "modify", "not-acceptable"; end if occupant.affiliation == "owner" or occupant.affiliation == "admin" then return nil, "cancel", "not-allowed"; end - local p = st.presence({from = nick, type = "unavailable"}) + local p = st.presence({from = nick}) :tag("x", {xmlns = "http://jabber.org/protocol/muc#user"}) :tag("item", {affiliation=occupant.affiliation or "none", nick=nick, role=role or "none"}):up(); if not role then -- kick + p.attr.type = "unavailable"; self._occupants[nick] = nil; for jid in pairs(occupant.sessions) do -- remove for all sessions of the nick self._jid_nick[jid] = nil; |