# HG changeset patch # User Emmanuel Gil Peyrot # Date 1298977095 -3600 # Node ID 023f767662d3c4cee0ffb5a48f370d45b747974f # Parent 07ca0263a53fb542e2ab7329f18a3dbd941f89aa Fix compatibility with strict mode of node 0.4 and some files without licence header. diff --git a/README b/README --- a/README +++ b/README @@ -60,8 +60,6 @@ Please read the COPYING file for details ======================= Thanks ======================= -= People = - Paul Sowden () - ISO 8601 date functions ====================== The code diff --git a/backends/directory.js b/backends/directory.js --- a/backends/directory.js +++ b/backends/directory.js @@ -17,6 +17,8 @@ * along with PSĜS. If not, see . */ +'use strict'; + var fs = require('fs'); var Node = require('../nodes').Node; var backend = exports; @@ -27,9 +29,9 @@ backend.save = function(dir) { fs.stat(dir, function(err, stats) { if (err) - fs.mkdir(dir, 0755); + fs.mkdir(dir, 509); // 0755 in decimal else if (!stats.isDirectory()) { - console.log('\033[1;41mThe file “' + dir + '” isn’t a directory. Exiting.\033[0m'); + console.log('\x1b[1;41mThe file “' + dir + '” isn’t a directory. Exiting.\x1b[0m'); process.exit(1); } @@ -77,9 +79,9 @@ backend.load = function(dir) { fs.stat(dir, function(err, stats) { if (err) - fs.mkdir(dir, 0755); + fs.mkdir(dir, 509); // 0755 in decimal else if (!stats.isDirectory()) { - console.log('\033[1;41mThe file “' + dir + '” isn’t a directory. Exiting.\033[0m'); + console.log('\x1b[1;41mThe file “' + dir + '” isn’t a directory. Exiting.\x1b[0m'); process.exit(1); } diff --git a/backends/file.js b/backends/file.js --- a/backends/file.js +++ b/backends/file.js @@ -17,6 +17,8 @@ * along with PSĜS. If not, see . */ +'use strict'; + var fs = require('fs'); var Node = require('../nodes').Node; var backend = exports; @@ -82,7 +84,7 @@ backend.load = function(file) { if (err) fs.writeFileSync(file, '{}'); else if (!stats.isFile()) { - console.log('\033[1;41mThe file “' + file + '” isn’t a regular file. Exiting.\033[0m'); + console.log('\x1b[1;41mThe file “' + file + '” isn’t a regular file. Exiting.\x1b[0m'); process.exit(1); } diff --git a/configuration.js b/configuration.js --- a/configuration.js +++ b/configuration.js @@ -17,6 +17,8 @@ * along with PSĜS. If not, see . */ +'use strict'; + var config = exports; config.jid = 'pubsub.example.org'; diff --git a/errors.js b/errors.js --- a/errors.js +++ b/errors.js @@ -17,6 +17,8 @@ * along with PSĜS. If not, see . */ +'use strict'; + var errors = exports; errors.success = true; diff --git a/fdsq.js b/fdsq.js --- a/fdsq.js +++ b/fdsq.js @@ -17,6 +17,8 @@ * along with PSĜS. If not, see . */ +'use strict'; + var sha1hex = require('sha1').hex; var fdsq = exports; diff --git a/forms.js b/forms.js --- a/forms.js +++ b/forms.js @@ -17,6 +17,8 @@ * along with PSĜS. If not, see . */ +'use strict'; + var xmpp = require('xmpp') var service_configuration = require('./configuration').service_configuration; diff --git a/iso8601.js b/iso8601.js --- a/iso8601.js +++ b/iso8601.js @@ -17,6 +17,8 @@ * along with PSĜS. If not, see . */ +'use strict'; + Date.prototype.setFromISO8601 = function(iso){ var format = /(\d{4})(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)Z/; var m = iso.match(format); diff --git a/modules.js b/modules.js --- a/modules.js +++ b/modules.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + var modules = exports; var fs = require('fs'); diff --git a/modules/http/mod_atom.js b/modules/http/mod_atom.js --- a/modules/http/mod_atom.js +++ b/modules/http/mod_atom.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + exports.atom = { url: /^\/atom/, func: function (req, res) { diff --git a/modules/mod_adhoc.js b/modules/mod_adhoc.js --- a/modules/mod_adhoc.js +++ b/modules/mod_adhoc.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + // XEP-0050: Ad-Hoc Commands exports.adHoc = { type: 'set', diff --git a/modules/mod_configure.js b/modules/mod_configure.js --- a/modules/mod_configure.js +++ b/modules/mod_configure.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + // SECTION 8.2: Configure a Node exports.getConfigure = { type: 'get', diff --git a/modules/mod_disco.js b/modules/mod_disco.js --- a/modules/mod_disco.js +++ b/modules/mod_disco.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + // SECTION 5.1: Discover Features exports.disco_info = { type: 'get', diff --git a/modules/mod_http.js b/modules/mod_http.js --- a/modules/mod_http.js +++ b/modules/mod_http.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + var sites = {}; var http = require('http'); diff --git a/modules/mod_manage.js b/modules/mod_manage.js --- a/modules/mod_manage.js +++ b/modules/mod_manage.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + // SECTION 8.8.1: Retrieve Subscriptions List exports.manageRetrieveSub = { type: 'get', diff --git a/modules/mod_options.js b/modules/mod_options.js --- a/modules/mod_options.js +++ b/modules/mod_options.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + // SECTION 6.3.2: Configure Subscription Options (Request) exports.getConfigureSub = { type: 'get', diff --git a/modules/mod_owner.js b/modules/mod_owner.js --- a/modules/mod_owner.js +++ b/modules/mod_owner.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + // SECTION 8.1: Create a Node exports.create = { type: 'set', diff --git a/modules/mod_publish.js b/modules/mod_publish.js --- a/modules/mod_publish.js +++ b/modules/mod_publish.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + // SECTION 7.1: Publish an Item to a Node exports.publish = { type: 'set', diff --git a/modules/mod_publish_message.js b/modules/mod_publish_message.js --- a/modules/mod_publish_message.js +++ b/modules/mod_publish_message.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + exports.publishMessage = { stanza: 'message', child: 'body', diff --git a/modules/mod_retrieve.js b/modules/mod_retrieve.js --- a/modules/mod_retrieve.js +++ b/modules/mod_retrieve.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + // SECTION 5.6: Retrieve Subscriptions exports.retrieveSubscriptions = { type: 'get', diff --git a/modules/mod_subscribe.js b/modules/mod_subscribe.js --- a/modules/mod_subscribe.js +++ b/modules/mod_subscribe.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + // SECTION 6.1: Subscribe to a Node exports.subscribe = { type: 'set', diff --git a/modules/mod_version.js b/modules/mod_version.js --- a/modules/mod_version.js +++ b/modules/mod_version.js @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2010 Emmanuel Gil Peyrot + * + * This file is part of PSĜS, a PubSub server written in JavaScript. + * + * PSĜS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + * + * PSĜS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with PSĜS. If not, see . + */ + +'use strict'; + // XEP-0092: Software Version exports.version = { type: 'get', diff --git a/namespaces.js b/namespaces.js --- a/namespaces.js +++ b/namespaces.js @@ -1,3 +1,5 @@ +'use strict'; + var NS = exports; NS.DISCO_INFO = 'http://jabber.org/protocol/disco#info'; diff --git a/nodes.js b/nodes.js --- a/nodes.js +++ b/nodes.js @@ -17,6 +17,8 @@ * along with PSĜS. If not, see . */ +'use strict'; + require('./iso8601'); var errors = require('./errors'); var config = require('./configuration'); diff --git a/notifs.js b/notifs.js --- a/notifs.js +++ b/notifs.js @@ -1,3 +1,5 @@ +'use strict'; + var xmpp = require('xmpp'); var storage = require('./storage'); var config = require('./configuration'); @@ -6,7 +8,7 @@ var conn; function _(obj, color) { var str = require('sys').inspect(obj, false, null); if (color) - console.log('\033['+c+';1m' + str + '\033[0m'); + console.log('\x1b['+c+';1m' + str + '\x1b[0m'); else console.log(str); }; diff --git a/psgxs.js b/psgxs.js --- a/psgxs.js +++ b/psgxs.js @@ -19,6 +19,8 @@ * along with PSĜS. If not, see . */ +'use strict'; + var xmpp = require('xmpp'); var sha1 = require('sha1'); require('./iso8601'); @@ -45,13 +47,13 @@ conn.log = function (_, m) { console.log function _(obj, color) { var str = require('sys').inspect(obj, false, null); if (color) - console.log('\033['+c+';1m' + str + '\033[0m'); + console.log('\x1b['+c+';1m' + str + '\x1b[0m'); else console.log(str); }; process.addListener('uncaughtException', function (err) { - console.log('\033[41;1mUncaught exception (' + err + '), this should never happen:\033[0m\n' + err.stack); + console.log('\x1b[41;1mUncaught exception (' + err + '), this should never happen:\x1b[0m\n' + err.stack); }); if (typeof xmpp.StanzaBuilder.cnode != 'function' || typeof xmpp.StanzaBuilder.prototype.cnode != 'function') { diff --git a/storage.js b/storage.js --- a/storage.js +++ b/storage.js @@ -17,6 +17,8 @@ * along with PSĜS. If not, see . */ +'use strict'; + var fs = require('fs'); var sha1hex = require('sha1').hex; require('./iso8601'); @@ -493,5 +495,5 @@ storage.getAffiliationsFromNodeID = func }; storage.debug = function() { - console.log('\033[1;33m' + require('sys').inspect(backend.list, null, null) + '\033[0m'); + console.log('\x1b[1;33m' + require('sys').inspect(backend.list, null, null) + '\x1b[0m'); };