From 04c7ce91f1d90ebdeb763164652de46ce620e45f Mon Sep 17 00:00:00 2001 From: Darren Date: Fri, 27 Jun 2014 23:47:14 +0100 Subject: [PATCH] /cycle command #444 --- client/src/misc/clientuicommands.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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]); } -- 2.25.1