From 5b9ec4f716c2e25184450b91b6c33337de634b24 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Mon, 13 Sep 2021 19:07:34 +0200 Subject: [PATCH] LogToIrc: Prevent loop when sending to non-existing channels When the target is a channel it is not in, it would treat it as a user; which, if userCapabilityRequired is empty, would unconditionally send it to a channel. This would usually result in an error, that would be logged, hence the loop. --- plugins/LogToIrc/handler.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/LogToIrc/handler.py b/plugins/LogToIrc/handler.py index d4edb644f..3cc780225 100644 --- a/plugins/LogToIrc/handler.py +++ b/plugins/LogToIrc/handler.py @@ -79,13 +79,16 @@ class IrcHandler(logging.Handler): if level > record.levelno: msgOk = False - if target in irc.state.channels: - channel = irc.state.channels[target] - modes = config.channelModesRequired.getSpecific( - network=network)() - for modeChar in modes: - if modeChar not in channel.modes: - msgOk = False + if irc.isChannel(target): + if target in irc.state.channels: + channel = irc.state.channels[target] + modes = config.channelModesRequired.getSpecific( + network=network)() + for modeChar in modes: + if modeChar not in channel.modes: + msgOk = False + else: + msgOk = False else: capability = config.userCapabilityRequired.getSpecific() if capability: