Permalink
Browse files

Fixed /topic handler

Problem:
/topic This is a test # Would change the topic of channel "This"
    to "is", and ignore the rest
/topic #Channel This is a test # Would change the topic of channel
    "#Channel" to "This" and ignore the rest
Resolution:
If args[0] starts with # or &, a channel has been provided. Set the
    channel's name to args.shift(), and the topic to args.join(' ')
If args[0] does not start with # or &, set the active channel's
    topic to args.join(' ')
  • Loading branch information...
1 parent 5bfefdc commit 51eaec4be1200bc726a90bc706e771cf6bb70bd0 @SpenserJ SpenserJ committed Dec 23, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 assets/js/client.js
View
@@ -425,11 +425,11 @@ $(function() {
});
irc.commands.add('topic', function(args){
- if (args[1]) {
- irc.socket.emit('topic', {name: args[0], topic: args[1]});
+ if (args[0].indexOf('#') == 0 || args[0].indexOf('&') == 0) {
+ irc.socket.emit('topic', {name: args.shift(), topic: args.join(' ')});
} else {
irc.socket.emit('topic', {name: irc.chatWindows.getActive().get('name'),
- topic: args[0]});
+ topic: args.join(' ')});
}
});

0 comments on commit 51eaec4

Please sign in to comment.