Add network specific leave message

This commit is contained in:
Nachtalb 2020-11-26 00:37:46 +01:00
parent aa84e13656
commit 877e4acf7d
No known key found for this signature in database
GPG key ID: E48DF13C07055D92
6 changed files with 20 additions and 1 deletions

View file

@ -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="Smell ya later"
/>
</div>
<template v-if="defaults.uuid && !$store.state.serverConfiguration.public">
<div class="connect-row">
<label for="connect:commands">

View file

@ -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`

View file

@ -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 || ""),

View file

@ -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 || "");
@ -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",

View file

@ -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);
}

View file

@ -40,6 +40,7 @@ describe("Network", function () {
password: "",
username: "",
realname: "",
leaveMessage: "",
sasl: "plain",
saslAccount: "testaccount",
saslPassword: "testpassword",