# HG changeset patch # User Matthew Wild # Date 1270469880 -3600 # Node ID d22dee1f3dba4b861505053203af425c8318b7a8 # Parent 6fb7b98629ae2e155e8da3429b0cd5cc0cf453d7 xmpp_muc.js: Add get_child() function diff -r 6fb7b98629ae -r d22dee1f3dba src/js/xmpp_muc.js --- 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 */