|
|
@ -25,6 +25,7 @@ var Client = function(_jid, password, host) {
|
|
|
|
this.rooms = {};
|
|
|
|
this.rooms = {};
|
|
|
|
this._iq = 0;
|
|
|
|
this._iq = 0;
|
|
|
|
this._iqCallback = {};
|
|
|
|
this._iqCallback = {};
|
|
|
|
|
|
|
|
this.presences = {};
|
|
|
|
this.roster = {};
|
|
|
|
this.roster = {};
|
|
|
|
this.xmpp = new xmpp.Client({
|
|
|
|
this.xmpp = new xmpp.Client({
|
|
|
|
host: this.host,
|
|
|
|
host: this.host,
|
|
|
@ -57,7 +58,7 @@ var Client = function(_jid, password, host) {
|
|
|
|
if(fromm[1] == 'conference.' + this.jid.domain) {
|
|
|
|
if(fromm[1] == 'conference.' + this.jid.domain) {
|
|
|
|
jabber.rooms[fromm[0]].emit('presence', stanza);
|
|
|
|
jabber.rooms[fromm[0]].emit('presence', stanza);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
jabber.emit('presence', stanza);
|
|
|
|
jabber.emit('presence', stanza.attrs.from, stanza);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(stanza.name == 'message') {
|
|
|
|
if(stanza.name == 'message') {
|
|
|
@ -85,6 +86,9 @@ var Client = function(_jid, password, host) {
|
|
|
|
this.addListener('iqResult', function(id, stanza){
|
|
|
|
this.addListener('iqResult', function(id, stanza){
|
|
|
|
jabber._iqCallback[id].call(jabber, stanza);
|
|
|
|
jabber._iqCallback[id].call(jabber, stanza);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
this.addListener('presence', function(from, stanza) {
|
|
|
|
|
|
|
|
jabber.presences[from] = stanza.attrs.type;
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
sys.inherits(Client, events.EventEmitter);
|
|
|
|
sys.inherits(Client, events.EventEmitter);
|
|
|
|