# HG changeset patch # User Emmanuel Gil Peyrot # Date 1282864480 -7200 # Node ID 9a6b8b3357c69098d48498d87c3fbcb0ebc4ebdf # Parent 0ed3c06c5191761e85c649345f64b1bc389d0aef Use new functions like console.log instead of sys.puts, and aerate a bit. diff --git a/nodes.js b/nodes.js --- a/nodes.js +++ b/nodes.js @@ -41,18 +41,25 @@ exports.Node = function(params) { if (config.enabled('publisher-affiliation')) this.publisher = []; + if (config.enabled('publish-only-affiliation')) this.publishOnly = []; + if (config.enabled('member-affiliation')) this.member = []; + if (config.enabled('outcast-affiliation')) this.outcast = []; + if (config.enabled('meta-data')) this.metadata = new Configuration(service_configuration.node_metadata, params); + if (config.enabled('config-node')) this.configuration = new Configuration(service_configuration.node_config, params); + if (config.enabled('subscription-options')) this.subsConfig = new Configuration(service_configuration.subscribe_options, params); + return this; }; diff --git a/psgxs.js b/psgxs.js --- a/psgxs.js +++ b/psgxs.js @@ -19,7 +19,6 @@ * along with PSĜS. If not, see . */ -var sys = require('sys'); var xmpp = require('xmpp'); var sha1 = require('sha1'); require('./iso8601'); @@ -35,15 +34,14 @@ var service_configuration = config.servi var componentJID = config.jid; var componentPassword = config.password; -conn.log = function (_, m) { sys.puts(m); }; +conn.log = function (_, m) { console.log(m); }; -function _(m, c) { - if (c) - sys.print('\033[1;'+c+'m'); - sys.print(sys.inspect(m, false, null)); - if (c) - sys.print('\033[0m'); - sys.puts(''); +function _(obj, color) { + var str = require('sys').inspect(obj, false, null); + if (color) + console.log('\033['+c+';1m' + str + '\033[0m'); + else + console.log(str); }; process.addListener('uncaughtException', function (err) { @@ -778,6 +776,7 @@ function onIq(stanza) { if (!conf) conf = {}; conf['pubsub#creator'] = toBareJID(to); + var r = storage.createNode(nodeID, conf); if (typeof r == 'number') return makeError(response, r); diff --git a/storage.js b/storage.js --- a/storage.js +++ b/storage.js @@ -17,7 +17,6 @@ * along with PSĜS. If not, see . */ -var sys = require('sys'); var sha1hex = require('sha1').hex; require('./iso8601'); var errors = require('./errors'); @@ -512,7 +511,7 @@ storage.save = function(file) { if (!file) file = 'save.json'; - fs.writeFile(file, sys.inspect(data, null, null)); + fs.writeFile(file, require('sys').inspect(data, null, null)); } storage.load = function(file) { @@ -556,5 +555,5 @@ storage.load = function(file) { } storage.debug = function() { - sys.puts('\033[1;33m' + sys.inspect(list, null, null) + '\033[0m'); + console.log('\033[1;33m' + require('sys').inspect(list, null, null) + '\033[0m'); };