Commit ca682cf2 authored by mathieui's avatar mathieui

Muctab: Only search for matching colors on user join

this call is actually quite expensive, so it will help in specific cases
where we receive a lot of presence stanzas (e.g. a netsplit in an irc
gateway, or a +vvvvvvvvvvvvvvvvvvvvvvvvv, etc) that are not joins
parent 5f0c0fbb
......@@ -1098,13 +1098,13 @@ class MucTab(ChatTab):
jid = presence['muc']['jid']
typ = presence['type']
deterministic = config.get_by_tabname('deterministic_nick_colors',
color = self.search_for_color(from_nick)
if not self.joined: # user in the room BEFORE us.
# ignore redondant presence message, see bug #1509
if (from_nick not in [user.nick for user in self.users]
and typ != "unavailable"):
user_color = self.search_for_color(from_nick)
new_user = User(from_nick, affiliation, show,
status, role, jid, deterministic, color)
status, role, jid, deterministic, user_color)
bisect.insort_left(self.users, new_user)'muc_join', presence, self)
if '110' in status_codes or self.own_nick == from_nick:
......@@ -1183,9 +1183,10 @@ class MucTab(ChatTab):
user = self.get_user_by_name(from_nick)
# New user
if not user:
user_color = self.search_for_color(from_nick)'muc_join', presence, self)
self.on_user_join(from_nick, affiliation, show, status, role,
jid, color)
jid, user_color)
# nick change
elif change_nick:'muc_nickchange', presence, self)
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