summaryrefslogtreecommitdiff
path: root/poezio
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2020-05-09 23:32:26 +0200
committermathieui <mathieui@mathieui.net>2020-05-10 00:11:23 +0200
commite03fb0b3ce41de208e4b52ee1224a080cfc5c6f5 (patch)
tree0fad35396fe5dfb3087d0659083c5d329ffd2779 /poezio
parenteda88a59a6b56c70fcbc9e2f5ef705a17d74c381 (diff)
downloadpoezio-e03fb0b3ce41de208e4b52ee1224a080cfc5c6f5.tar.gz
poezio-e03fb0b3ce41de208e4b52ee1224a080cfc5c6f5.tar.bz2
poezio-e03fb0b3ce41de208e4b52ee1224a080cfc5c6f5.tar.xz
poezio-e03fb0b3ce41de208e4b52ee1224a080cfc5c6f5.zip
Fix completion and function names for /accept and /add
Diffstat (limited to 'poezio')
-rw-r--r--poezio/core/commands.py4
-rw-r--r--poezio/core/completions.py8
-rw-r--r--poezio/core/core.py7
3 files changed, 14 insertions, 5 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index f5594d5d..60bcc7b0 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -520,7 +520,7 @@ class CommandCore:
@deny_anonymous
@command_args_parser.quoted(0, 1)
- def command_accept(self, args):
+ def accept(self, args):
"""
Accept a JID. Authorize it AND subscribe to it
"""
@@ -557,7 +557,7 @@ class CommandCore:
@deny_anonymous
@command_args_parser.quoted(1)
- def command_add(self, args):
+ def add(self, args):
"""
Add the specified JID to the roster, and automatically
accept the reverse subscription
diff --git a/poezio/core/completions.py b/poezio/core/completions.py
index ee3e95bf..544a7889 100644
--- a/poezio/core/completions.py
+++ b/poezio/core/completions.py
@@ -44,6 +44,14 @@ class CompletionCore:
' ',
quotify=False)
+ def roster_barejids(self, the_input):
+ """Complete roster bare jids"""
+ jids = sorted(
+ str(contact.bare_jid) for contact in roster.contacts.values()
+ if contact.pending_in
+ )
+ return Completion(the_input.new_completion, jids, 1, '', quotify=False)
+
def presence(self, the_input):
"""
Completion of /presence
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 8f25d551..a0976c3c 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -1770,14 +1770,15 @@ class Core:
completion=self.completion.bookmark)
self.register_command(
'accept',
- self.command.command_accept,
+ self.command.accept,
usage='[jid]',
desc='Allow the provided JID (or the selected contact '
'in your roster), to see your presence.',
- shortdesc='Allow a user your presence.',)
+ shortdesc='Allow a user your presence.',
+ completion=self.completion.roster_barejids)
self.register_command(
'add',
- self.command.command_add,
+ self.command.add,
usage='<jid>',
desc='Add the specified JID to your roster, ask them to'
' allow you to see his presence, and allow them to'