changeset 3450c48ddb75 in /home/hg/repos/gajim
author: Yann Leboulanger asterix@lagaule.org branches: details:http://hg.gajim.org/gajim?cmd=changeset;node=3450c48ddb75 description: fix receiving highlighted corrected message. Fixes #7431
diffstat:
src/conversation_textview.py | 6 ++++-- src/groupchat_control.py | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-)
diffs (73 lines):
diff -r bb651151e276 -r 3450c48ddb75 src/conversation_textview.py --- a/src/conversation_textview.py Mon Jan 27 20:18:42 2014 +0100 +++ b/src/conversation_textview.py Wed Jan 29 22:10:48 2014 +0100 @@ -479,7 +479,8 @@ self.last_sent_message_marks[1] = buffer_.create_mark(None, i2, left_gravity=True)
- def correct_last_received_message(self, message, xhtml, name, old_txt): + def correct_last_received_message(self, message, xhtml, name, old_txt, + other_tags_for_name=[], other_tags_for_text=[]): if name not in self.last_received_message_marks: return m1 = self.last_received_message_marks[name][0] @@ -490,7 +491,8 @@ txt = buffer_.get_text(i1, i2, True) buffer_.delete(i1, i2) i2 = self.print_conversation_line(message, '', 'incoming', name, None, - xhtml=xhtml, iter_=i1) + other_tags_for_name=other_tags_for_name, + other_tags_for_text=other_tags_for_text, xhtml=xhtml, iter_=i1) tt_txt = _('<b>Message was corrected. Last message was:</b>\n %s') % \ GLib.markup_escape_text(old_txt) self.show_corrected_message_warning(i2, tt_txt) diff -r bb651151e276 -r 3450c48ddb75 src/groupchat_control.py --- a/src/groupchat_control.py Mon Jan 27 20:18:42 2014 +0100 +++ b/src/groupchat_control.py Wed Jan 29 22:10:48 2014 +0100 @@ -1035,8 +1035,44 @@ obj.xhtml_msgtxt, obj.nick, old_txt) else: old_txt = self.last_received_txt[obj.nick] - self.conv_textview.correct_last_received_message(obj.msgtxt, - obj.xhtml_msgtxt, obj.nick, old_txt) + (highlight, sound) = self.highlighting_for_message(obj.msgtxt, obj.timestamp) + other_tags_for_name = [] + other_tags_for_text = [] + if obj.nick in self.gc_custom_colors: + other_tags_for_name.append('gc_nickname_color_' + \ + str(self.gc_custom_colors[obj.nick])) + else: + self.gc_count_nicknames_colors += 1 + if self.gc_count_nicknames_colors == \ + self.number_of_colors: + self.gc_count_nicknames_colors = 0 + self.gc_custom_colors[obj.nick] = \ + self.gc_count_nicknames_colors + other_tags_for_name.append('gc_nickname_color_' + \ + str(self.gc_count_nicknames_colors)) + if highlight: + # muc-specific chatstate + if self.parent_win: + self.parent_win.redraw_tab(self, 'attention') + else: + self.attention_flag = True + other_tags_for_name.append('bold') + other_tags_for_text.append('marked') + + if obj.nick in self.attention_list: + self.attention_list.remove(obj.nick) + elif len(self.attention_list) > 6: + self.attention_list.pop(0) # remove older + self.attention_list.append(obj.nick) + + if obj.msgtxt.startswith('/me ') or \ + obj.msgtxt.startswith('/me\n'): + other_tags_for_text.append('gc_nickname_color_' + \ + str(self.gc_custom_colors[obj.nick])) + self.conv_textview.correct_last_received_message( + obj.msgtxt, obj.xhtml_msgtxt, obj.nick, old_txt, + other_tags_for_name=other_tags_for_name, + other_tags_for_text=other_tags_for_text) self.last_received_txt[obj.nick] = obj.msgtxt self.last_received_id[obj.nick] = obj.stanza.getID() return