From 1858eaf59e1f12adbf9d59840b54fb1a2878ef92 Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 11 Nov 2019 11:55:29 -0800 Subject: [PATCH] Plugin: support showing __maintainer__ field in the 'author' command --- plugins/Plugin/plugin.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/plugins/Plugin/plugin.py b/plugins/Plugin/plugin.py index d48f0c1c4..1fb08732e 100644 --- a/plugins/Plugin/plugin.py +++ b/plugins/Plugin/plugin.py @@ -131,10 +131,20 @@ class Plugin(callbacks.Plugin): irc.error(_('That plugin does not seem to be loaded.')) return module = cb.classModule - if hasattr(module, '__author__') and module.__author__: - irc.reply(str(module.__author__)) + + author = getattr(module, '__author__', None) + # Allow for a maintainer field, which better represents plugins that have changed hands + # over time. Of course, assume that the author is the maintainer if no other info is given. + maintainer = getattr(module, '__maintainer__', None) or author + + if author: + if maintainer == author: + irc.reply(_("%s was written by %s") % (cb.name(), author)) + else: + irc.reply(_("%s was written by %s and is maintained by %s.") % \ + (cb.name(), author, maintainer)) else: - irc.reply(_('That plugin doesn\'t have an author that claims it.')) + irc.reply(_('%s does not have any author listed.') % cb.name()) author = wrap(author, [('plugin')]) @internationalizeDocstring