Wed, 03 Feb 2010 21:02:33 +0000
Add sendIQ() method
xmpp.js | file | annotate | diff | comparison | revisions |
--- 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) {