From a0010ca9f601f7ce9503f972a778f7da16f5fe69 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 16 May 2016 17:22:03 +0300 Subject: [PATCH] Allow /connect command to work on current network --- src/plugins/inputs/connect.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/plugins/inputs/connect.js b/src/plugins/inputs/connect.js index 538cd4a2..04296247 100644 --- a/src/plugins/inputs/connect.js +++ b/src/plugins/inputs/connect.js @@ -1,8 +1,24 @@ +var Msg = require("../../models/msg"); + exports.commands = ["connect", "server"]; exports.allowDisconnected = true; exports.input = function(network, chan, cmd, args) { if (args.length === 0) { + if (!network.irc || !network.irc.connection) { + return; + } + + if (network.irc.connection.connected) { + chan.pushMessage(this, new Msg({ + type: Msg.Type.ERROR, + text: "You are already connected." + })); + return; + } + + network.irc.connection.connect(); + return; }