Software /
code /
prosody
Diff
plugins/muc/muc.lib.lua @ 6117:d7ade0b00ec5
plugins/muc/muc.lib: In `_route_stanza` access occupant data less often
author | daurnimator <quae@daurnimator.com> |
---|---|
date | Wed, 19 Mar 2014 14:35:17 -0400 |
parent | 6116:9147e566fde0 |
child | 6118:aae3d6daa50d |
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua Wed Mar 19 14:06:04 2014 -0400 +++ b/plugins/muc/muc.lib.lua Wed Mar 19 14:35:17 2014 -0400 @@ -1210,9 +1210,9 @@ function room_mt:_route_stanza(stanza) local muc_child; - local to_occupant = self._occupants[self._jid_nick[stanza.attr.to]]; - local from_occupant = self._occupants[stanza.attr.from]; if stanza.name == "presence" then + local to_occupant = self._occupants[self._jid_nick[stanza.attr.to]]; + local from_occupant = self._occupants[stanza.attr.from]; if to_occupant and from_occupant then if self._data.whois == 'anyone' then muc_child = stanza:get_child("x", "http://jabber.org/protocol/muc#user"); @@ -1222,13 +1222,13 @@ end end end - end - if muc_child then - for item in muc_child:childtags("item") do - if from_occupant == to_occupant then - item.attr.jid = stanza.attr.to; - else - item.attr.jid = from_occupant.jid; + if muc_child then + for item in muc_child:childtags("item") do + if from_occupant == to_occupant then + item.attr.jid = stanza.attr.to; + else + item.attr.jid = from_occupant.jid; + end end end end