Set default quit default message

This commit is contained in:
Pavel Djundik 2017-08-18 22:04:16 +03:00
parent 60e69a83fc
commit 4a3026e11b
5 changed files with 19 additions and 7 deletions

View file

@ -316,6 +316,14 @@ module.exports = {
ca: "" ca: ""
}, },
//
// Default quit and part message if none is provided.
//
// @type string
// @default "The Lounge - https://thelounge.github.io"
//
leaveMessage: "The Lounge - https://thelounge.github.io",
// //
// Run The Lounge with identd support. // Run The Lounge with identd support.
// //

View file

@ -501,7 +501,7 @@ Client.prototype.quit = function() {
} }
this.networks.forEach((network) => { this.networks.forEach((network) => {
if (network.irc) { if (network.irc) {
network.irc.quit("Page closed"); network.irc.quit(Helper.config.leaveMessage);
} }
network.destroy(); network.destroy();

View file

@ -1,9 +1,11 @@
"use strict"; "use strict";
const Helper = require("../../helper");
exports.commands = ["disconnect"]; exports.commands = ["disconnect"];
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {
var quitMessage = args[0] ? args.join(" ") : ""; var quitMessage = args[0] ? args.join(" ") : Helper.config.leaveMessage;
network.irc.quit(quitMessage); network.irc.quit(quitMessage);
}; };

View file

@ -3,6 +3,7 @@
var _ = require("lodash"); var _ = require("lodash");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
var Chan = require("../../models/chan"); var Chan = require("../../models/chan");
const Helper = require("../../helper");
exports.commands = ["close", "leave", "part"]; exports.commands = ["close", "leave", "part"];
exports.allowDisconnected = true; exports.allowDisconnected = true;
@ -26,7 +27,8 @@ exports.input = function(network, chan, cmd, args) {
this.save(); this.save();
if (network.irc) { if (network.irc) {
network.irc.part(chan.name, args.join(" ")); const partMessage = args[0] ? args.join(" ") : Helper.config.leaveMessage;
network.irc.part(chan.name, partMessage);
} }
} }

View file

@ -1,14 +1,13 @@
"use strict"; "use strict";
var _ = require("lodash"); var _ = require("lodash");
const Helper = require("../../helper");
exports.commands = ["quit"]; exports.commands = ["quit"];
exports.allowDisconnected = true; exports.allowDisconnected = true;
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {
var client = this; var client = this;
var irc = network.irc;
var quitMessage = args[0] ? args.join(" ") : "";
client.networks = _.without(client.networks, network); client.networks = _.without(client.networks, network);
network.destroy(); network.destroy();
@ -17,8 +16,9 @@ exports.input = function(network, chan, cmd, args) {
network: network.id network: network.id
}); });
if (irc) { if (network.irc) {
irc.quit(quitMessage); const quitMessage = args[0] ? args.join(" ") : Helper.config.leaveMessage;
network.irc.quit(quitMessage);
} }
return true; return true;