Auto nick generation
authorDarren <darren@darrenwhitlen.com>
Thu, 13 Oct 2011 22:37:27 +0000 (23:37 +0100)
committerDarren <darren@darrenwhitlen.com>
Thu, 13 Oct 2011 22:37:27 +0000 (23:37 +0100)
server/app.js

index cbaff4da2c8fcebb508974018bb97c011f27ecc1..a0bc999f0065888c2a32727749882a1fa3d3e667 100644 (file)
@@ -645,6 +645,14 @@ this.httpHandler = function (request, response) {
                     nick = uri.query.nick || '';
                 }
 
+                // Set the default nick if one isn't provided
+                if (nick == '') {
+                    nick = 'kiwi_?';
+                }
+
+                // Set any random numbers if needed
+                nick = nick.replace('?', Math.floor(Math.random()*100000).toString());
+
                 response.setHeader('X-Generated-By', 'KiwiIRC');
                 hash = crypto.createHash('md5').update(touchscreen ? 't' : 'f')
                     .update(debug ? 't' : 'f')