diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index 259e618f1..8cea01705 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) @@ -505,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': @@ -534,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 diff --git a/src/httpserver.py b/src/httpserver.py index 787ae840f..b07d25e03 100644 --- a/src/httpserver.py +++ b/src/httpserver.py @@ -186,6 +186,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) @@ -285,6 +286,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