Skip to content

Commit

Permalink
Set default quit default message
Browse files Browse the repository at this point in the history
  • Loading branch information
xPaw committed Aug 23, 2017
1 parent 9811f2b commit 602bbd9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
8 changes: 8 additions & 0 deletions defaults/config.js
Expand Up @@ -316,6 +316,14 @@ module.exports = {
ca: ""
},

//
// Default quit and part message if none is provided.
//
// @type string
// @default "The Lounge - https://thelounge.chat"
//
leaveMessage: "The Lounge - https://thelounge.github.io",

//
// Run The Lounge with identd support.
//
Expand Down
2 changes: 1 addition & 1 deletion src/client.js
Expand Up @@ -501,7 +501,7 @@ Client.prototype.quit = function() {
}
this.networks.forEach((network) => {
if (network.irc) {
network.irc.quit("Page closed");
network.irc.quit(`Page closed - ${pkg.homepage}`);
}

network.destroy();
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/inputs/disconnect.js
@@ -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);
};
4 changes: 3 additions & 1 deletion src/plugins/inputs/part.js
Expand Up @@ -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;
Expand All @@ -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);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/plugins/inputs/quit.js
@@ -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();
Expand All @@ -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;
Expand Down

0 comments on commit 602bbd9

Please sign in to comment.