Mercurial > eldonilo > avatar
comparison avatar.js @ 4:8acaa0a575c7
Allow configuration of the host.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 19 May 2011 17:21:16 +0200 |
parents | 805f24754ff1 |
children | 9b2f17ea1594 |
comparison
equal
deleted
inserted
replaced
3:805f24754ff1 | 4:8acaa0a575c7 |
---|---|
22 | 22 |
23 var config = require('./configuration'); | 23 var config = require('./configuration'); |
24 | 24 |
25 try { | 25 try { |
26 var xmpp = require('node-xmpp'); | 26 var xmpp = require('node-xmpp'); |
27 var conn = new xmpp.Component({ | 27 var conn = new xmpp.Component(config); |
28 jid: config.jid, | |
29 password: config.password, | |
30 host: 'localhost', | |
31 port: 5347 | |
32 }); | |
33 | 28 |
34 conn.on('stanza', function (stanza) { | 29 conn.on('stanza', function (stanza) { |
35 if (stanza.is('iq')) | 30 if (stanza.is('iq')) |
36 onIq(stanza); | 31 onIq(stanza); |
37 else | 32 else |
44 }; | 39 }; |
45 | 40 |
46 var Element = require('ltx').Element; | 41 var Element = require('ltx').Element; |
47 } catch (e) { | 42 } catch (e) { |
48 var xmpp = require('xmpp'); | 43 var xmpp = require('xmpp'); |
49 var conn = new xmpp.Connection(); | 44 var conn = new xmpp.Connection(config.host, config.port); |
50 | 45 |
51 conn.log = function (_, m) { console.log(m); }; | 46 conn.log = function (_, m) { console.log(m); }; |
52 | 47 |
53 conn.connect(config.jid, config.password, function (status, condition) { | 48 conn.connect(config.jid, config.password, function (status, condition) { |
54 if(status == xmpp.Status.CONNECTED) { | 49 if(status == xmpp.Status.CONNECTED) { |