/list response now shows in a new tab
[KiwiIRC.git] / node / app.js
index 72355c50960355b31c83dbbbd3d93aa3f42c97a4..6025dd41a62a7bfd6f632d8f27142b224e87ddff 100644 (file)
@@ -1,4 +1,4 @@
-/*jslint continue: true, forin: true, regexp: true, undef: false, node: true, nomen: true, plusplus: true, maxerr: 50, indent: 4 */
+/*jslint sloppy: true, continue: true, forin: true, regexp: true, undef: false, node: true, nomen: true, plusplus: true, maxerr: 50, indent: 4 */
 /*globals kiwi_root */
 var tls = null;
 var net = null;
@@ -82,6 +82,9 @@ var ircNumerics = {
     RPL_WHOISIDLE:          '317',
     RPL_ENDOFWHOIS:         '318',
     RPL_WHOISCHANNELS:      '319',
+    RPL_LISTSTART:          '321',
+    RPL_LIST:               '322',
+    RPL_LISTEND:            '323',
     RPL_NOTOPIC:            '331',
     RPL_TOPIC:              '332',
     RPL_NAMEREPLY:          '353',
@@ -174,6 +177,38 @@ this.parseIRCMessage = function (websocket, ircSocket, data) {
         case ircNumerics.RPL_WHOISMODES:
             websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing});
             break;
+
+        case ircNumerics.RPL_LISTSTART:
+            (function () {
+                websocket.sendClientEvent('list_start', {server: ''});
+            }());
+            break;
+        case ircNumerics.RPL_LISTEND:
+            (function () {
+                websocket.sendClientEvent('list_end', {server: ''});
+            }());
+            break;
+        
+        case ircNumerics.RPL_LIST:
+            (function () {
+                var parts, channel, num_users, modes, topic;
+
+                parts = msg.params.split(' ');
+                channel = parts[1];
+                num_users = parts[2];
+                modes = msg.trailing.split(' ', 1);
+                topic = msg.trailing.substring(msg.trailing.indexOf(' ') + 1);
+
+                websocket.sendClientEvent('list_channel', {
+                    server: '',
+                    channel: channel,
+                    topic: topic,
+                    modes: modes,
+                    num_users: num_users
+                });
+            }());
+            break;
+
         case ircNumerics.RPL_WHOISIDLE:
             params = msg.params.split(" ", 4);
             rtn = {server: '', nick: params[1], idle: params[2]};
@@ -469,11 +504,12 @@ this.httpHandler = function (request, response) {
             if (kiwi.cache.alljs === '') {
                 public_http_path = kiwi.kiwi_root + '/' + kiwi.config.public_http;
 
+                               min.underscore = fs.readFileSync(public_http_path + 'js/underscore.min.js');
                 min.util = fs.readFileSync(public_http_path + 'js/util.js');
                 min.gateway = fs.readFileSync(public_http_path + 'js/gateway.js');
                 min.front = fs.readFileSync(public_http_path + 'js/front.js');
                 min.iscroll = fs.readFileSync(public_http_path + 'js/iscroll.js');
-                min.ast = jsp.parse(min.util + min.gateway + min.front + min.iscroll);
+                min.ast = jsp.parse(min.underscore + min.util + min.gateway + min.front + min.iscroll);
                 min.ast = pro.ast_mangle(min.ast);
                 min.ast = pro.ast_squeeze(min.ast);
                 min.final_code = pro.gen_code(min.ast);