From 281ac7aa31a648b5c7e7d7552ba3752bfe17a482 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 14 Apr 2018 11:39:24 -0700 Subject: [PATCH] antispam: add a workaround for clientbot support (#359) --- plugins/antispam.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/antispam.py b/plugins/antispam.py index 026065d..331c33a 100644 --- a/plugins/antispam.py +++ b/plugins/antispam.py @@ -38,6 +38,9 @@ def _punish(irc, target, channel, reason): return False my_uid = sbot.uids.get(irc.name) + # XXX workaround for single-bot protocols like Clientbot + if irc.pseudoclient and not irc.has_cap('can-spawn-clients'): + my_uid = irc.pseudoclient.uid punishment = irc.get_service_option('antispam', 'punishment', 'kick+ban').lower() @@ -101,6 +104,10 @@ def handle_masshighlight(irc, source, command, args): MASSHIGHLIGHT_DEFAULTS) my_uid = sbot.uids.get(irc.name) + # XXX workaround for single-bot protocols like Clientbot + if irc.pseudoclient and not irc.has_cap('can-spawn-clients'): + my_uid = irc.pseudoclient.uid + if (not irc.connected.is_set()) or (not my_uid): # Break if the network isn't ready. log.debug("(%s) antispam: skipping processing; network isn't ready", irc.name)