# HG changeset patch # User Matthew Wild # Date 1262541234 0 # Node ID 89be536aae2586a8c84fdbad807b596fac2ba826 # Parent feb46e05d498a78bb45ef3bec08de8b7ba9a8b89 mod_muc/muc.lib: Use stanza:get_child() to locate MUC child element diff -r feb46e05d498 -r 89be536aae25 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Sun Jan 03 15:17:51 2010 +0000 +++ b/plugins/muc/muc.lib.lua Sun Jan 03 17:53:54 2010 +0000 @@ -777,15 +777,6 @@ return true; end -local function _get_muc_child(stanza) - for i=#stanza.tags,1,-1 do - local tag = stanza.tags[i]; - if tag.name == "x" and tag.attr.xmlns == "http://jabber.org/protocol/muc#user" then - return tag; - end - end -end - function room_mt:_route_stanza(stanza) local muc_child; local to_occupant = self._occupants[self._jid_nick[stanza.attr.to]]; @@ -793,10 +784,10 @@ if stanza.name == "presence" then if to_occupant and from_occupant then if self._data.whois == 'anyone' then - muc_child = _get_muc_child(stanza) + muc_child = stanza:get_child("x", "http://jabber.org/protocol/muc#user"); else if to_occupant.role == "moderator" or jid_bare(to_occupant.jid) == jid_bare(from_occupant.jid) then - muc_child = _get_muc_child(stanza) + muc_child = stanza:get_child("x", "http://jabber.org/protocol/muc#user"); end end end