diff --git a/lib/xmpp-client/client.js b/lib/xmpp-client/client.js index 3a7b877..db894e2 100644 --- a/lib/xmpp-client/client.js +++ b/lib/xmpp-client/client.js @@ -62,10 +62,19 @@ Client.prototype.getRoster = function(callback) { }); }; +/* +http://xmpp.org/extensions/xep-0092.html +*/ Client.prototype.getVersion = function(jid, callback, error) { var jabber = this; this.iq(jid, new xmpp.Element('query', {xmlns: 'jabber:iq:version'}), function(iq) { - callback.call(jabber, iq.getChild('query', 'jabber:iq:version') ); + var v = iq.getChild('query', 'jabber:iq:version'); + var version = { + name: v.getChildText('name'), + version: v.getChildText('version'), + os: v.getChildText('os') + }; + callback.call(jabber, version); }, error); }; diff --git a/test/test-iq.js b/test/test-iq.js index 7a1eaea..bcd3610 100644 --- a/test/test-iq.js +++ b/test/test-iq.js @@ -11,8 +11,8 @@ exports.testIq = function(test) { var b = new Client(conf.b, function() { //sys.debug(this.jid.toString().blue); a.getVersion(b.jid, function(version) { - sys.debug(version.toString().yellow); - test.ok(true, 'version'); + sys.debug(JSON.stringify(version).yellow); + test.equals('node-xmpp-client',version.name, 'same client'); test.done(); }, function(iq) {