changeset 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
files avatar.js configuration.js
diffstat 2 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/avatar.js
+++ b/avatar.js
@@ -24,12 +24,7 @@ var config = require('./configuration');
 
 try {
 	var xmpp = require('node-xmpp');
-	var conn = new xmpp.Component({
-		jid: config.jid,
-		password: config.password,
-		host: 'localhost',
-		port: 5347
-	});
+	var conn = new xmpp.Component(config);
 
 	conn.on('stanza', function (stanza) {
 		if (stanza.is('iq'))
@@ -46,7 +41,7 @@ try {
 	var Element = require('ltx').Element;
 } catch (e) {
 	var xmpp = require('xmpp');
-	var conn = new xmpp.Connection();
+	var conn = new xmpp.Connection(config.host, config.port);
 
 	conn.log = function (_, m) { console.log(m); };
 
--- a/configuration.js
+++ b/configuration.js
@@ -21,5 +21,7 @@
 var config = exports;
 
 config.jid = 'avatar.example.org';
+config.host = 'localhost';
+config.port = 5347;
 config.password = 'hellohello';
-config.directory = 'data';
+config.directory = 'data'; // Directory of the cache.