diff psgxs.js @ 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 ec7cea92fe8a
line wrap: on
line diff
--- 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);