commit
64b6b95935
@ -0,0 +1,2 @@
|
||||
exports.Client = require('./xmpp-client/client').Client;
|
||||
exports.jid = require('./xmpp-client/client').jid;
|
@ -0,0 +1,23 @@
|
||||
var sys = require('sys'),
|
||||
xmpp = require('xmpp'),
|
||||
events = require('events');
|
||||
|
||||
var jid = function(plain) {
|
||||
var tmp = plain.split('/');
|
||||
var j = {};
|
||||
j.resource = (tmp.length == 1) ? null : tmp[1];
|
||||
tmp = tmp[0].split('@');
|
||||
j.node = tmp[0];
|
||||
j.domain = tmp[1];
|
||||
return j;
|
||||
};
|
||||
|
||||
exports.jid = jid;
|
||||
|
||||
var Client = function(host, jid, password) {
|
||||
events.EventEmitter.call(this);
|
||||
var jabber = this;
|
||||
};
|
||||
|
||||
sys.inherits(Client, events.EventEmitter);
|
||||
exports.Client = Client;
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,20 @@
|
||||
var sys = require('sys'),
|
||||
client = require('../lib/xmpp-client').Client,
|
||||
jid = require('../lib/xmpp-client').jid;
|
||||
|
||||
exports.testJid = function(test) {
|
||||
var j = jid('mathieu@gtalk.com');
|
||||
//sys.debug(JSON.stringify(j));
|
||||
test.equals('mathieu', j.node);
|
||||
test.equals('gtalk.com', j.domain);
|
||||
test.equals(null, j.resource);
|
||||
j = jid('mathieu@jabber.org/node');
|
||||
//sys.debug(JSON.stringify(j));
|
||||
test.equals('node', j.resource);
|
||||
test.done();
|
||||
};
|
||||
|
||||
if(module.id == '.'){
|
||||
var testrunner = require('nodeunit').testrunner;
|
||||
testrunner.run([__filename]);
|
||||
}
|
Loading…
Reference in new issue