Only require socks.js if running node 0.10 or above
authorJack Allnutt <m2ys4u@gmail.com>
Wed, 3 Apr 2013 19:04:21 +0000 (20:04 +0100)
committerJack Allnutt <m2ys4u@gmail.com>
Wed, 3 Apr 2013 19:04:21 +0000 (20:04 +0100)
server/irc/connection.js

index 45605535d7651b7a1d72d8fc24e1bfeef2000fd0..528c9a967ce9e8aa766d6840a6004743e8cce684 100644 (file)
@@ -7,8 +7,18 @@ var net             = require('net'),
     IrcServer       = require('./server.js'),
     IrcChannel      = require('./channel.js'),
     IrcUser         = require('./user.js'),
-    Socks           = require('../socks.js');
-
+    Socks;
+// Break the Node.js version down into usable parts
+var version_values = process.version.substr(1).split('.').map(function (item) {
+    return parseInt(item, 10);
+});
+// If we have a suitable Nodejs version, bring int he socks functionality
+if (version_values[0] >= 10) {
+    Socks = require('../socks.js');
+}
 
 var IrcConnection = function (hostname, port, ssl, nick, user, pass, state) {
     var that = this;