3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +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 return False
my_uid = sbot.uids.get(irc.name) 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', punishment = irc.get_service_option('antispam', 'punishment',
'kick+ban').lower() 'kick+ban').lower()
@ -101,6 +104,10 @@ def handle_masshighlight(irc, source, command, args):
MASSHIGHLIGHT_DEFAULTS) MASSHIGHLIGHT_DEFAULTS)
my_uid = sbot.uids.get(irc.name) 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): if (not irc.connected.is_set()) or (not my_uid):
# Break if the network isn't ready. # Break if the network isn't ready.
log.debug("(%s) antispam: skipping processing; network isn't ready", irc.name) log.debug("(%s) antispam: skipping processing; network isn't ready", irc.name)