From 2957cded911a75bfae9e6818d3670efb1570e988 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 27 Apr 2012 22:34:12 +0200 Subject: Fix the completion for all commands manipulating the roster --- src/core.py | 8 ++++---- src/tabs.py | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/core.py b/src/core.py index 23a82fe6..da9ff4da 100644 --- a/src/core.py +++ b/src/core.py @@ -468,7 +468,7 @@ class Core(object): if txt.endswith(' '): n += 1 if n == 2: - return the_input.auto_completion([contact.bare_jid for contact in roster.get_contacts()], '') + return the_input.auto_completion([jid for jid in roster.jids()], '') elif n == 3: rooms = [] for tab in self.tabs: @@ -683,7 +683,7 @@ class Core(object): self.information(_("Your JID is %s") % self.xmpp.boundjid.full) if not self.xmpp.anon: # request the roster - self.xmpp.getRoster() + self.xmpp.get_roster() # send initial presence if config.get('send_initial_presence', 'true').lower() == 'true': pres = self.xmpp.make_presence() @@ -1485,7 +1485,7 @@ class Core(object): if text.endswith(' '): n += 1 if n == 2: - return the_input.auto_completion([contact.bare_jid for contact in roster.get_contacts()], '') + return the_input.auto_completion([jid for jid in roster.jids()], '') elif n == 3: return the_input.auto_completion([status for status in possible_show], '') @@ -1744,7 +1744,7 @@ class Core(object): n = len(the_input.get_text().split()) if n > 2 or (n == 2 and the_input.get_text().endswith(' ')): return - return the_input.auto_completion([contact.bare_jid for contact in roster.get_contacts()], '') + return the_input.auto_completion([jid for jid in roster.jids()], '') def completion_list(self, the_input): muc_serv_list = [] diff --git a/src/tabs.py b/src/tabs.py index 9a8f3794..e33b5a9a 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -627,7 +627,7 @@ class MucTab(ChatTab): compare_users = lambda x: x.last_talked userlist = [user.nick for user in sorted(self.users, key=compare_users, reverse=True)\ if user.nick != self.own_nick] - contact_list = [contact.bare_jid for contact in roster.get_contacts()] + contact_list = [jid for jid in roster.jids()] userlist.extend(contact_list) return the_input.auto_completion(userlist, '') @@ -1962,7 +1962,7 @@ class RosterInfoTab(Tab): """ From with any JID presence in the roster """ - jids = [contact.bare_jid for contact in roster.get_contacts()] + jids = [jid for jid in roster.jids()] return the_input.auto_completion(jids, '') def completion_name(self, the_input): @@ -1972,7 +1972,7 @@ class RosterInfoTab(Tab): n += 1 if n == 2: - jids = [contact.bare_jid for contact in roster.get_contacts()] + jids = [jid for jid in roster.jids()] return the_input.auto_completion(jids, '') return False @@ -1983,10 +1983,10 @@ class RosterInfoTab(Tab): n += 1 if n == 2: - jids = [contact.bare_jid for contact in roster.get_contacts()] + jids = [jid for jid in roster.jids()] return the_input.auto_completion(jids, '') elif n == 3: - groups = [group.name for group in roster.get_groups() if group.name != 'none'] + groups = [group for group in roster.groups if group != 'none'] return the_input.auto_completion(groups, '') return False @@ -1998,11 +1998,11 @@ class RosterInfoTab(Tab): n += 1 if n == 2: - jids = [contact.bare_jid for contact in roster.get_contacts()] + jids = [jid for jid in roster.jids()] return the_input.auto_completion(jids, '') elif n == 3: - contact = roster.get_contact_by_jid(args[1]) - if not contact: + contact = roster[args[1]] + if contact is None: return False groups = list(contact.groups) try: @@ -2017,8 +2017,8 @@ class RosterInfoTab(Tab): Complete the first argument from the list of the contact with ask=='subscribe' """ - jids = [contact.bare_jid for contact in roster.get_contacts()\ - if contact.ask == 'asked'] + jids = [str(contact.bare_jid) for contact in roster.contacts.values()\ + if contact.pending_in] return the_input.auto_completion(jids, '') def command_accept(self, args): -- cgit v1.2.3