Verified Commit 3633072b authored by mathieui's avatar mathieui

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?)
parent d226c609
...@@ -217,12 +217,13 @@ def completion_message(self, the_input): ...@@ -217,12 +217,13 @@ def completion_message(self, the_input):
n = the_input.get_argument_position(quoted=True) n = the_input.get_argument_position(quoted=True)
if n >= 2: if n >= 2:
return 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])), []) l = []
comp = sorted(comp) for jid in roster.jids():
bares = sorted(roster[contact].bare_jid for contact in roster.jids() if len(roster[contact])) if len(roster[jid]):
off = sorted(jid for jid in roster.jids() if jid not in bares) l.append(jid)
comp = bares + comp + off for resource in roster[jid].resources:
return the_input.new_completion(comp, 1, '', quotify=True) l.append(resource.jid)
return the_input.new_completion(l, 1, '', quotify=True)
def completion_invite(self, the_input): def completion_invite(self, the_input):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment