Merge pull request #4116 from Nachtalb/na/network-specific-leave-message
This commit is contained in:
commit
f99e4eef77
@ -167,6 +167,16 @@
|
||||
maxlength="300"
|
||||
/>
|
||||
</div>
|
||||
<div class="connect-row">
|
||||
<label for="connect:leaveMessage">Away message</label>
|
||||
<input
|
||||
id="connect:leaveMessage"
|
||||
v-model="defaults.leaveMessage"
|
||||
class="input"
|
||||
name="leaveMessage"
|
||||
placeholder="The Lounge - https://thelounge.chat"
|
||||
/>
|
||||
</div>
|
||||
<template v-if="defaults.uuid && !$store.state.serverConfiguration.public">
|
||||
<div class="connect-row">
|
||||
<label for="connect:commands">
|
||||
|
@ -218,6 +218,7 @@ module.exports = {
|
||||
// numbers from 0 to 9. For example, `Guest%%%` may become `Guest123`.
|
||||
// - `username`: User name.
|
||||
// - `realname`: Real name.
|
||||
// - `leaveMessage`: Network specific leave message (overrides global leaveMessage)
|
||||
// - `join`: Comma-separated list of channels to auto-join once connected.
|
||||
//
|
||||
// This value is set to connect to the official channel of The Lounge on
|
||||
@ -248,6 +249,7 @@ module.exports = {
|
||||
username: "thelounge",
|
||||
realname: "The Lounge User",
|
||||
join: "#thelounge",
|
||||
leaveMessage: "",
|
||||
},
|
||||
|
||||
// ### `lockNetwork`
|
||||
|
@ -241,6 +241,7 @@ Client.prototype.connect = function (args, isStartup = false) {
|
||||
nick: String(args.nick || ""),
|
||||
username: String(args.username || ""),
|
||||
realname: String(args.realname || ""),
|
||||
leaveMessage: String(args.leaveMessage || ""),
|
||||
sasl: String(args.sasl || ""),
|
||||
saslAccount: String(args.saslAccount || ""),
|
||||
saslPassword: String(args.saslPassword || ""),
|
||||
@ -649,7 +650,7 @@ Client.prototype.quit = function (signOut) {
|
||||
}
|
||||
|
||||
this.networks.forEach((network) => {
|
||||
network.quit(Helper.config.leaveMessage);
|
||||
network.quit();
|
||||
network.destroy();
|
||||
});
|
||||
|
||||
|
@ -35,6 +35,7 @@ function Network(attr) {
|
||||
commands: [],
|
||||
username: "",
|
||||
realname: "",
|
||||
leaveMessage: "",
|
||||
sasl: "",
|
||||
saslAccount: "",
|
||||
saslPassword: "",
|
||||
@ -82,6 +83,7 @@ Network.prototype.validate = function (client) {
|
||||
|
||||
this.username = cleanString(this.username) || "thelounge";
|
||||
this.realname = cleanString(this.realname) || "The Lounge User";
|
||||
this.leaveMessage = cleanString(this.leaveMessage);
|
||||
this.password = cleanString(this.password);
|
||||
this.host = cleanString(this.host).toLowerCase();
|
||||
this.name = cleanString(this.name);
|
||||
@ -267,6 +269,7 @@ Network.prototype.edit = function (client, args) {
|
||||
this.password = String(args.password || "");
|
||||
this.username = String(args.username || "");
|
||||
this.realname = String(args.realname || "");
|
||||
this.leaveMessage = String(args.leaveMessage || "");
|
||||
this.sasl = String(args.sasl || "");
|
||||
this.saslAccount = String(args.saslAccount || "");
|
||||
this.saslPassword = String(args.saslPassword || "");
|
||||
@ -436,7 +439,7 @@ Network.prototype.quit = function (quitMessage) {
|
||||
// https://ircv3.net/specs/extensions/sts#rescheduling-expiry-on-disconnect
|
||||
STSPolicies.refreshExpiration(this.host);
|
||||
|
||||
this.irc.quit(quitMessage || Helper.config.leaveMessage);
|
||||
this.irc.quit(quitMessage || this.leaveMessage || Helper.config.leaveMessage);
|
||||
};
|
||||
|
||||
Network.prototype.exportForEdit = function () {
|
||||
@ -447,6 +450,7 @@ Network.prototype.exportForEdit = function () {
|
||||
"password",
|
||||
"username",
|
||||
"realname",
|
||||
"leaveMessage",
|
||||
"sasl",
|
||||
"saslAccount",
|
||||
"saslPassword",
|
||||
@ -481,6 +485,7 @@ Network.prototype.export = function () {
|
||||
"password",
|
||||
"username",
|
||||
"realname",
|
||||
"leaveMessage",
|
||||
"sasl",
|
||||
"saslAccount",
|
||||
"saslPassword",
|
||||
|
@ -48,7 +48,7 @@ exports.input = function (network, chan, cmd, args) {
|
||||
});
|
||||
this.save();
|
||||
} else {
|
||||
const partMessage = args.join(" ") || Helper.config.leaveMessage;
|
||||
const partMessage = args.join(" ") || network.leaveMessage || Helper.config.leaveMessage;
|
||||
network.irc.part(target.name, partMessage);
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@ describe("Network", function () {
|
||||
password: "",
|
||||
username: "",
|
||||
realname: "",
|
||||
leaveMessage: "",
|
||||
sasl: "plain",
|
||||
saslAccount: "testaccount",
|
||||
saslPassword: "testpassword",
|
||||
|
Loading…
Reference in New Issue
Block a user