# HG changeset patch # User Matthew Wild # Date 1265230953 0 # Node ID ca881dab257728c5e44e4e0606431c71088b0234 # Parent 394b0c8cad04aa7cd27e6af72857230e5d53a0f7 Add sendIQ() method diff -r 394b0c8cad04 -r ca881dab2577 xmpp.js --- a/xmpp.js Wed Feb 03 21:02:21 2010 +0000 +++ b/xmpp.js Wed Feb 03 21:02:33 2010 +0000 @@ -149,6 +149,20 @@ this.socket.send(data.toString()); }, + sendIQ: function (iq, on_result, on_error) + { + if(!iq.attr.id) + iq.attr.id = this.getUniqueId(); + this.addHandler(function (reply) { + if(reply.attr.type == "result") + return on_result(reply); + elseif(on_error) + return on_error(reply); + return false; + + }, null, "iq", null, iq.attr.id); + this.send(iq); + }, addHandler: function (handler, ns, name, type, id, from, options) {