Stop handling CTCP messages if the sender/target is ignored

This commit is contained in:
Alexandre Oliveira 2018-07-01 15:48:37 -03:00
parent 4109480b27
commit 671dad4ed6

View File

@ -21,6 +21,14 @@ module.exports = function(irc, network) {
const lobby = network.channels[0]; const lobby = network.channels[0];
irc.on("ctcp response", function(data) { irc.on("ctcp response", function(data) {
const shouldIgnore = network.ignoreList.some(function(entry) {
return Helper.compareHostmask(entry, data);
});
if (shouldIgnore) {
return;
}
let chan = network.getChannel(data.nick); let chan = network.getChannel(data.nick);
if (typeof chan === "undefined") { if (typeof chan === "undefined") {
@ -38,6 +46,14 @@ module.exports = function(irc, network) {
// Limit requests to a rate of one per second max // Limit requests to a rate of one per second max
irc.on("ctcp request", _.throttle((data) => { irc.on("ctcp request", _.throttle((data) => {
const shouldIgnore = network.ignoreList.some(function(entry) {
return Helper.compareHostmask(entry, data);
});
if (shouldIgnore) {
return;
}
const response = ctcpResponses[data.type]; const response = ctcpResponses[data.type];
if (response) { if (response) {