Merge pull request #1448 from thelounge/xpaw/quit-promo

Set default quit default message
This commit is contained in:
Pavel Djundik 2017-08-26 20:34:32 +03:00 committed by GitHub
commit 495d8c3e04
5 changed files with 19 additions and 7 deletions

View File

@ -316,6 +316,14 @@ module.exports = {
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.
//

View File

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

View File

@ -1,9 +1,11 @@
"use strict";
const Helper = require("../../helper");
exports.commands = ["disconnect"];
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);
};

View File

@ -3,6 +3,7 @@
var _ = require("lodash");
var Msg = require("../../models/msg");
var Chan = require("../../models/chan");
const Helper = require("../../helper");
exports.commands = ["close", "leave", "part"];
exports.allowDisconnected = true;
@ -26,7 +27,8 @@ exports.input = function(network, chan, cmd, args) {
this.save();
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";
var _ = require("lodash");
const Helper = require("../../helper");
exports.commands = ["quit"];
exports.allowDisconnected = true;
exports.input = function(network, chan, cmd, args) {
var client = this;
var irc = network.irc;
var quitMessage = args[0] ? args.join(" ") : "";
client.networks = _.without(client.networks, network);
network.destroy();
@ -17,8 +16,9 @@ exports.input = function(network, chan, cmd, args) {
network: network.id
});
if (irc) {
irc.quit(quitMessage);
if (network.irc) {
const quitMessage = args[0] ? args.join(" ") : Helper.config.leaveMessage;
network.irc.quit(quitMessage);
}
return true;