3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +01:00

antispam: add a workaround for clientbot support (#359)

This commit is contained in:
James Lu 2018-04-14 11:39:24 -07:00
parent 47052a3bba
commit 281ac7aa31

View File

@ -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)