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

View File

@ -218,6 +218,7 @@ module.exports = {
// numbers from 0 to 9. For example, `Guest%%%` may become `Guest123`. // numbers from 0 to 9. For example, `Guest%%%` may become `Guest123`.
// - `username`: User name. // - `username`: User name.
// - `realname`: Real name. // - `realname`: Real name.
// - `leaveMessage`: Network specific leave message (overrides global leaveMessage)
// - `join`: Comma-separated list of channels to auto-join once connected. // - `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 // This value is set to connect to the official channel of The Lounge on
@ -248,6 +249,7 @@ module.exports = {
username: "thelounge", username: "thelounge",
realname: "The Lounge User", realname: "The Lounge User",
join: "#thelounge", join: "#thelounge",
leaveMessage: "",
}, },
// ### `lockNetwork` // ### `lockNetwork`

View File

@ -241,6 +241,7 @@ Client.prototype.connect = function (args, isStartup = false) {
nick: String(args.nick || ""), nick: String(args.nick || ""),
username: String(args.username || ""), username: String(args.username || ""),
realname: String(args.realname || ""), realname: String(args.realname || ""),
leaveMessage: String(args.leaveMessage || ""),
sasl: String(args.sasl || ""), sasl: String(args.sasl || ""),
saslAccount: String(args.saslAccount || ""), saslAccount: String(args.saslAccount || ""),
saslPassword: String(args.saslPassword || ""), saslPassword: String(args.saslPassword || ""),

View File

@ -35,6 +35,7 @@ function Network(attr) {
commands: [], commands: [],
username: "", username: "",
realname: "", realname: "",
leaveMessage: "",
sasl: "", sasl: "",
saslAccount: "", saslAccount: "",
saslPassword: "", saslPassword: "",
@ -82,6 +83,7 @@ Network.prototype.validate = function (client) {
this.username = cleanString(this.username) || "thelounge"; this.username = cleanString(this.username) || "thelounge";
this.realname = cleanString(this.realname) || "The Lounge User"; this.realname = cleanString(this.realname) || "The Lounge User";
this.leaveMessage = cleanString(this.leaveMessage);
this.password = cleanString(this.password); this.password = cleanString(this.password);
this.host = cleanString(this.host).toLowerCase(); this.host = cleanString(this.host).toLowerCase();
this.name = cleanString(this.name); this.name = cleanString(this.name);
@ -267,6 +269,7 @@ Network.prototype.edit = function (client, args) {
this.password = String(args.password || ""); this.password = String(args.password || "");
this.username = String(args.username || ""); this.username = String(args.username || "");
this.realname = String(args.realname || ""); this.realname = String(args.realname || "");
this.leaveMessage = String(args.leaveMessage || "");
this.sasl = String(args.sasl || ""); this.sasl = String(args.sasl || "");
this.saslAccount = String(args.saslAccount || ""); this.saslAccount = String(args.saslAccount || "");
this.saslPassword = String(args.saslPassword || ""); this.saslPassword = String(args.saslPassword || "");
@ -447,6 +450,7 @@ Network.prototype.exportForEdit = function () {
"password", "password",
"username", "username",
"realname", "realname",
"leaveMessage",
"sasl", "sasl",
"saslAccount", "saslAccount",
"saslPassword", "saslPassword",
@ -481,6 +485,7 @@ Network.prototype.export = function () {
"password", "password",
"username", "username",
"realname", "realname",
"leaveMessage",
"sasl", "sasl",
"saslAccount", "saslAccount",
"saslPassword", "saslPassword",

View File

@ -48,7 +48,7 @@ exports.input = function (network, chan, cmd, args) {
}); });
this.save(); this.save();
} else { } else {
const partMessage = args.join(" ") || Helper.config.leaveMessage; const partMessage = args.join(" ") || network.leaveMessage || Helper.config.leaveMessage;
network.irc.part(target.name, partMessage); network.irc.part(target.name, partMessage);
} }

View File

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