diff modules.js @ 56:99bd1d1ac071

Migration to node-xmpp, done!
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 10 Aug 2011 15:11:22 -0700
parents 0d3f18bb1d36
children addbf6bbfaa8
line wrap: on
line diff
--- a/modules.js
+++ b/modules.js
@@ -31,7 +31,8 @@ var fdsq = require('./fdsq');
 var sandbox = {
 	process: process,
 	config: require('./configuration'),
-	xmpp: require('xmpp'),
+	Element: require('ltx').Element,
+	uuid: require('uuid'),
 	errors: require('./errors'),
 	forms: require('./forms'),
 	makeError: require('./errors').makeError,
@@ -39,7 +40,6 @@ var sandbox = {
 	NS: require('./namespaces'),
 	require: require,
 	storage: require('./storage'),
-	makeRandomId: fdsq.makeRandomId,
 	JID: {
 		toBare: fdsq.toBare,
 		toResource: fdsq.toResource
@@ -54,11 +54,11 @@ for (var i in files) {
 
 	fs.readFile(dir + '/' + file, function(err, data) {
 		if (err) {
-			console.log('ERROR: loading module “'+file+'”.'); // FIXME: file is always the last file of the list…
+			console.log('Erreur de chargement de module.');
 			return;
 		}
 
-		Script.runInNewContext(data, sandbox, dir + '/' + file); // FIXME: the same.
+		Script.runInNewContext(data, sandbox, dir + '/' + file);
 		var module = sandbox.exports;
 		sandbox.exports = {};
 
@@ -67,6 +67,7 @@ for (var i in files) {
 				console.log('WARNING: module '+j+' already loaded.');
 
 			modules[j] = module[j];
+			console.log('Module '+j+' loaded!');
 		}
 	});
 }