projects
/
KiwiIRC.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9a0720d
)
Padding out ip_as_username hex values
author
Darren
<darren@darrenwhitlen.com>
Sun, 9 Jun 2013 17:16:21 +0000
(18:16 +0100)
committer
Darren
<darren@darrenwhitlen.com>
Sun, 9 Jun 2013 17:16:21 +0000
(18:16 +0100)
server/irc/connection.js
patch
|
blob
|
blame
|
history
diff --git
a/server/irc/connection.js
b/server/irc/connection.js
index cf155709436a9f5f55110c7128ee81183f890a73..ae0100e7f4af3d85fec4045335feaf7d6a2c977f 100644
(file)
--- 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('');
}