[ roidelapluie ] Use differents colors for nickname in gc for each occupiant. Fixes #2084.
This commit is contained in:
parent
e7cb71916c
commit
1a9d4690b0
|
@ -200,6 +200,7 @@ class Config:
|
|||
'hide_groupchat_occupants_list': [opt_bool, False, _('Hides the room occupants list in groupchat window')],
|
||||
'chat_merge_consecutive_nickname': [opt_bool, False, _('Merge consecutive nickname in chat window')],
|
||||
'chat_merge_consecutive_nickname_indent': [opt_str, ' ', _('Indentation when using merge consecutive nickame')],
|
||||
'gc_nicknames_colors': [ opt_str, '#a34526:#c000ff:#0012ff:#388a99:#38995d:#519938:#ff8a00:#94452d:#244b5a:#32645a', _('List of colors that will be used to color nicknames in groupchats'), True ],
|
||||
}
|
||||
|
||||
__options_per_key = {
|
||||
|
|
|
@ -83,6 +83,14 @@ class ConversationTextview:
|
|||
color = gajim.config.get('statusmsgcolor')
|
||||
self.tagStatus.set_property('foreground', color)
|
||||
|
||||
colors = gajim.config.get('gc_nicknames_colors')
|
||||
colors = colors.split(':')
|
||||
for color in xrange(len(colors)):
|
||||
tagname = 'gc_nickname_color_' + str(color)
|
||||
tag = buffer.create_tag(tagname)
|
||||
color = colors[color]
|
||||
tag.set_property('foreground', color)
|
||||
|
||||
tag = buffer.create_tag('marked')
|
||||
color = gajim.config.get('markedmsgcolor')
|
||||
tag.set_property('foreground', color)
|
||||
|
|
|
@ -503,6 +503,9 @@ class GroupchatControl(ChatControlBase):
|
|||
fin = True
|
||||
return None
|
||||
|
||||
gc_count_nicknames_colors = 0
|
||||
gc_custom_colors = {}
|
||||
|
||||
def print_conversation(self, text, contact = '', tim = None):
|
||||
'''Print a line in the conversation:
|
||||
if contact is set: it's a message from someone or an info message (contact
|
||||
|
@ -528,6 +531,18 @@ 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):
|
||||
other_tags_for_name.append('gc_nickname_color_' + \
|
||||
str(gc_class.gc_custom_colors[contact]))
|
||||
else:
|
||||
gc_class.gc_count_nicknames_colors += 1
|
||||
gc_class.gc_custom_colors[contact] = gc_class.gc_count_nicknames_colors
|
||||
other_tags_for_name.append('gc_nickname_color_' + \
|
||||
str(gc_class.gc_count_nicknames_colors))
|
||||
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
|
||||
if highlight:
|
||||
# muc-specific chatstate
|
||||
self.parent_win.redraw_tab(self, 'attention')
|
||||
|
|
Loading…
Reference in New Issue