Mercurial > prosody-hg
comparison plugins/muc/muc.lib.lua @ 1824:8e66c9d09f81
MUC: Refactored to remove some duplicate code.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Fri, 25 Sep 2009 12:35:09 +0500 |
| parents | ed1911be26c7 |
| children | f67e4bfc62f1 |
comparison
equal
deleted
inserted
replaced
| 1823:7c3ec7ac6316 | 1824:8e66c9d09f81 |
|---|---|
| 111 stanza:tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) | 111 stanza:tag("x", {xmlns='http://jabber.org/protocol/muc#user'}) |
| 112 :tag("item", {affiliation=data.affiliation, role=data.role, nick=nick}):up(); | 112 :tag("item", {affiliation=data.affiliation, role=data.role, nick=nick}):up(); |
| 113 if code then | 113 if code then |
| 114 stanza:tag("status", {code=code}):up(); | 114 stanza:tag("status", {code=code}):up(); |
| 115 end | 115 end |
| 116 local me; | 116 self:broadcast_except_nick(stanza, stanza.attr.from); |
| 117 for occupant, o_data in pairs(self._occupants) do | 117 local me = self._occupants[stanza.attr.from]; |
| 118 if occupant ~= stanza.attr.from then | |
| 119 for jid in pairs(o_data.sessions) do | |
| 120 stanza.attr.to = jid; | |
| 121 self:route_stanza(stanza); | |
| 122 end | |
| 123 else | |
| 124 me = o_data; | |
| 125 end | |
| 126 end | |
| 127 if me then | 118 if me then |
| 128 stanza:tag("status", {code='110'}); | 119 stanza:tag("status", {code='110'}); |
| 129 for jid in pairs(me.sessions) do | 120 for jid in pairs(me.sessions) do |
| 130 stanza.attr.to = jid; | 121 stanza.attr.to = jid; |
| 131 self:route_stanza(stanza); | 122 self:route_stanza(stanza); |
