Software /
code /
prosody
Diff
plugins/muc/muc.lib.lua @ 1750:a1c18470eeee
MUC: Fixed: Unavailable presence was being sent for all role and affiliation changes. Now sent only for kicked occupants.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 07 Sep 2009 20:41:42 +0500 |
parent | 1749:cf2ade983e12 |
child | 1751:55ee6e792e3e |
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua Mon Sep 07 20:40:11 2009 +0500 +++ b/plugins/muc/muc.lib.lua Mon Sep 07 20:41:42 2009 +0500 @@ -445,12 +445,13 @@ 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 @@ 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;