From c062787436cb9eddfbf5078141462d3b884ff135 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 4 Nov 2020 11:32:09 +0100 Subject: [PATCH] irclib: use a dedicated tag to detect emulated echo-messages, instead of receivedAt. Plugins implementing inFilter do not set receivedAt, so incoming messages rewritten by inFilter would be detected as echo messages, and ignored by most plugins. --- src/irclib.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/irclib.py b/src/irclib.py index c7d497e4e..424d13da9 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -186,11 +186,11 @@ class IrcCallback(IrcCommandDispatcher, log.Firewalled): if not self.echoMessage and not self.echo_message \ and msg.command in ('PRIVMSG', 'NOTICE', 'TAGMSG') \ and ('label' in msg.server_tags - or not msg.tagged('receivedAt')): + or msg.tagged('emulatedEcho')): # This is an echo of a message we sent; and the plugin didn't # opt-in to receiving echos; ignoring it. # `'label' in msg.server_tags` detects echos when labeled-response - # is enabled; and `not msg.tag('receivedAt')` detects simulated + # is enabled; and `msg.tag('emulatedEcho')` detects simulated # echos. As we don't enable real echo-message unless # labeled-response is enabled; this is an exhaustive check of echos # in all cases. @@ -1305,6 +1305,8 @@ class Irc(IrcCommandDispatcher, log.Firewalled): # echo-message is not implemented by server; let's emulate it # here, just before sending it to the driver. assert not msg.tagged('receivedAt') + assert not msg.tagged('emulatedEcho') + msg.tag('emulatedEcho', True) self.feedMsg(msg, tag=False) else: # I don't think we should do this. Why should it matter? If it's