summaryrefslogtreecommitdiff
path: root/src/core.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-12-18 20:43:40 +0100
committerFlorent Le Coz <louiz@louiz.org>2012-01-26 10:05:35 +0100
commit91698b6f1b54982460a7f1869b96980d194a9bb1 (patch)
tree76583a6025d6685ac135dac899a50ee4157eb8ce /src/core.py
parentc59f1b2aa27bb34b0ae82d9e66fb8fa200c0562a (diff)
downloadpoezio-91698b6f1b54982460a7f1869b96980d194a9bb1.tar.gz
poezio-91698b6f1b54982460a7f1869b96980d194a9bb1.tar.bz2
poezio-91698b6f1b54982460a7f1869b96980d194a9bb1.tar.xz
poezio-91698b6f1b54982460a7f1869b96980d194a9bb1.zip
Fix the completion for /decline and /invite
Diffstat (limited to 'src/core.py')
-rw-r--r--src/core.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/core.py b/src/core.py
index e3d655d5..883eb8fa 100644
--- a/src/core.py
+++ b/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