Mon, 05 Apr 2010 13:18:00 +0100
xmpp_muc.js: Add get_child() function
src/js/xmpp_muc.js | file | annotate | diff | comparison | revisions |
--- a/src/js/xmpp_muc.js Sat Apr 03 20:53:56 2010 +0100 +++ b/src/js/xmpp_muc.js Mon Apr 05 13:18:00 2010 +0100 @@ -1,6 +1,20 @@ // Wraps a function so that its 'this' is always 'context' when called var recontext = function (context, f) { return function () { return f.apply(context, arguments); }; }; +// Returns a child element given a tag name and xmlns +function get_child(stanza, name, xmlns) +{ + var children = stanza.getElementsByTagName(name); + for(var i=0;i<=children.length;i++) + { + if(children[i].getAttribute("xmlns") == xmlns || !xmlns) + return children[i]; + } + return null; +} + + + var MUC = function (conn, callbacks) { /* Set our properties */