From d3e9420b02a7eabefd1fa6a4f260a18807bb5173 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 21 Jul 2013 11:53:12 +0000 Subject: [PATCH] GitHub: Fix Python 2 support again. --- AttackProtector/config.py | 1 + AttackProtector/plugin.py | 5 ++++- GitHub/plugin.py | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/AttackProtector/config.py b/AttackProtector/config.py index 43ef336..c31261d 100644 --- a/AttackProtector/config.py +++ b/AttackProtector/config.py @@ -67,6 +67,7 @@ class Punishment(registry.String): if s not in ('ban', 'kick', 'kban') and not s.startswith('mode+') and \ not s.startswith('mode-') and not s.startswith('umode-') and \ not s.startswith('umode+') and \ + not s.startswith('mmode-') and not s.startswith('mmode-') and \ not s.startswith('command ') and \ not s.startswith('kban+') and not s.startswith('ban+') : self.error() diff --git a/AttackProtector/plugin.py b/AttackProtector/plugin.py index 01a85ed..e435e15 100644 --- a/AttackProtector/plugin.py +++ b/AttackProtector/plugin.py @@ -235,7 +235,10 @@ class AttackProtector(callbacks.Plugin): msg = ircmsgs.mode(channel, punishment[len('mode'):]) irc.queueMsg(msg) elif punishment.startswith('umode'): - msg = ircmsgs.mode(channel, (punishment[len('umode'):], banmask)) + msg = ircmsgs.mode(channel, (punishment[len('umode'):], msg.nick)) + irc.queueMsg(msg) + elif punishment.startswith('mmode'): + msg = ircmsgs.mode(channel, (punishment[len('mmode'):], banmask)) irc.queueMsg(msg) elif punishment.startswith('command '): tokens = callbacks.tokenize(punishment[len('command '):]) diff --git a/GitHub/plugin.py b/GitHub/plugin.py index 0045e64..8eabe0a 100644 --- a/GitHub/plugin.py +++ b/GitHub/plugin.py @@ -158,7 +158,9 @@ class GitHub(callbacks.Plugin): url) if hidden is not None: s += _(' (+ %i hidden commits)') % hidden - return ircmsgs.privmsg(channel, u(s)) + if sys.version_info[0] < 3: + s = s.encode('utf-8') + return ircmsgs.privmsg(channel, s) def onPayload(self, payload): repo = '%s/%s' % (payload['repository']['owner']['name'],