Set nicknames colors per muc, not for all of them ! Keep nick color on

nick change. Closes #2264.
This commit is contained in:
Jean-Marie Traissard 2006-09-02 00:35:03 +00:00
parent 23396f8f59
commit 8af50e298f
1 changed files with 11 additions and 9 deletions

View File

@ -534,20 +534,19 @@ class GroupchatControl(ChatControlBase):
if kind == 'incoming': # it's a message NOT from us
# highlighting and sounds
(highlight, sound) = self.highlighting_for_message(text, tim)
gc_class=self.__class__
if gc_class.gc_custom_colors.has_key(contact):
if self.gc_custom_colors.has_key(contact):
other_tags_for_name.append('gc_nickname_color_' + \
str(gc_class.gc_custom_colors[contact]))
str(self.gc_custom_colors[contact]))
else:
gc_class.gc_count_nicknames_colors += 1
self.gc_count_nicknames_colors += 1
number_of_colors = len(gajim.config.get('gc_nicknames_colors').\
split(':'))
if gc_class.gc_count_nicknames_colors == number_of_colors:
gc_class.gc_count_nicknames_colors = 0
gc_class.gc_custom_colors[contact] = \
gc_class.gc_count_nicknames_colors
if self.gc_count_nicknames_colors == number_of_colors:
self.gc_count_nicknames_colors = 0
self.gc_custom_colors[contact] = \
self.gc_count_nicknames_colors
other_tags_for_name.append('gc_nickname_color_' + \
str(gc_class.gc_count_nicknames_colors))
str(self.gc_count_nicknames_colors))
if highlight:
# muc-specific chatstate
self.parent_win.redraw_tab(self, 'attention')
@ -778,6 +777,9 @@ class GroupchatControl(ChatControlBase):
# after that, but that doesn't hurt
self.add_contact_to_roster(new_nick, show, role, affiliation,
status, jid)
# keep nickname color
self.gc_custom_colors[new_nick] =\
self.gc_custom_colors[nick]
# rename vcard / avatar
puny_jid = helpers.sanitize_filename(self.room_jid)
puny_nick = helpers.sanitize_filename(nick)