Commit e03fb0b3 authored by mathieui's avatar mathieui

Fix completion and function names for /accept and /add

parent eda88a59
......@@ -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
......
......@@ -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
......
......@@ -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'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment