1
0
Fork 0

parsed version

master
Matthieu Lalonde 14 years ago committed by Mathieu Lecarme
parent 4a0c4d0a8a
commit 44740b7840

@ -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);
};

@ -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) {

Loading…
Cancel
Save