Software / code / prosody
Comparison
plugins/muc/muc.lib.lua @ 3593:58a4af582eb3
MUC: Only send status code 110 (entering non-anonymous room) to the occupant themselves, not to other occupants.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Wed, 10 Nov 2010 06:27:35 +0500 |
| parent | 3592:3adac5780c5a |
| child | 3611:d58da6bb8a77 |
comparison
equal
deleted
inserted
replaced
| 3592:3adac5780c5a | 3593:58a4af582eb3 |
|---|---|
| 447 self._occupants[to].sessions[from] = get_filtered_presence(stanza); | 447 self._occupants[to].sessions[from] = get_filtered_presence(stanza); |
| 448 end | 448 end |
| 449 self._jid_nick[from] = to; | 449 self._jid_nick[from] = to; |
| 450 self:send_occupant_list(from); | 450 self:send_occupant_list(from); |
| 451 pr.attr.from = to; | 451 pr.attr.from = to; |
| 452 pr:tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) | |
| 453 :tag("item", {affiliation=affiliation or "none", role=role or "none"}):up(); | |
| 452 if not is_merge then | 454 if not is_merge then |
| 453 self:broadcast_presence(pr, from); | 455 self:broadcast_except_nick(pr, to); |
| 454 else | |
| 455 pr.attr.to = from; | |
| 456 self:_route_stanza(pr:tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) | |
| 457 :tag("item", {affiliation=affiliation or "none", role=role or "none"}):up() | |
| 458 :tag("status", {code='110'})); | |
| 459 end | 456 end |
| 457 pr:tag("status", {code='110'}); | |
| 458 if self._data.whois == 'anyone' then | |
| 459 pr:tag("status", {code='100'}):up(); | |
| 460 end | |
| 461 pr.attr.to = from; | |
| 462 self:_route_stanza(pr); | |
| 460 self:send_history(from, stanza); | 463 self:send_history(from, stanza); |
| 461 elseif not affiliation then -- registration required for entering members-only room | 464 elseif not affiliation then -- registration required for entering members-only room |
| 462 local reply = st.error_reply(stanza, "auth", "registration-required"):up(); | 465 local reply = st.error_reply(stanza, "auth", "registration-required"):up(); |
| 463 reply.tags[1].attr.code = "407"; | 466 reply.tags[1].attr.code = "407"; |
| 464 origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); | 467 origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); |
| 1019 else | 1022 else |
| 1020 item.attr.jid = from_occupant.jid; | 1023 item.attr.jid = from_occupant.jid; |
| 1021 end | 1024 end |
| 1022 end | 1025 end |
| 1023 end | 1026 end |
| 1024 if self._data.whois == 'anyone' then | |
| 1025 muc_child:tag('status', { code = '100' }):up(); | |
| 1026 end | |
| 1027 end | 1027 end |
| 1028 self:route_stanza(stanza); | 1028 self:route_stanza(stanza); |
| 1029 if muc_child then | 1029 if muc_child then |
| 1030 for _, item in pairs(muc_child.tags) do | 1030 for _, item in pairs(muc_child.tags) do |
| 1031 if item.name == "item" then | 1031 if item.name == "item" then |