Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default /quit message #1448

Merged
merged 1 commit into from Aug 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.github.io"
//
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(Helper.config.leaveMessage);
}

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