summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-07-31 20:47:01 +0200
committermathieui <mathieui@mathieui.net>2015-07-31 20:47:01 +0200
commit3633072b365ae858370c5c8e9c17708f255f2dc4 (patch)
tree489048280a07b97b08cd21ca6cb3f1506c0d4c25 /src/core
parentd226c60997b8b65d17a1ba706aed59a8400dd757 (diff)
downloadpoezio-3633072b365ae858370c5c8e9c17708f255f2dc4.tar.gz
poezio-3633072b365ae858370c5c8e9c17708f255f2dc4.tar.bz2
poezio-3633072b365ae858370c5c8e9c17708f255f2dc4.tar.xz
poezio-3633072b365ae858370c5c8e9c17708f255f2dc4.zip
Fix #3105 (/message completion is slow)
sorting things several times is slow, and our roster wrapper is even slower. remove the overly slow code until the roster wrapper is rewritten (do we even need this level of detailed sorting in the first place?)
Diffstat (limited to 'src/core')
-rw-r--r--src/core/completions.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/completions.py b/src/core/completions.py
index f17e916c..9fd44f1b 100644
--- a/src/core/completions.py
+++ b/src/core/completions.py
@@ -217,12 +217,13 @@ def completion_message(self, the_input):
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])), [])
- comp = sorted(comp)
- bares = sorted(roster[contact].bare_jid for contact in roster.jids() if len(roster[contact]))
- off = sorted(jid for jid in roster.jids() if jid not in bares)
- comp = bares + comp + off
- return the_input.new_completion(comp, 1, '', quotify=True)
+ l = []
+ for jid in roster.jids():
+ if len(roster[jid]):
+ l.append(jid)
+ for resource in roster[jid].resources:
+ l.append(resource.jid)
+ return the_input.new_completion(l, 1, '', quotify=True)
def completion_invite(self, the_input):