aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-01-03 17:53:54 +0000
committerMatthew Wild <mwild1@gmail.com>2010-01-03 17:53:54 +0000
commitc1c4425f34850affd90abca04866cb06b1305b76 (patch)
tree96f9ca3edd599bfd3fc3f17d6e8714a08a2a8ca4
parent00fefc6404c4e010fc62a7bdf1e670bfc9145a90 (diff)
downloadprosody-c1c4425f34850affd90abca04866cb06b1305b76.tar.gz
prosody-c1c4425f34850affd90abca04866cb06b1305b76.zip
mod_muc/muc.lib: Use stanza:get_child() to locate MUC child element
-rw-r--r--plugins/muc/muc.lib.lua13
1 files changed, 2 insertions, 11 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index d28efa63..abbcb9a4 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -777,15 +777,6 @@ function room_mt:set_role(actor, nick, role, callback, reason)
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 @@ function room_mt:_route_stanza(stanza)
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