Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp committed Dec 4, 2015
1 parent bee54e4 commit 650f060
Show file tree
Hide file tree
Showing 29 changed files with 886 additions and 1,041 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
@@ -0,0 +1,11 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
12 changes: 8 additions & 4 deletions .gitignore
@@ -1,4 +1,8 @@
.DS_Store
node_modules
npm-debug.log
node-xmpp-browser.js
node_modules/

!.editorconfig
!.gitignore
!.npmignore
!.travis.yml

bundle.js
34 changes: 0 additions & 34 deletions .jshintrc

This file was deleted.

9 changes: 9 additions & 0 deletions .npmignore
@@ -0,0 +1,9 @@
examples/
test/

.editorconfig
.gitingore
.npmignore
.travis.yml

CONTRIBUTING.md
25 changes: 10 additions & 15 deletions .travis.yml
@@ -1,17 +1,12 @@
sudo: false

language: node_js

node_js:
- "0.10"
- "0.11"
before_install:
# Workaround for a permissions issue with Travis virtual machine images
# that breaks Python's multiprocessing:
# https://github.com/travis-ci/travis-cookbooks/issues/155
- sudo rm -rf /dev/shm
- sudo ln -s /run/shm /dev/shm
- npm i -g npm
- sudo apt-get install libicu-dev prosody luarocks
- sudo luarocks install luabitop
before_script:
- sudo cp node_modules/node-xmpp-client/test/resources/prosody.cfg.lua /etc/prosody/prosody.cfg.lua
- sudo cp node_modules/node-xmpp-client/test/resources/mod_websocket.lua /usr/lib/prosody/modules/
- sudo service prosody stop
- '0.10'
- '0.12'
- '4'
- '5'
- 'stable'

before_script: npm install -g mocha standard
26 changes: 0 additions & 26 deletions CHANGELOG.md

This file was deleted.

42 changes: 0 additions & 42 deletions Gruntfile.js

This file was deleted.

File renamed without changes.
47 changes: 24 additions & 23 deletions examples/browser/chat.js
@@ -1,32 +1,33 @@
'use strict';
'use strict'

/* global XMPP */

var cl = new XMPP.Client({
/*websocketsURL: "ws://localhost:5280/",*/
boshURL: 'https://beta.buddycloud.org/http-bind/',
jid: 'test@example.com',
password: '***'
/* websocketsURL: "ws://localhost:5280/", */
boshURL: 'https://beta.buddycloud.org/http-bind/',
jid: 'test@example.com',
password: '***'
})

cl.addListener(
'online',
function() {
['astro@spaceboyz.net'].forEach(
function(to) {
var stanza = new XMPP.Element('message', { to: to, type: 'chat'})
.c('body')
.t('Hello from browser')
cl.send(stanza)
}
)
// nodejs has nothing left to do and will exit
cl.end()
}
'online',
function () {
['astro@spaceboyz.net'].forEach(
function (to) {
var stanza = new XMPP.Element('message', {to: to, type: 'chat'})
.c('body')
.t('Hello from browser')
cl.send(stanza)
}
)
// nodejs has nothing left to do and will exit
cl.end()
}
)

cl.addListener(
'error',
function(e) {
console.error(e)
}
)
'error',
function (e) {
console.error(e)
}
)
79 changes: 39 additions & 40 deletions examples/c2s.js
@@ -1,4 +1,4 @@
'use strict';
'use strict'

var xmpp = require('../index')

Expand All @@ -9,47 +9,46 @@ var xmpp = require('../index')

// Sets up the server.
var c2s = new xmpp.C2SServer({
port: 5222,
domain: 'localhost'
// key : "key.pem content",
// cert : "cert.pem content",
// // or
// tls: {
// keyPath: './examples/localhost-key.pem',
// certPath: './examples/localhost-cert.pem'
// }
port: 5222,
domain: 'localhost'
// key : "key.pem content",
// cert : "cert.pem content",
// // or
// tls: {
// keyPath: './examples/localhost-key.pem',
// certPath: './examples/localhost-cert.pem'
// }

})

// On Connect event. When a client connects.
c2s.on('connect', function(client) {
// That's the way you add mods to a given server.

// Allows the developer to register the jid against anything they want
client.on('register', function(opts, cb) {
console.log('REGISTER')
cb(true)
})

// Allows the developer to authenticate users against anything they want.
client.on('authenticate', function(opts, cb) {
console.log('AUTH' + opts.jid + ' -> ' +opts.password)
cb(null, opts) // cb(false)
})

client.on('online', function() {
console.log('ONLINE')
client.send(new xmpp.Message({ type: 'chat' }).c('body').t('Hello there, little client.'))
})

// Stanza handling
client.on('stanza', function(stanza) {
console.log('STANZA' + stanza)
})

// On Disconnect event. When a client disconnects
client.on('disconnect', function() {
console.log('DISCONNECT')
})

c2s.on('connect', function (client) {
// That's the way you add mods to a given server.

// Allows the developer to register the jid against anything they want
client.on('register', function (opts, cb) {
console.log('REGISTER')
cb(true)
})

// Allows the developer to authenticate users against anything they want.
client.on('authenticate', function (opts, cb) {
console.log('AUTH' + opts.jid + ' -> ' + opts.password)
cb(null, opts) // cb(false)
})

client.on('online', function () {
console.log('ONLINE')
client.send(new xmpp.Message({ type: 'chat' }).c('body').t('Hello there, little client.'))
})

// Stanza handling
client.on('stanza', function (stanza) {
console.log('STANZA' + stanza)
})

// On Disconnect event. When a client disconnects
client.on('disconnect', function () {
console.log('DISCONNECT')
})
})

0 comments on commit 650f060

Please sign in to comment.