Permalink
Browse files

removed useless files

  • Loading branch information...
1 parent f402bf6 commit 8be3d751fdf775abc14c5de62bf24b585b496cce @julien51 julien51 committed Mar 16, 2012
Showing with 0 additions and 603 deletions.
  1. +0 −85 chat.js
  2. +0 −63 connect-client.js
  3. +0 −39 design.markdown
  4. +0 −63 disco_info.js
  5. +0 −68 offline.js
  6. +0 −33 registration.js
  7. +0 −55 roster.js
  8. +0 −129 s2s-chat.js
  9. +0 −68 version.js
View
@@ -1,85 +0,0 @@
-/**
-* This connnects 2 clients to the server and makes sure they converse adequately!
-**/
-var xmpp = require('node-xmpp');
-var server = require('../../lib/server.js');
-var _ = require('underscore');
-
-var User = require('../../lib/users.js').User;
-fixtures = [["bernard@localhost", "bErnArD"], ["bianca@localhost", "B1anCA"]]; // Fixtures
-
-describe('A small chat', function(){
- var bernard, bianca = null;
-
- before(function(proceed) {
- server.run({port: 5222, domain: 'localhost'}, function() {
- proceed();
- });
- });
-
- beforeEach(function(proceed){
- var ready = _.after(fixtures.length, function() {
- bernard = new xmpp.Client({
- jid: "bernard@localhost",
- password: "bErnArD"
- });
- bianca = new xmpp.Client({
- jid: "bianca@localhost",
- password: "B1anCA"
- });
-
- // When Bernard is online. Let's get him to reply to Bianca only if she says 'Hello Bernard!'. If she doesn't, then, we fail.
- bernard.on('online', function () {
- bernard.send(new xmpp.Element('presence', {}).c('show').t('chat').up().c('status').t('Bernard is here to help!'));
- online();
- });
-
- bianca.on('online', function () {
- bianca.send(new xmpp.Element('presence', {}).c('show').t('chat').up().c('status').t('Ready to help!'));
- online();
- });
- var online = _.after(2, function() {
- proceed();
- });
- });
- _.each(fixtures, function(fixture) {
- User.register(fixture[0], fixture[1], {
- force: true,
- success: ready,
- error: function(err) {
- console.log("Couldn't add users.");
- process.exit(1);
- }
- });
- });
- });
-
- it('bernard should get bianca\'s messages', function(done){
- var biancaSays = 'Hello Bernard!';
- bernard.on('stanza', function(stanza) {
- if (stanza.is('message') && new xmpp.JID(stanza.attrs.from).bare().toString() == "bianca@localhost" && stanza.getChild('body').getText() == biancaSays) {
- done();
- }
- else {
- throw function() {}; // Bernard didn't get Bianca's Hello.
- }
- });
- bianca.send(new xmpp.Element('message', {to: "bernard@localhost"}).c('body').t(biancaSays));
- });
-
- it('bianca should get bernard\'s messages', function(done){
- var bernardSays = 'Hi Bianca!';
- bianca.on('stanza', function(stanza) {
- if (stanza.is('message') && new xmpp.JID(stanza.attrs.from).bare().toString() == "bernard@localhost" && stanza.getChild('body').getText() == bernardSays) {
- done();
- }
- else {
- throw function() {}; // Bernard didn't get Bianca's Hello.
- }
- });
- bernard.send(new xmpp.Element('message', {to: "bianca@localhost"}).c('body').t(bernardSays));
- });
-
-});
-
-
View
@@ -1,63 +0,0 @@
-/**
-* This attempts to connect to the XMPP server.
-**/
-var xmpp = require('node-xmpp');
-var server = require('../../lib/server.js');
-
-var _ = require('underscore');
-var User = require('../../lib/users.js').User;
-
-fixtures = [["bernard@bernard.local", "bErnArD"]]; // Fixtures
-
-// Mocking SRV reolution!
-var dns = require('dns');
-dns.resolveSrv = function(domain, callback) {
- callback(null, [{name: '0.0.0.0', port: 5222, priority: 5, weight:10}]);
-}
-
-describe('Connect client', function(){
-
- before(function(proceed) {
- server.run({port: 5222, domain: 'bernard.local', bindAddress: '0.0.0.0'}, function() {
- proceed();
- });
- });
-
- beforeEach(function(proceed){
- var ready = _.after(fixtures.length, function() {
- proceed();
- });
- _.each(fixtures, function(fixture) {
- User.register(fixture[0], fixture[1], {
- force: true,
- success: ready,
- error: function(err) {
- console.log("Couldn't add users.");
- process.exit(1);
- }
- });
- });
- });
-
- it('should connect just fine when the password is correct', function(done){
- var cl = new xmpp.Client({jid: "bernard@bernard.local", password: "bErnArD"});
- cl.on('online', function () {
- done();
- });
- });
-
- it('should trigger an error when the password is not correct', function(done){
- var cl = new xmpp.Client({jid: "bernard@bernard.local", password: "bErnArD0"});
- cl.on('online', function () {
- throw function() {};
- });
- cl.on('error', function(err) {
- if(err === "XMPP authentication failure") {
- done();
- }
- });
- });
-
-});
-
-
View
@@ -1,39 +0,0 @@
-# Design
-
-This documents highlights the design of xmpp-server
-
-Client <- Socket (TCP or else) -> Connection -> Session -> Session Manager -> Router
-
-## Connection
-
-All the low level stuff. [what?]
-
-## Session
-
-Represents a connection + jid (including ressource)
-
-## Session Manager
-
-All the session for a given user
-
-## Router
-
-All the users + Outside world (S2S).
-
-### Flow
-
- Connection Session Session Manager Router
-
-1. Authentication
-...
-
-2. User sends message to another local user
-...
-
-3. User sends message to non-local user
-...
-
-4.
-...
-
-
View
@@ -1,63 +0,0 @@
-/**
-* This attempts to connect to the XMPP server and tests the roster features
-**/
-var xmpp = require('node-xmpp');
-var server = require('../../lib/server.js');
-
-var _ = require('underscore');
-var User = require('../../lib/users.js').User;
-
-fixtures = [["bernard@localhost", "bErnArD"]]; // Fixtures
-
-
-describe('Connect client', function(){
- var cl = null;
-
- before(function(proceed) {
- server.run({port: 5222, domain: 'localhost'}, function() {
- proceed();
- });
- });
-
-
- beforeEach(function(proceed){
- var ready = _.after(fixtures.length, function() {
- cl = new xmpp.Client({jid: "bernard@localhost", password: "bErnArD"});
- cl.on('online', function () {
- proceed();
- });
- });
- _.each(fixtures, function(fixture) {
- User.register(fixture[0], fixture[1], {
- force: true,
- success: ready,
- error: function(err) {
- console.log("Couldn't add users.");
- process.exit(1);
- }
- });
- });
- });
-
- it('should be able discover server infos', function(done){
- cl.on('stanza', function(stanza) {
- var query = stanza.getChild('query', 'http://jabber.org/protocol/disco#info');
- if(stanza.name === "iq" && query) {
- done();
- }
- });
- cl.send(new xmpp.Iq({type: 'get'}).c('query', {xmlns: 'http://jabber.org/protocol/disco#info'}));
- });
- it('should be able discover server items', function(done){
- cl.on('stanza', function(stanza) {
- var query = stanza.getChild('query', "http://jabber.org/protocol/disco#items");
- if(stanza.name === "iq" && query) {
- done();
- }
- });
- cl.send(new xmpp.Iq({type: 'get'}).c('query', {xmlns: 'http://jabber.org/protocol/disco#items'}));
- });
-
-});
-
-
View
@@ -1,68 +0,0 @@
-/**
-* This connnects 2 clients to the server and makes sure they converse adequately!
-**/
-
-var xmpp = require('node-xmpp');
-var server = require('../../lib/server.js');
-
-var _ = require('underscore');
-var User = require('../../lib/users.js').User;
-fixtures = [["romeo@localhost", "romeo"], ["juliet@localhost", "juliet"]]; // Fixtures
-
-
-describe('When a user is offline', function(){
- var romeo, juliet = null;
-
- var romeoSays = "O blessed, blessed night! I am afeard. \
- Being in night, all this is but a dream, \
- Too flattering-sweet to be substantial.";
-
- before(function(proceed) {
- server.run({port: 5222, domain: 'localhost'}, function() {
- proceed();
- });
- });
-
- beforeEach(function(proceed){
- var ready = _.after(fixtures.length, function() {
- romeo = new xmpp.Client({
- jid: "romeo@localhost",
- password: "romeo"
- });
- romeo.on('online', function () {
- romeo.send(new xmpp.Element('presence', {}).c('show').t('chat').up().c('status').t('On the balcony'));
- romeo.send(new xmpp.Element('message', {to: "juliet@localhost"}).c('body').t(romeoSays)); // juliet is not online!
- proceed();
- });
- });
- _.each(fixtures, function(fixture) {
- User.register(fixture[0], fixture[1], {
- force: true,
- success: ready,
- error: function(err) {
- console.log("Couldn't add users.");
- process.exit(1);
- }
- });
- });
- });
-
- it('should send offline messages to Juliet', function(done){
- juliet = new xmpp.Client({
- jid: "juliet@localhost",
- password: "juliet"
- });
-
- juliet.on('stanza', function(stanza) {
- if (stanza.is('message') && new xmpp.JID(stanza.attrs.from).bare().toString() == "romeo@localhost" && stanza.getChild('body').getText() == romeoSays) {
- done();
- }
- else {
- throw function() {}; // Bernard didn't get Bianca's Hello.
- }
- });
- });
-
-});
-
-
View
@@ -1,33 +0,0 @@
-/**
-* This attempts to connect to the XMPP server.
-**/
-var xmpp = require('node-xmpp');
-var server = require('../../lib/server.js');
-
-var _ = require('underscore');
-var User = require('../../lib/users.js').User;
-
-
-describe('Register a new jid', function(){
-
- before(function(proceed) {
- server.run({port: 5222, domain: 'localhost', bindAddress: '0.0.0.0'}, function() {
- proceed();
- });
- });
-
- beforeEach(function(proceed){
- proceed();
- });
-
- it('should allow for user registration for a new jid', function(done){
- // Can't be implemented as it seems that node-xmpp doesn't support registration for now :(
- });
-
- it('should prevent duplication if that jid exists', function(done){
- // Can't be implemented as it seems that node-xmpp doesn't support registration for now :(
- });
-
-});
-
-
Oops, something went wrong.

0 comments on commit 8be3d75

Please sign in to comment.