|
|
@ -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.roster = {};
|
|
|
|
this.xmpp = new xmpp.Client({
|
|
|
|
this.xmpp = new xmpp.Client({
|
|
|
|
host: this.host,
|
|
|
|
host: this.host,
|
|
|
|
jid: '' + this.jid,
|
|
|
|
jid: '' + this.jid,
|
|
|
@ -44,7 +45,7 @@ var Client = function(_jid, password, host) {
|
|
|
|
sys.debug('STANZA: ' + stanza);
|
|
|
|
sys.debug('STANZA: ' + stanza);
|
|
|
|
if(stanza.name == 'iq') {
|
|
|
|
if(stanza.name == 'iq') {
|
|
|
|
if(stanza.attrs.type == 'result') {
|
|
|
|
if(stanza.attrs.type == 'result') {
|
|
|
|
this._debug('IQ result: ' + stanza);
|
|
|
|
jabber._debug('IQ result: ' + stanza);
|
|
|
|
jabber.emit('iqResult', stanza.attrs.id, stanza);
|
|
|
|
jabber.emit('iqResult', stanza.attrs.id, stanza);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this._debug('IQ: ' + stanza);
|
|
|
|
this._debug('IQ: ' + stanza);
|
|
|
@ -53,7 +54,7 @@ var Client = function(_jid, password, host) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(stanza.name == 'presence') {
|
|
|
|
if(stanza.name == 'presence') {
|
|
|
|
var fromm = stanza.attrs.from.split('/')[0].split('@');
|
|
|
|
var fromm = stanza.attrs.from.split('/')[0].split('@');
|
|
|
|
if(fromm[1] == 'conference.ohmforce.net') {
|
|
|
|
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);
|
|
|
@ -64,8 +65,8 @@ var Client = function(_jid, password, host) {
|
|
|
|
if(stanza.attrs.type == 'groupchat') {
|
|
|
|
if(stanza.attrs.type == 'groupchat') {
|
|
|
|
jabber.emit('groupchat', from, stanza);
|
|
|
|
jabber.emit('groupchat', from, stanza);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this._debug('MESSAGE: ' + stanza);
|
|
|
|
jabber._debug('MESSAGE: ' + stanza);
|
|
|
|
jabber.emit('message', from, stanza);
|
|
|
|
jabber.emit('message', from, stanza.getChild('body').getText(), stanza);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -73,7 +74,7 @@ var Client = function(_jid, password, host) {
|
|
|
|
jabber._debug("[Info] xmpp connection");
|
|
|
|
jabber._debug("[Info] xmpp connection");
|
|
|
|
jabber.presence();
|
|
|
|
jabber.presence();
|
|
|
|
jabber.iq(new xmpp.Element('query', {xmlns: 'jabber:iq:roster'}), function(iq) {
|
|
|
|
jabber.iq(new xmpp.Element('query', {xmlns: 'jabber:iq:roster'}), function(iq) {
|
|
|
|
this._debug("MY ROSTER" + iq);
|
|
|
|
jabber._debug("MY ROSTER" + iq);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
jabber.emit('online');
|
|
|
|
jabber.emit('online');
|
|
|
|
});
|
|
|
|
});
|
|
|
|