Optional param[0] in PART message
authorDarren <darren@darrenwhitlen.com>
Fri, 28 Feb 2014 22:48:59 +0000 (22:48 +0000)
committerDarren <darren@darrenwhitlen.com>
Fri, 28 Feb 2014 22:48:59 +0000 (22:48 +0000)
server/irc/commands.js

index a23b8065ed6b8e13d57e98d0a132e95d582d11dd..5e02c75b71bc5a5729c7fe5a19f5c6b8a0d2ddc5 100644 (file)
@@ -455,17 +455,25 @@ handlers = {
     },
 
     'PART': function (command) {
-        var time;
+        var time, channel, message;
 
         // Check if we have a server-time
         time = getServerTime.call(this, command);
 
+        // Some IRCds (Note: Nefarious) send the channel as the trailing param
+        if (!command.params[0]) {
+            channel = command.trailing;
+        } else {
+            channel = command.params[0];
+            message = command.trailing;
+        }
+
         this.irc_connection.emit('channel ' + command.params[0] + ' part', {
             nick: command.nick,
             ident: command.ident,
             hostname: command.hostname,
-            channel: command.params[0],
-            message: command.trailing,
+            channel: channel,
+            message: message,
             time: time
         });
     },