From: Darren Date: Fri, 27 Jun 2014 22:47:14 +0000 (+0100) Subject: /cycle command #444 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=04c7ce91f1d90ebdeb763164652de46ce620e45f;p=KiwiIRC.git /cycle command #444 --- diff --git a/client/src/misc/clientuicommands.js b/client/src/misc/clientuicommands.js index 935a89a..dd2adc8 100644 --- a/client/src/misc/clientuicommands.js +++ b/client/src/misc/clientuicommands.js @@ -65,6 +65,7 @@ 'command:action': actionCommand, 'command:join': joinCommand, 'command:part': partCommand, + 'command:cycle': cycleCommand, 'command:nick': nickCommand, 'command:query': queryCommand, 'command:invite': inviteCommand, @@ -301,6 +302,27 @@ } + function cycleCommand (ev) { + var that = this, + chan_name; + + if (ev.params.length === 0) { + chan_name = this.app.panels().active.get('name'); + } else { + chan_name = ev.params[0]; + } + + this.app.connections.active_connection.gateway.part(chan_name); + + // Wait for a second to give the network time to register the part command + setTimeout(function() { + // Use createAndJoinChannels() here as it auto-creates panels instead of waiting for the network + that.app.connections.active_connection.createAndJoinChannels(chan_name); + that.app.connections.active_connection.panels.getByName(chan_name).show(); + }, 1000); + } + + function nickCommand (ev) { this.app.connections.active_connection.gateway.changeNick(ev.params[0]); }