diff options
author | John McLear <john@mclear.co.uk> | 2014-11-04 23:25:18 +0000 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2014-11-04 23:25:18 +0000 |
commit | 9fa77cdea251b5e32a351298bbe97a88abec3e56 (patch) | |
tree | 5fc0bc27b36535f4a10ae29da50f6ab1378f46ea /src/node/handler/PadMessageHandler.js | |
parent | f418dfa2053c4b40bd46d586b960a2de8167388c (diff) | |
download | etherpad-lite-9fa77cdea251b5e32a351298bbe97a88abec3e56.zip |
working handling of setting client ip and anonymizing etc
Diffstat (limited to 'src/node/handler/PadMessageHandler.js')
-rw-r--r-- | src/node/handler/PadMessageHandler.js | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 3c39c4d8..b4e6243f 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -37,6 +37,7 @@ var _ = require('underscore'); var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks.js"); var channels = require("channels"); var stats = require('../stats'); +var remoteAddress = require("../utils/RemoteAddress").remoteAddress; /** * A associative array that saves informations about a session @@ -115,16 +116,18 @@ exports.handleDisconnect = function(client) //if this connection was already etablished with a handshake, send a disconnect message to the others if(session && session.author) { - /* - client.get('remoteAddress', function(er, ip) { - //Anonymize the IP address if IP logging is disabled - if(settings.disableIPlogging) { - ip = 'ANONYMOUS'; - } - accessLogger.info('[LEAVE] Pad "'+session.padId+'": Author "'+session.author+'" on client '+client.id+' with IP "'+ip+'" left the pad') - }) - */ +console.log(remoteAddress); + + // Get the IP address from our persistant object + var ip = remoteAddress[client.id]; + + // Anonymize the IP address if IP logging is disabled + if(settings.disableIPlogging) { + ip = 'ANONYMOUS'; + } + + accessLogger.info('[LEAVE] Pad "'+session.padId+'": Author "'+session.author+'" on client '+client.id+' with IP "'+ip+'" left the pad') //get the author color out of the db authorManager.getAuthorColorId(session.author, function(err, color) |