From 04aa6c89145dfc8aaa5c2e418e01419af9471726 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 11 Apr 2014 01:25:00 +0200 Subject: Fix #2428 (complete fulljids on /version in MUCs) also clean up some newlines mess --- src/core/completions.py | 18 +++++++----------- src/tabs/muctab.py | 7 ++++++- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/core/completions.py b/src/core/completions.py index cc3dd381..1df8d23d 100644 --- a/src/core/completions.py +++ b/src/core/completions.py @@ -24,6 +24,7 @@ def completion_help(self, the_input): commands = sorted(self.commands.keys()) + sorted(self.current_tab().commands.keys()) return the_input.new_completion(commands, 1, quotify=False) + def completion_status(self, the_input): """ Completion of /status @@ -42,6 +43,7 @@ def completion_presence(self, the_input): elif arg == 2: return the_input.auto_completion([status for status in possible_show], '', quotify=True) + def completion_theme(self, the_input): """ Completion for /theme""" themes_dir = config.get('themes_dir', '') @@ -69,6 +71,7 @@ def completion_win(self, the_input): l = [i[1] for i in l] return the_input.new_completion(l, 1, '', quotify=False) + def completion_join(self, the_input): """ Completion for /join @@ -136,11 +139,8 @@ def completion_join(self, the_input): def completion_version(self, the_input): """Completion for /version""" - n = the_input.get_argument_position(quoted=True) - if n >= 2: - return comp = reduce(lambda x, y: x + [i.jid for i in y], (roster[jid].resources for jid in roster.jids() if len(roster[jid])), []) - return the_input.new_completion(sorted(comp), 1, '', quotify=True) + return the_input.new_completion(sorted(comp), 1, quotify=False) def completion_list(self, the_input): @@ -153,7 +153,6 @@ def completion_list(self, the_input): return the_input.new_completion(muc_serv_list, 1, quotify=False) - def completion_move_tab(self, the_input): """Completion for /move_tab""" n = the_input.get_argument_position(quoted=True) @@ -163,8 +162,6 @@ def completion_move_tab(self, the_input): return the_input.new_completion(nodes, 1, ' ', quotify=True) - - def completion_runkey(self, the_input): """ Completion for /runkey @@ -207,16 +204,19 @@ def completion_bookmark(self, the_input): muc_list.append('*') return the_input.new_completion(muc_list, 1, quotify=True) + def completion_remove_bookmark(self, the_input): """Completion for /remove_bookmark""" return the_input.new_completion([bm.jid for bm in bookmark.bookmarks], 1, quotify=False) + def completion_decline(self, the_input): """Completion for /decline""" n = the_input.get_argument_position(quoted=True) if n == 1: return the_input.auto_completion(sorted(self.pending_invites.keys()), 1, '', quotify=True) + def completion_bind(self, the_input): n = the_input.get_argument_position() if n == 1: @@ -245,7 +245,6 @@ def completion_message(self, the_input): return the_input.new_completion(comp, 1, '', quotify=True) - def completion_invite(self, the_input): """Completion for /invite""" n = the_input.get_argument_position(quoted=True) @@ -348,8 +347,6 @@ def completion_set(self, the_input): return the_input.new_completion(end_list, n, quotify=True) - - def completion_bookmark_local(self, the_input): """Completion for /bookmark_local""" n = the_input.get_argument_position(quoted=True) @@ -378,4 +375,3 @@ def completion_bookmark_local(self, the_input): muc_list.append('*') return the_input.new_completion(muc_list, 1, quotify=True) - diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py index 8953d075..4cd18f03 100644 --- a/src/tabs/muctab.py +++ b/src/tabs/muctab.py @@ -16,6 +16,7 @@ import curses import os import random from datetime import datetime +from functools import reduce from . import ChatTab, Tab @@ -206,7 +207,11 @@ 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] - return the_input.auto_completion(userlist, quotify=False) + comp = sorted(reduce(lambda x, y: x + [i.jid for i in y], + (roster[jid].resources for jid in roster.jids() if len(roster[jid])), + [])) + userlist.extend(comp) + return the_input.new_completion(userlist, 1, quotify=False) def completion_info(self, the_input): """Completion for /info""" -- cgit v1.2.3