1
0
Fork 0
master
Matthieu Lalonde 14 years ago committed by Mathieu Lecarme
parent 4b9378ff17
commit 112a8e6302

@ -31,10 +31,10 @@ var BasicClient = function(params, callback) {
case 'iq': case 'iq':
switch(stanza.attrs.type) { switch(stanza.attrs.type) {
case 'error': case 'error':
jabber._iqCallback[stanza.attrs.id][1].apply(jabber, [stanza]);
break; break;
case 'result': case 'result':
jabber._iqCallback[stanza.attrs.id][0].apply(jabber, [stanza]);
break; break;
default: default:
jabber.emit('iq', stanza); jabber.emit('iq', stanza);

@ -9,7 +9,19 @@ exports.testInit = function(test) {
test.expect(1); test.expect(1);
var b = new BasicClient(conf.b, function() { var b = new BasicClient(conf.b, function() {
sys.debug('just connected'); sys.debug('just connected');
test.ok('true', 'connected'); test.ok(true, 'connected');
test.done(); test.done();
}); });
}; };
exports.testIq = function(test) {
test.expect(1);
new BasicClient(conf.b, function() {
this.iq(null, new xmpp.Element('query', {xmlns: 'jabber:iq:roster'}), function(iq) {
var roster = iq.getChild('query', 'jabber:iq:roster').getChildren('item');
sys.debug(roster);
test.notEqual(null, roster, 'roster');
test.done();
});
});
};
Loading…
Cancel
Save