summaryrefslogtreecommitdiff
path: root/src/core.py
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2012-10-12 15:29:45 +0000
committerFlorent Le Coz <louiz@louiz.org>2012-10-12 15:29:45 +0000
commit88da6869b4662520fe2181a69cbc9d96e50ea1de (patch)
treeef4bbdbab932caba94884761adb50d716e27e15e /src/core.py
parent2e8fc00f8b55537e6b4eb8a607afcc67fb27732d (diff)
downloadpoezio-88da6869b4662520fe2181a69cbc9d96e50ea1de.tar.gz
poezio-88da6869b4662520fe2181a69cbc9d96e50ea1de.tar.bz2
poezio-88da6869b4662520fe2181a69cbc9d96e50ea1de.tar.xz
poezio-88da6869b4662520fe2181a69cbc9d96e50ea1de.zip
When a message is corrected, display it correctly in place of the previous one.
Diffstat (limited to 'src/core.py')
-rw-r--r--src/core.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/core.py b/src/core.py
index 71e66175..fd212f88 100644
--- a/src/core.py
+++ b/src/core.py
@@ -2348,7 +2348,11 @@ class Core(object):
else:
delayed = False
date = None
- conversation._text_buffer.add_message(body, date, nickname=remote_nick, nick_color=get_theme().COLOR_REMOTE_USER, history=delayed)
+ replaced_id = message['replace']['id']
+ if replaced_id is not '':
+ conversation.modify_message(body, replaced_id, message['id'])
+ else:
+ conversation._text_buffer.add_message(body, date, nickname=remote_nick, nick_color=get_theme().COLOR_REMOTE_USER, history=delayed)
if conversation.remote_wants_chatstates is None and not delayed:
if message['chat_state']:
conversation.remote_wants_chatstates = True
@@ -2400,7 +2404,10 @@ class Core(object):
body = xhtml.get_body_from_message_stanza(message)
if body:
date = date if delayed == True else None
- if tab.add_message(body, date, nick_from, history=True if date else False):
+ replaced_id = message['replace']['id']
+ if replaced_id is not '':
+ tab.modify_message(body, replaced_id, message['id'])
+ elif tab.add_message(body, date, nick_from, history=True if date else False, identifier=message['id']):
self.events.trigger('highlight', message, tab)
if tab is self.current_tab():
tab.text_win.refresh()
@@ -2438,8 +2445,12 @@ class Core(object):
self.events.trigger('private_msg', message, tab)
if not body or not tab:
return
- tab.add_message(body, time=None, nickname=nick_from,
- forced_user=self.get_tab_by_name(room_from, tabs.MucTab).get_user_by_name(nick_from))
+ replaced_id = message['replace']['id']
+ if replaced_id is not '':
+ tab.modify_message(body, replaced_id, message['id'])
+ else:
+ tab.add_message(body, time=None, nickname=nick_from,
+ forced_user=self.get_tab_by_name(room_from, tabs.MucTab).get_user_by_name(nick_from))
conversation = self.get_tab_by_name(jid.full, tabs.PrivateTab)
if conversation and conversation.remote_wants_chatstates is None:
if message['chat_state']: