diff --git a/plugins/User/plugin.py b/plugins/User/plugin.py index 452d9ee44..e90428c0f 100644 --- a/plugins/User/plugin.py +++ b/plugins/User/plugin.py @@ -399,18 +399,19 @@ class User(callbacks.Plugin): remove = wrap(remove, ['private', first('otherUser', 'user'), optional('something'), additional('something', '')]) + def callCommand(self, command, irc, msg, *args, **kwargs): + if command[0] != 'gpg' or \ + (gpg.available and self.registryValue('gpg.enable')): + return super(User, self) \ + .callCommand(command, irc, msg, *args, **kwargs) + else: + irc.error(_('GPG features are not enabled.')) + class gpg(callbacks.Commands): def __init__(self, *args): super(User.gpg, self).__init__(*args) self._tokens = {} - def callCommand(self, command, irc, msg, *args, **kwargs): - if gpg.available and self.registryValue('gpg.enable'): - return super(User.gpg, self) \ - .callCommand(command, irc, msg, *args, **kwargs) - else: - irc.error(_('GPG features are not enabled.')) - def _expire_tokens(self): now = time.time() self._tokens = dict(filter(lambda x_y: x_y[1][1]>now, @@ -460,6 +461,18 @@ class User(callbacks.Plugin): irc.error(_('GPG key not associated with your account.')) remove = wrap(remove, ['user', 'somethingWithoutSpaces']) + @internationalizeDocstring + def list(self, irc, msg, args, user): + """takes no arguments + + List your GPG keys.""" + keyids = user.gpgkeys + if len(keyids) == 0: + irc.reply(_('No key is associated with your account.')) + else: + irc.reply(format('%L', keyids)) + list = wrap(list, ['user']) + @internationalizeDocstring def gettoken(self, irc, msg, args): """takes no arguments