diff options
author | mathieui <mathieui@mathieui.net> | 2014-12-17 21:21:57 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-12-17 21:21:57 +0100 |
commit | 92265678dc05edc5ad0a50fc69046db6acb05b9f (patch) | |
tree | ff56cf964a3ba8766839b7bf24d1b31de97d38ea /src/tabs/rostertab.py | |
parent | 2bb4f45ed4b4e785c2843012e8fb2f9c62476402 (diff) | |
download | poezio-92265678dc05edc5ad0a50fc69046db6acb05b9f.tar.gz poezio-92265678dc05edc5ad0a50fc69046db6acb05b9f.tar.bz2 poezio-92265678dc05edc5ad0a50fc69046db6acb05b9f.tar.xz poezio-92265678dc05edc5ad0a50fc69046db6acb05b9f.zip |
Add completions for /cert_add and /cert_fetch
Diffstat (limited to 'src/tabs/rostertab.py')
-rw-r--r-- | src/tabs/rostertab.py | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/tabs/rostertab.py b/src/tabs/rostertab.py index 084df3fd..e04f37fe 100644 --- a/src/tabs/rostertab.py +++ b/src/tabs/rostertab.py @@ -162,7 +162,8 @@ class RosterInfoTab(Tab): ' if a client connected using this certificate can' ' manage the certificates itself.'), shortdesc=_('Add a client certificate.'), - usage='<name> <certificate path> [management]') + usage='<name> <certificate path> [management]', + completion=self.completion_cert_add) self.register_command('cert_disable', self.command_cert_disable, desc=_('Remove a certificate from the list ' 'of allowed ones. Clients currently ' @@ -181,7 +182,8 @@ class RosterInfoTab(Tab): desc=_('Retrieve a certificate with its ' 'name. It will be stored in <path>.'), shortdesc=_('Fetch a certificate'), - usage='<name> <path>') + usage='<name> <path>', + completion=self.completion_cert_fetch) @command_args_parser.ignored def command_certs(self): @@ -245,6 +247,21 @@ class RosterInfoTab(Tab): self.core.xmpp.plugin['xep_0257'].add_cert(name, crt, callback=cb, allow_management=management) + def completion_cert_add(self, the_input): + """ + completion for /cert_add <name> <path> [management] + """ + text = the_input.get_text() + args = common.shell_split(text) + n = the_input.get_argument_position() + log.debug('%s %s %s', the_input.text, n, the_input.pos) + if n == 1: + return + elif n == 2: + return self.completion_file(2, the_input) + elif n == 3: + return the_input.new_completion(['true', 'false'], n) + @command_args_parser.quoted(1) def command_cert_disable(self, args): """ @@ -313,6 +330,19 @@ class RosterInfoTab(Tab): self.core.xmpp.plugin['xep_0257'].get_certs(callback=cb) + def completion_cert_fetch(self, the_input): + """ + completion for /cert_fetch <name> <path> + """ + text = the_input.get_text() + args = common.shell_split(text) + n = the_input.get_argument_position() + log.debug('%s %s %s', the_input.text, n, the_input.pos) + if n == 1: + return + elif n == 2: + return self.completion_file(2, the_input) + def on_blocked_message(self, message): """ When we try to send a message to a blocked contact |