Mercurial > psgxs
changeset 12:9a6b8b3357c6
Use new functions like console.log instead of sys.puts, and aerate a bit.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 27 Aug 2010 01:14:40 +0200 |
parents | 0ed3c06c5191 |
children | 447db2e8c622 |
files | nodes.js psgxs.js storage.js |
diffstat | 3 files changed, 17 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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; };
--- a/psgxs.js +++ b/psgxs.js @@ -19,7 +19,6 @@ * along with PSĜS. If not, see <http://www.gnu.org/licenses/>. */ -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);
--- a/storage.js +++ b/storage.js @@ -17,7 +17,6 @@ * along with PSĜS. If not, see <http://www.gnu.org/licenses/>. */ -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'); };