From 39db5aee0411c6ff2784ba5d8cc2865d78c355b5 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 14 Jan 2017 11:05:38 -0800 Subject: [PATCH] ts6_common: properly handle KICK without a reason This field is optional in TS6. --- protocols/ts6_common.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/protocols/ts6_common.py b/protocols/ts6_common.py index 55d065c..996a5a3 100644 --- a/protocols/ts6_common.py +++ b/protocols/ts6_common.py @@ -371,8 +371,14 @@ class TS6BaseProtocol(IRCS2SProtocol): # :70MAAAAAA KICK #test 70MAAAAAA :some reason channel = self.irc.toLower(args[0]) kicked = self._getUid(args[1]) - self.handle_part(kicked, 'KICK', [channel, args[2]]) - return {'channel': channel, 'target': kicked, 'text': args[2]} + + try: + reason = args[2] + except IndexError: + reason = '' + + self.handle_part(kicked, 'KICK', [channel, reason]) + return {'channel': channel, 'target': kicked, 'text': reason} def handle_nick(self, numeric, command, args): """Handles incoming NICK changes."""