From 43e1b55506d067c3b8f8840a46cd5c92c81494bb Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 1 Jan 2014 11:40:49 +0000 Subject: [PATCH 1/3] Misc: Fix @version on Python 2. --- plugins/Misc/plugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index 259e618f1..9cd1a3c87 100644 --- a/plugins/Misc/plugin.py +++ b/plugins/Misc/plugin.py @@ -314,6 +314,8 @@ class Misc(callbacks.Plugin): version = data['commit']['committer']['date'] # Strip the last 'Z': version = ''.join(version.rsplit('Z', 1)).replace(':', '-') + if sys.version_info[0] < 3 and isinstance(version, unicode): + version = version.encode('utf8') versions[branch] = version newest = _('The newest versions available online are %s.') % \ ', '.join([_('%s (in %s)') % (y,x) From 9457f4dbe7c7b14b9c2d4487e9b9c598001e9398 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 1 Jan 2014 20:46:09 +0000 Subject: [PATCH 2/3] =?UTF-8?q?Misc:=20Add=20command=20@noticetell=20to=20?= =?UTF-8?q?replace=20=E2=80=9C@notice=20[tell=20]=E2=80=9D=20which=20is=20?= =?UTF-8?q?no=20longer=20possible=20since=20f0233c37.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/Misc/plugin.py | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index 9cd1a3c87..8cea01705 100644 --- a/plugins/Misc/plugin.py +++ b/plugins/Misc/plugin.py @@ -507,13 +507,7 @@ class Misc(callbacks.Plugin): 'regexp': 'regexpMatcher',})]) - @internationalizeDocstring - def tell(self, irc, msg, args, target, text): - """ - - Tells the whatever is. Use nested commands to your - benefit here. - """ + def _tell(self, irc, msg, args, target, text, notice): if irc.nested: irc.error('This command cannot be nested.', Raise=True) if target.lower() == 'me': @@ -536,9 +530,28 @@ class Misc(callbacks.Plugin): text = '* %s %s' % (irc.nick, text) s = _('%s wants me to tell you: %s') % (msg.nick, text) irc.replySuccess() - irc.reply(s, to=target, private=True) + irc.reply(s, to=target, private=True, notice=notice) + + @internationalizeDocstring + def tell(self, *args): + """ + + Tells the whatever is. Use nested commands to your + benefit here. + """ + self._tell(*args, notice=False) tell = wrap(tell, ['something', 'text']) + @internationalizeDocstring + def noticetell(self, *args): + """ + + Tells the whatever is, in a notice. Use nested + commands to your benefit here. + """ + self._tell(*args, notice=True) + noticetell = wrap(noticetell, ['something', 'text']) + @internationalizeDocstring def ping(self, irc, msg, args): """takes no arguments From 38d78a42132c02019db566cb8b1c455370ed5ee6 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Thu, 2 Jan 2014 17:20:15 +0000 Subject: [PATCH 3/3] httpserver: add method 'doHook' to callbacks. --- src/httpserver.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/httpserver.py b/src/httpserver.py index 028809c26..de2cddce1 100644 --- a/src/httpserver.py +++ b/src/httpserver.py @@ -184,6 +184,7 @@ class RealSupyHTTPServer(HTTPServer): 'reloaded the plugin and it didn\'t properly unhook. ' 'Forced unhook.') % subdir) self.callbacks[subdir] = callback + callback.doHook(self, subdir) def unhook(self, subdir): callback = self.callbacks.pop(subdir) # May raise a KeyError. We don't care. callback.doUnhook(self) @@ -283,6 +284,9 @@ class SupyHTTPServerCallback(object): doPost = doHead = doGet + def doHook(self, handler, subdir): + """Method called when hooking this callback.""" + pass def doUnhook(self, handler): """Method called when unhooking this callback.""" pass