Fix the completion for /decline and /invite
This commit is contained in:
parent
caff8b43a1
commit
08b374cb29
1 changed files with 14 additions and 11 deletions
25
src/core.py
25
src/core.py
|
@ -387,14 +387,15 @@ class Core(object):
|
|||
self.xmpp.plugin['xep_0045'].invite(room, to, reason)
|
||||
|
||||
def completion_invite(self, the_input):
|
||||
"""Completion for /invite"""
|
||||
txt = the_input.get_text()
|
||||
args = common.shell_split(txt)
|
||||
n = len(args)
|
||||
if txt.endswith(' '):
|
||||
n += 1
|
||||
if len(args) == 1:
|
||||
if n == 2:
|
||||
return the_input.auto_completion([contact.bare_jid for contact in roster.get_contacts()], '')
|
||||
elif len(args) == 2:
|
||||
elif n == 3:
|
||||
rooms = []
|
||||
for tab in self.tabs:
|
||||
if isinstance(tab, tabs.MucTab) and tab.joined:
|
||||
|
@ -410,8 +411,19 @@ class Core(object):
|
|||
if jid.bare not in self.pending_invites:
|
||||
return
|
||||
reason = args[1] if len(args) > 1 else ''
|
||||
del self.pending_invites[jid.bare]
|
||||
self.xmpp.plugin['xep_0045'].decline_invite(jid.bare, self.pending_invites[jid.bare], reason)
|
||||
|
||||
def completion_decline(self, the_input):
|
||||
"""Completion for /decline"""
|
||||
txt = the_input.get_text()
|
||||
args = common.shell_split(txt)
|
||||
n = len(args)
|
||||
if txt.endswith(' '):
|
||||
n += 1
|
||||
if n == 2:
|
||||
return the_input.auto_completion(list(self.pending_invites.keys()), '')
|
||||
|
||||
def command_invitations(self, arg):
|
||||
"""/invitations"""
|
||||
build = ""
|
||||
|
@ -423,15 +435,6 @@ class Core(object):
|
|||
build = "You are do not have any pending invitation."
|
||||
self.information(build, 'Info')
|
||||
|
||||
def completion_decline(self, the_input):
|
||||
txt = the_input.get_text()
|
||||
args = common.shell_split(txt)
|
||||
n = len(args)
|
||||
if txt.endswith(' '):
|
||||
n += 1
|
||||
if len(args) == 1:
|
||||
return the_input.auto_completion(list(self.pending_invites.keys()), '')
|
||||
|
||||
def on_groupchat_decline(self, decline):
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in a new issue