summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2016-08-22 19:55:17 +0200
committermathieui <mathieui@mathieui.net>2016-08-22 19:55:17 +0200
commitca682cf23d2f820779587f790c742218e20cff49 (patch)
tree27648b0b42ec0642bcfcfdd35d650e4ce1063d35
parent5f0c0fbb0adb45407008d84dc1b6e843cd94870c (diff)
downloadpoezio-ca682cf23d2f820779587f790c742218e20cff49.tar.gz
poezio-ca682cf23d2f820779587f790c742218e20cff49.tar.bz2
poezio-ca682cf23d2f820779587f790c742218e20cff49.tar.xz
poezio-ca682cf23d2f820779587f790c742218e20cff49.zip
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
-rw-r--r--poezio/tabs/muctab.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py
index e17ab18b..e112c78d 100644
--- a/poezio/tabs/muctab.py
+++ b/poezio/tabs/muctab.py
@@ -1098,13 +1098,13 @@ class MucTab(ChatTab):
jid = presence['muc']['jid']
typ = presence['type']
deterministic = config.get_by_tabname('deterministic_nick_colors', self.name)
- 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)
self.core.events.trigger('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)
self.core.events.trigger('muc_join', presence, self)
self.on_user_join(from_nick, affiliation, show, status, role,
- jid, color)
+ jid, user_color)
# nick change
elif change_nick:
self.core.events.trigger('muc_nickchange', presence, self)