From 2feec7c4afcb640aaf8a1ae0f90e3de07c1306b1 Mon Sep 17 00:00:00 2001 From: Darren Date: Wed, 17 Oct 2012 23:51:12 +0100 Subject: [PATCH] Sending use IPs as realname option --- server/app.js | 15 ++++++++++++++- server/config.json | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 1f06fc1..f3b1548 100644 --- a/server/app.js +++ b/server/app.js @@ -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'); diff --git a/server/config.json b/server/config.json index 39da201..6477b1e 100755 --- a/server/config.json +++ b/server/config.json @@ -37,6 +37,7 @@ "irc.example.com": "examplepassword", "127.0.0.1": "foobar" }, + "ip_as_realname": [], "transports": [ "websocket", -- 2.25.1