1
0
Fork 0
master
Matthieu Lalonde 14 years ago committed by Mathieu Lecarme
parent 8ce3836be9
commit f01e68ad1d

@ -41,11 +41,15 @@ var BasicClient = function(params, callback) {
default:
jabber.emit('iq', stanza);
var q = stanza.getChild('query');
if(q == undefined) {
jabber.emit('iq:unknow', stanza);
} else {
if(q.attrs.xmlns != null && jabber._iqHandler[q.attrs.xmlns] != null) {
jabber._iqHandler[q.attrs.xmlns].call(jabber, stanza);
} else {
jabber.emit('iq:unknow', stanza);
}
}
break;
}
break;
@ -81,7 +85,7 @@ BasicClient.prototype.presence = function(type) {
};
BasicClient.prototype.iq = function(to, query, callback, error) {
error |= function(stanza) { sys.error(stanza);};
error |= function(stanza) { sys.error((this.jid + " : " + stanza.toString()).red);};
var n = 'node' + this._iq++;
this._iqCallback[n] = [callback, error];
var attrs = {

@ -26,13 +26,18 @@ exports.testIq = function(test) {
};
exports.testPresence = function(test) {
/*
[FIXME] this test don't manage Resource, if you have an opened jabber client, it may hurt this test
*/
test.expect(1);
var prems = true;
var b = new BasicClient(conf.b, function() {
this.addListener('presence', function(presence) {
//sys.debug(presence.attrs.from.split('/')[0].red);
if(presence.attrs.from.split('/')[0] == conf.a.jid) {
//sys.debug(presence.attrs.from.red);
if(presence.attrs.from.split('/')[0] == conf.a.jid && prems) {
test.ok(true, "B is present");
test.done();
prems = false;
}
});
var a = new BasicClient(conf.a, function() {

Loading…
Cancel
Save