Fix #2428 (complete fulljids on /version in MUCs)

also clean up some newlines mess
This commit is contained in:
mathieui 2014-04-11 01:25:00 +02:00
parent 0847643b54
commit 04aa6c8914
2 changed files with 13 additions and 12 deletions

View file

@ -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)

View file

@ -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"""