Software /
code /
prosody
Comparison
plugins/muc/muc.lib.lua @ 8176:f07cfc9b9b36
MUC: Add some comments attempting to explain what presence and <x> tag goes where
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 06 Jul 2017 10:40:00 +0200 |
parent | 8175:b187da5b7e8f |
child | 8181:79f73af4c410 |
child | 8187:4d83876aac3e |
comparison
equal
deleted
inserted
replaced
8175:b187da5b7e8f | 8176:f07cfc9b9b36 |
---|---|
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 -- Your own presence should have status 110 | |
1012 local self_x = st.clone(x); | 1013 local self_x = st.clone(x); |
1013 self_x:tag("status", {code="110"}); | 1014 self_x:tag("status", {code="110"}); |
1014 local modified_nicks = {}; | 1015 local modified_nicks = {}; |
1015 for nick, occupant in pairs(self._occupants) do | 1016 for nick, occupant in pairs(self._occupants) do |
1016 if jid_bare(occupant.jid) == jid then | 1017 if jid_bare(occupant.jid) == jid then |
1024 local p = st.clone(pres); | 1025 local p = st.clone(pres); |
1025 p.attr.from = nick; | 1026 p.attr.from = nick; |
1026 p.attr.type = presence_type; | 1027 p.attr.type = presence_type; |
1027 p.attr.to = jid; | 1028 p.attr.to = jid; |
1028 if occupant.jid == jid then | 1029 if occupant.jid == jid then |
1030 -- Broadcast this presence to everyone else later, with the public <x> variant | |
1029 local bp = st.clone(p); | 1031 local bp = st.clone(p); |
1030 bp:add_child(x); | 1032 bp:add_child(x); |
1031 modified_nicks[nick] = bp; | 1033 modified_nicks[nick] = bp; |
1032 end | 1034 end |
1033 p:add_child(self_x); | 1035 p:add_child(self_x); |