2018-07-10 07:49:23 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const $ = require("jquery");
|
|
|
|
|
|
|
|
exports.input = function(args) {
|
|
|
|
const utils = require("../utils");
|
|
|
|
const socket = require("../socket");
|
|
|
|
const {vueApp} = require("../vue");
|
|
|
|
|
2018-09-25 16:52:22 +00:00
|
|
|
if (args.length > 0) {
|
|
|
|
const channel = args[0];
|
2018-07-10 07:49:23 +00:00
|
|
|
|
2018-09-25 16:52:22 +00:00
|
|
|
if (channel.length > 0) {
|
|
|
|
const chan = utils.findCurrentNetworkChan(channel);
|
|
|
|
|
|
|
|
if (chan) {
|
|
|
|
$(`#sidebar .chan[data-id="${chan.id}"]`).trigger("click");
|
|
|
|
}
|
2018-07-10 07:49:23 +00:00
|
|
|
}
|
|
|
|
} else if (vueApp.activeChannel.channel.type === "channel") {
|
2018-09-25 16:52:22 +00:00
|
|
|
// If `/join` command is used without any arguments, re-join current channel
|
2018-07-10 07:49:23 +00:00
|
|
|
socket.emit("input", {
|
|
|
|
target: vueApp.activeChannel.channel.id,
|
|
|
|
text: `/join ${vueApp.activeChannel.channel.name}`,
|
|
|
|
});
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|