From 32800bf59913aad7ce91d0effe9b00014b883720 Mon Sep 17 00:00:00 2001 From: Darren Date: Sun, 9 Jun 2013 18:16:21 +0100 Subject: [PATCH] Padding out ip_as_username hex values --- server/irc/connection.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/irc/connection.js b/server/irc/connection.js index cf15570..ae0100e 100644 --- a/server/irc/connection.js +++ b/server/irc/connection.js @@ -392,7 +392,13 @@ function findWebIrc(connect_data) { if (ip_as_username && ip_as_username.indexOf(this.irc_host.hostname) > -1) { // Get a hex value of the clients IP this.username = this.user.address.split('.').map(function(i, idx){ - return parseInt(i, 10).toString(16); + var hex = parseInt(i, 10).toString(16); + + // Pad out the hex value if it's a single char + if (hex.length === 1) + hex = '0' + hex; + + return hex; }).join(''); } -- 2.25.1