From 76fc6e135a444cc149f58554ef32135e35970214 Mon Sep 17 00:00:00 2001
From: Farrin Reid <blakmatrix@gmail.com>
Date: Sat, 23 Jun 2012 06:05:51 -0800
Subject: [PATCH] [fix] Changed require('sys') to require('util') for
 compatibility with node v0.8

---
 shell/icecapd.js    |  8 ++++----
 website/app.js      | 22 +++++++++++-----------
 website/sessions.js |  4 ++--
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/shell/icecapd.js b/shell/icecapd.js
index 5025eb3..8f1e24a 100755
--- a/shell/icecapd.js
+++ b/shell/icecapd.js
@@ -5,7 +5,7 @@ var init = require('init'),
     fs = require('fs'),
     path = require('path'),
     util = require('util'),
-    sys = require('sys'),
+    util = require('util'),
     config = {};
 
 /* Read (optional) configuration file */
@@ -38,7 +38,7 @@ var init = require('init'),
 		}
 		if(arg === 'config') {
 			console.log('Config from file `' + file + "`:" );
-			console.log(sys.inspect(config));
+			console.log(util.inspect(config));
 			exit = true;
 		}
 		
@@ -81,7 +81,7 @@ init.simple({
 			
 			// Let's log every icecap event
 			//icecap.on('event', function(name, tokens) {
-			//	util.log("DEBUG: icecap.on(event): " + sys.inspect(name) + ": " + sys.inspect(tokens) );
+			//	util.log("DEBUG: icecap.on(event): " + util.inspect(name) + ": " + util.inspect(tokens) );
 			//});
 			
 			// Lets handle errors
@@ -100,7 +100,7 @@ init.simple({
 					icecap.on('event', icecap_event);
 					
 					website_socket.on('icecap.command', function(name, tokens) {
-						util.log("DEBUG: website_socket.on(client-event): " + sys.inspect(name) + ": " + sys.inspect(tokens) );
+						util.log("DEBUG: website_socket.on(client-event): " + util.inspect(name) + ": " + util.inspect(tokens) );
 						icecap.command(name, tokens);
 					});
 					
diff --git a/website/app.js b/website/app.js
index 8503347..0d8004b 100644
--- a/website/app.js
+++ b/website/app.js
@@ -5,7 +5,7 @@
 var app = module.exports = {},
     config = require('./safe-config.js'),
     express = require('express'),
-    sys = require('sys'),
+    util = require('util'),
     util = require('util'),
     params = require('express-params'),
     namespace = require('express-namespace'),
@@ -96,7 +96,7 @@ app.get('/intro', function(req, res) {
 		
 		// Browser requests gravator url
 		browser.on('get-gravatar', function(email, options, https) {
-			console.log('EVENT: get-gravatar: ' + sys.inspect(email) + ", " + sys.inspect(options) + ", " + sys.inspect(https));
+			console.log('EVENT: get-gravatar: ' + util.inspect(email) + ", " + util.inspect(options) + ", " + util.inspect(https));
 			var undefined,
 			    options = options || {},
 			    https = https || false,
@@ -106,7 +106,7 @@ app.get('/intro', function(req, res) {
 				url = email ? gravatar.url(email, options, https) : '';
 			} finally {
 				if(!url) url = '';
-				console.log('Emiting URL: ' + sys.inspect(url));
+				console.log('Emiting URL: ' + util.inspect(url));
 				browser.emit('set-gravatar', email, url, options, https);
 			}
 		});
@@ -116,7 +116,7 @@ app.get('/intro', function(req, res) {
 			console.log('Client requested new api key');
 			sessions.create(function(err, sess) {
 				if(err) {
-					console.log('Error: ' + sys.inspect(err));
+					console.log('Error: ' + util.inspect(err));
 					browser.emit('error', 'Failed to create apikey');
 					browser.emit('join-failed');
 					browser.emit('rejected-apikey');
@@ -130,7 +130,7 @@ app.get('/intro', function(req, res) {
 		
 		// Browser joins with an API key
 		browser.on('join', function(apikey) {
-			console.log( 'DEBUG: browser joins with apikey = ' + sys.inspect(apikey) );
+			console.log( 'DEBUG: browser joins with apikey = ' + util.inspect(apikey) );
 			if(session) {
 				console.log('Error: This browser was already joined to session.');
 				browser.emit('error', 'This browser was already joined to session!');
@@ -156,7 +156,7 @@ app.get('/intro', function(req, res) {
 		
 		// Browser sends an icecap.command event
 		browser.on('icecap.command', function(name, tokens) {
-			console.log( 'DEBUG: browser.on(icecap.command): ' + sys.inspect(name) + ": " + sys.inspect( tokens ) );
+			console.log( 'DEBUG: browser.on(icecap.command): ' + util.inspect(name) + ": " + util.inspect( tokens ) );
 			session && session.shell && session.shell.emit('icecap.command', name, tokens);
 		});
 		
@@ -164,7 +164,7 @@ app.get('/intro', function(req, res) {
 		browser.once('disconnect', function () {
 			console.log( 'DEBUG: browser disconnected');
 			session && session.browser && session.part(browser);
-			//console.log('session = ' + sys.inspect(session));
+			//console.log('session = ' + util.inspect(session));
 			browser.removeAllListeners('icecap.command');
 			browser.removeAllListeners('join');
 			browser.removeAllListeners('create');
@@ -182,7 +182,7 @@ app.get('/intro', function(req, res) {
 		shell.on('create', function() {
 			sessions.create(function(err, sess) {
 				if(err) {
-					console.log('Error: ' + sys.inspect(err));
+					console.log('Error: ' + util.inspect(err));
 					shell.emit('join-failed');
 					shell.emit('rejected-apikey');
 					shell.emit('error', 'Failed to create apikey');
@@ -196,7 +196,7 @@ app.get('/intro', function(req, res) {
 		
 		// Shell joins with an API key
 		shell.on('join', function(apikey) {
-			console.log( 'DEBUG: shell joins with apikey = ' + sys.inspect(apikey) );
+			console.log( 'DEBUG: shell joins with apikey = ' + util.inspect(apikey) );
 			if(session) {
 				console.log('Error: This shell was already joined to session.');
 				shell.emit('join-failed');
@@ -223,9 +223,9 @@ app.get('/intro', function(req, res) {
 		
 		// Shell sends an icecap-event, we proxy it to the browser
 		shell.on('icecap-event', function(name, tokens) {
-			console.log( 'DEBUG: shell.on(icecap-event): ' + sys.inspect(name) + ": " + sys.inspect( tokens ) );
+			console.log( 'DEBUG: shell.on(icecap-event): ' + util.inspect(name) + ": " + util.inspect( tokens ) );
 			session && session.browser && session.browser.emit('icecap-event', name, tokens);
-			console.log('session = ' + sys.inspect(session));
+			console.log('session = ' + util.inspect(session));
 		});
 		
 		// Shell daemon disconnects
diff --git a/website/sessions.js b/website/sessions.js
index f6fa5e1..fbbbd3e 100644
--- a/website/sessions.js
+++ b/website/sessions.js
@@ -5,7 +5,7 @@
 /* Temporary in memory database for User Sessions */
 var _sessions = [],
     lib = module.exports = {},
-    sys = require('sys'),
+    util = require('util'),
     config = require('./safe-config.js'),
 	cradle, cradle_con, users_db, db_name;
 
@@ -30,7 +30,7 @@ if(config.couchdb) {
 	
 	setup(function(err, db) {
 		if(err) {
-			console.log('Error: ' + sys.inspect(err));
+			console.log('Error: ' + util.inspect(err));
 			return;
 		}
 		if(db) {