Skip to content
This repository
Browse code

Merge pull request #194 from SpenserJ/fix_topic_command_handler

Fixed /topic handler
  • Loading branch information...
commit b6ce807f2fa3870051a475ba04279e431a85b3e0 2 parents 38923d8 + cd7ea22
David Petersen authored December 28, 2012

Showing 1 changed file with 5 additions and 4 deletions. Show diff stats Hide diff stats

  1. 9  assets/js/client.js
9  assets/js/client.js
@@ -425,11 +425,12 @@ $(function() {
425 425
   });
426 426
 
427 427
   irc.commands.add('topic', function(args){
428  
-    if (args[1]) {
429  
-      irc.socket.emit('topic', {name: args[0], topic: args[1]});
430  
-    } else {
  428
+    // If args[0] starts with # or &, a topic name has been provided
  429
+    if (args[0].indexOf('#') === 0 || args[0].indexOf('&') === 0) {
  430
+      irc.socket.emit('topic', {name: args.shift(), topic: args.join(' ')});
  431
+    } else { // Otherwise, assume we're changing the current channel's topic
431 432
       irc.socket.emit('topic', {name: irc.chatWindows.getActive().get('name'),
432  
-        topic: args[0]});
  433
+        topic: args.join(' ')});
433 434
     }
434 435
   });
435 436
 

0 notes on commit b6ce807

Please sign in to comment.
Something went wrong with that request. Please try again.