Mercurial > prosody-hg
comparison plugins/muc/muc.lib.lua @ 8175:b187da5b7e8f
MUC: Include status code 110 on affiliation changes (see #765)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 06 Jul 2017 10:36:22 +0200 |
| parents | 260886554512 |
| children | f07cfc9b9b36 |
comparison
equal
deleted
inserted
replaced
| 8174:260886554512 | 8175:b187da5b7e8f |
|---|---|
| 1007 x:tag("status", {code="301"}):up(); -- banned | 1007 x:tag("status", {code="301"}):up(); -- banned |
| 1008 else | 1008 else |
| 1009 x:tag("status", {code="321"}):up(); -- affiliation change | 1009 x:tag("status", {code="321"}):up(); -- affiliation change |
| 1010 end | 1010 end |
| 1011 end | 1011 end |
| 1012 local self_x = st.clone(x); | |
| 1013 self_x:tag("status", {code="110"}); | |
| 1012 local modified_nicks = {}; | 1014 local modified_nicks = {}; |
| 1013 for nick, occupant in pairs(self._occupants) do | 1015 for nick, occupant in pairs(self._occupants) do |
| 1014 if jid_bare(occupant.jid) == jid then | 1016 if jid_bare(occupant.jid) == jid then |
| 1015 if not role then -- getting kicked | 1017 if not role then -- getting kicked |
| 1016 self._occupants[nick] = nil; | 1018 self._occupants[nick] = nil; |
| 1021 if not role then self._jid_nick[jid] = nil; end | 1023 if not role then self._jid_nick[jid] = nil; end |
| 1022 local p = st.clone(pres); | 1024 local p = st.clone(pres); |
| 1023 p.attr.from = nick; | 1025 p.attr.from = nick; |
| 1024 p.attr.type = presence_type; | 1026 p.attr.type = presence_type; |
| 1025 p.attr.to = jid; | 1027 p.attr.to = jid; |
| 1026 p:add_child(x); | 1028 if occupant.jid == jid then |
| 1029 local bp = st.clone(p); | |
| 1030 bp:add_child(x); | |
| 1031 modified_nicks[nick] = bp; | |
| 1032 end | |
| 1033 p:add_child(self_x); | |
| 1027 self:_route_stanza(p); | 1034 self:_route_stanza(p); |
| 1028 if occupant.jid == jid then | |
| 1029 modified_nicks[nick] = p; | |
| 1030 end | |
| 1031 end | 1035 end |
| 1032 end | 1036 end |
| 1033 end | 1037 end |
| 1034 if self.save then self:save(); end | 1038 if self.save then self:save(); end |
| 1035 if callback then callback(); end | 1039 if callback then callback(); end |
