|
|
|
@ -25,6 +25,7 @@ var Client = function(_jid, password, host) {
|
|
|
|
|
this.rooms = {};
|
|
|
|
|
this._iq = 0;
|
|
|
|
|
this._iqCallback = {};
|
|
|
|
|
this.roster = {};
|
|
|
|
|
this.xmpp = new xmpp.Client({
|
|
|
|
|
host: this.host,
|
|
|
|
|
jid: '' + this.jid,
|
|
|
|
@ -44,7 +45,7 @@ var Client = function(_jid, password, host) {
|
|
|
|
|
sys.debug('STANZA: ' + stanza);
|
|
|
|
|
if(stanza.name == 'iq') {
|
|
|
|
|
if(stanza.attrs.type == 'result') {
|
|
|
|
|
this._debug('IQ result: ' + stanza);
|
|
|
|
|
jabber._debug('IQ result: ' + stanza);
|
|
|
|
|
jabber.emit('iqResult', stanza.attrs.id, stanza);
|
|
|
|
|
} else {
|
|
|
|
|
this._debug('IQ: ' + stanza);
|
|
|
|
@ -53,7 +54,7 @@ var Client = function(_jid, password, host) {
|
|
|
|
|
}
|
|
|
|
|
if(stanza.name == 'presence') {
|
|
|
|
|
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);
|
|
|
|
|
} else {
|
|
|
|
|
jabber.emit('presence', stanza);
|
|
|
|
@ -64,8 +65,8 @@ var Client = function(_jid, password, host) {
|
|
|
|
|
if(stanza.attrs.type == 'groupchat') {
|
|
|
|
|
jabber.emit('groupchat', from, stanza);
|
|
|
|
|
} else {
|
|
|
|
|
this._debug('MESSAGE: ' + stanza);
|
|
|
|
|
jabber.emit('message', from, stanza);
|
|
|
|
|
jabber._debug('MESSAGE: ' + 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.presence();
|
|
|
|
|
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');
|
|
|
|
|
});
|
|
|
|
|