From 25ec88c5668bc063f90b259c8cb3388c8a66d128 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 7 Oct 2017 21:51:38 -0700 Subject: [PATCH] clientbot: don't send empty MODE hooks when enumerating empty ban lists --- protocols/clientbot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/protocols/clientbot.py b/protocols/clientbot.py index 7e3cf92..43063e0 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -1088,8 +1088,10 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): channel = args[1] # Send out the hook. We don't worry about repeats since these modes don't need to be # enumerated more than once per JOIN anyways. - return {'target': channel, 'parse_as': 'MODE', - 'modes': [('+%s' % banmode, m[1]) for m in self.channels[channel].modes if m[0] == banmode]} + modes = [('+%s' % banmode, m[1]) for m in self.channels[channel].modes if m[0] == banmode] + if modes: + return {'target': channel, 'parse_as': 'MODE', + 'modes': modes} def handle_346(self, *args): """