thelounge/src/plugins/inputs/connect.js

42 lines
643 B
JavaScript
Raw Normal View History

"use strict";
var Msg = require("../../models/msg");
exports.commands = ["connect", "server"];
exports.allowDisconnected = true;
2016-03-06 10:24:56 +01:00
exports.input = function({irc}, chan, cmd, args) {
if (args.length === 0) {
if (!irc || !irc.connection) {
return;
}
if (irc.connection.connected) {
chan.pushMessage(this, new Msg({
type: Msg.Type.ERROR,
text: "You are already connected.",
}));
return;
}
irc.connection.connect();
return;
2014-09-13 23:29:45 +02:00
}
2016-03-06 10:24:56 +01:00
var port = args[1] || "";
var tls = port[0] === "+";
if (tls) {
port = port.substring(1);
}
this.connect({
host: args[0],
port: port,
tls: tls,
});
2016-03-06 10:24:56 +01:00
return true;
2014-09-13 23:29:45 +02:00
};