print correctly when we correct a /me message. Fixes #7400

This commit is contained in:
Yann Leboulanger 2013-08-13 21:18:44 +02:00
parent 0d820c3723
commit 2ac56e6cee
2 changed files with 13 additions and 7 deletions

View File

@ -1359,8 +1359,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
self.orig_msg = msg_buf.get_text(start_iter, end_iter, 0).decode( self.orig_msg = msg_buf.get_text(start_iter, end_iter, 0).decode(
'utf-8') 'utf-8')
if pos == size and size > 0 and direction == 'up' and \ if pos == size and size > 0 and direction == 'up' and \
msg_type == 'sent' and not self.correcting and not \ msg_type == 'sent' and not self.correcting and (not \
history[pos - 1].startswith('/'): history[pos - 1].startswith('/') or history[pos - 1].startswith('/me')):
self.correcting = True self.correcting = True
self.old_message_tv_color = self.msg_textview.get_style().base[0] self.old_message_tv_color = self.msg_textview.get_style().base[0]
self.msg_textview.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse( self.msg_textview.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse(
@ -2985,14 +2985,14 @@ class ChatControl(ChatControlBase):
xhtml = None xhtml = None
if row[2].startswith('<body '): if row[2].startswith('<body '):
xhtml = row[2] xhtml = row[2]
ChatControlBase.print_conversation_line(self, row[2], kind, name,
tim, small_attr, small_attr + ['restored_message'],
small_attr + ['restored_message'], False,
old_kind=local_old_kind, xhtml=xhtml)
if row[2].startswith('/me ') or row[2].startswith('/me\n'): if row[2].startswith('/me ') or row[2].startswith('/me\n'):
local_old_kind = None local_old_kind = None
else: else:
local_old_kind = kind local_old_kind = kind
ChatControlBase.print_conversation_line(self, row[2], kind, name,
tim, small_attr, small_attr + ['restored_message'],
small_attr + ['restored_message'], False,
old_kind=local_old_kind, xhtml=xhtml)
if len(rows): if len(rows):
self.conv_textview.print_empty_line() self.conv_textview.print_empty_line()

View File

@ -486,7 +486,10 @@ class ConversationTextview(gobject.GObject):
i2 = buffer_.get_iter_at_mark(m2) i2 = buffer_.get_iter_at_mark(m2)
txt = buffer_.get_text(i1, i2) txt = buffer_.get_text(i1, i2)
buffer_.delete(i1, i2) buffer_.delete(i1, i2)
i2 = self.print_real_text(message, text_tags=['outgoingtxt'], name=name, tag = 'outgoingtxt'
if message.startswith('/me'):
tag = 'outgoing'
i2 = self.print_real_text(message, text_tags=[tag], name=name,
xhtml=xhtml, iter_=i1) xhtml=xhtml, iter_=i1)
tt_txt = _('<b>Message was corrected. Last message was:</b>\n %s') % \ tt_txt = _('<b>Message was corrected. Last message was:</b>\n %s') % \
old_txt old_txt
@ -1333,6 +1336,9 @@ class ConversationTextview(gobject.GObject):
if other_text_tag: if other_text_tag:
# note that color of /me may be overwritten in gc_control # note that color of /me may be overwritten in gc_control
text_tags.append(other_text_tag) text_tags.append(other_text_tag)
if text.startswith('/me'):
mark1 = buffer_.create_mark(None, buffer_.get_end_iter(),
left_gravity=True)
else: # not status nor /me else: # not status nor /me
if gajim.config.get('chat_merge_consecutive_nickname'): if gajim.config.get('chat_merge_consecutive_nickname'):
if kind != old_kind or self.just_cleared: if kind != old_kind or self.just_cleared: