Prefix channel before join
This commit is contained in:
parent
8c19613bce
commit
493f9b1b6c
@ -68,8 +68,15 @@ export default {
|
|||||||
const $ = require("jquery");
|
const $ = require("jquery");
|
||||||
$(`#sidebar .chan[data-id="${existingChannel.id}"]`).trigger("click");
|
$(`#sidebar .chan[data-id="${existingChannel.id}"]`).trigger("click");
|
||||||
} else {
|
} else {
|
||||||
|
const chanTypes = this.network.serverOptions.CHANTYPES;
|
||||||
|
let channel = this.inputChannel;
|
||||||
|
|
||||||
|
if (chanTypes && chanTypes.length > 0 && !chanTypes.includes(channel[0])) {
|
||||||
|
channel = chanTypes[0] + channel;
|
||||||
|
}
|
||||||
|
|
||||||
socket.emit("input", {
|
socket.emit("input", {
|
||||||
text: `/join ${this.inputChannel} ${this.inputPassword}`,
|
text: `/join ${channel} ${this.inputPassword}`,
|
||||||
target: this.channel.id,
|
target: this.channel.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,33 @@ exports.input = function(args) {
|
|||||||
const {vueApp} = require("../vue");
|
const {vueApp} = require("../vue");
|
||||||
|
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
const channel = args[0];
|
let channels = args[0];
|
||||||
|
|
||||||
if (channel.length > 0) {
|
if (channels.length > 0) {
|
||||||
const chan = utils.findCurrentNetworkChan(channel);
|
const chanTypes = vueApp.activeChannel.network.serverOptions.CHANTYPES;
|
||||||
|
const channelList = args[0].split(",");
|
||||||
|
|
||||||
|
if (chanTypes && chanTypes.length > 0) {
|
||||||
|
for (let c = 0; c < channelList.length; c++) {
|
||||||
|
if (!chanTypes.includes(channelList[c][0])) {
|
||||||
|
channelList[c] = chanTypes[0] + channelList[c];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
channels = channelList.join(",");
|
||||||
|
|
||||||
|
const chan = utils.findCurrentNetworkChan(channels);
|
||||||
|
|
||||||
if (chan) {
|
if (chan) {
|
||||||
$(`#sidebar .chan[data-id="${chan.id}"]`).trigger("click");
|
$(`#sidebar .chan[data-id="${chan.id}"]`).trigger("click");
|
||||||
|
} else {
|
||||||
|
socket.emit("input", {
|
||||||
|
text: `/join ${channels} ${args.length > 1 ? args[1] : ""}`,
|
||||||
|
target: vueApp.activeChannel.channel.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (vueApp.activeChannel.channel.type === "channel") {
|
} else if (vueApp.activeChannel.channel.type === "channel") {
|
||||||
|
Loading…
Reference in New Issue
Block a user