Sending use IPs as realname option
authorDarren <darren@darrenwhitlen.com>
Wed, 17 Oct 2012 22:51:12 +0000 (23:51 +0100)
committerDarren <darren@darrenwhitlen.com>
Wed, 17 Oct 2012 22:51:12 +0000 (23:51 +0100)
server/app.js
server/config.json

index 1f06fc15c38505d36c84cf27e7d29eef4314348f..f3b15488e0673b6fbd279676ef173041c257edee 100644 (file)
@@ -787,19 +787,32 @@ this.IRCConnection = function (websocket, nick, host, port, ssl, password, callb
     events.EventEmitter.call(this);
 
     onConnectHandler = function () {
+        var realname = nick;
+
         that.IRC.nick = nick;
         // Send the login data
         dns.reverse(websocket.kiwi.address, function (err, domains) {
             websocket.kiwi.hostname = (err) ? websocket.kiwi.address : _.first(domains);
+
+            // Check if we need to pass the users IP as its realname
+            if (kiwi.config.ip_as_realname && kiwi.config.ip_as_realname.indexOf(host) > -1) {
+                realname = websocket.kiwi.address;
+            }
+
+            // Do we have a WEBIRC password for this?
             if ((kiwi.config.webirc) && (kiwi.config.webirc_pass[host])) {
                 websocket.sendServerLine('WEBIRC ' + kiwi.config.webirc_pass[host] + ' KiwiIRC ' + websocket.kiwi.hostname + ' ' + websocket.kiwi.address);
             }
+
+            // If the user specified a password
             if (password) {
                 websocket.sendServerLine('PASS ' + password);
             }
+
             websocket.sendServerLine('CAP LS');
             websocket.sendServerLine('NICK ' + nick);
-            websocket.sendServerLine('USER kiwi_' + nick.replace(/[^0-9a-zA-Z\-_.]/, '') + ' 0 0 :' + nick);
+            console.log('SENDING ', 'USER kiwi_' + nick.replace(/[^0-9a-zA-Z\-_.]/, '') + ' 0 0 :' + realname);
+            websocket.sendServerLine('USER kiwi_' + nick.replace(/[^0-9a-zA-Z\-_.]/, '') + ' 0 0 :' + realname);
 
             that.connected = true;
             that.emit('connect');
index 39da2011e09c0dc095823718276d43655b6b8211..6477b1e0a606753bc8a7381dfb716ea7264a80f6 100755 (executable)
@@ -37,6 +37,7 @@
                             "irc.example.com":  "examplepassword",
                             "127.0.0.1":        "foobar"
                         },
+    "ip_as_realname": [],
 
     "transports":       [
                             "websocket",