diff options
author | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-05-20 13:25:58 +0800 |
---|---|---|
committer | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-05-25 09:02:31 +0800 |
commit | 37ce3315fa4a2a1b12aaf78890b6fe12ab5c81a9 (patch) | |
tree | de86b8ab0b6d7ab68f82e13846ceb2279e0a4738 | |
parent | 24aaea403ecc327f8b7e8dfb8cd722c4a7196089 (diff) | |
download | gsoc2013-empathy-37ce3315fa4a2a1b12aaf78890b6fe12ab5c81a9.tar gsoc2013-empathy-37ce3315fa4a2a1b12aaf78890b6fe12ab5c81a9.tar.gz gsoc2013-empathy-37ce3315fa4a2a1b12aaf78890b6fe12ab5c81a9.tar.bz2 gsoc2013-empathy-37ce3315fa4a2a1b12aaf78890b6fe12ab5c81a9.tar.lz gsoc2013-empathy-37ce3315fa4a2a1b12aaf78890b6fe12ab5c81a9.tar.xz gsoc2013-empathy-37ce3315fa4a2a1b12aaf78890b6fe12ab5c81a9.tar.zst gsoc2013-empathy-37ce3315fa4a2a1b12aaf78890b6fe12ab5c81a9.zip |
Get the original message from the logger so we can supersede it
Strictly, we don't need to do this, we could just use the supersedes-token
as the message-token and we'd still be able to edit the messages in the future,
but this way we get the nice pretty annotation saying that we edited it and
when.
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 23 |
2 files changed, 23 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 6476dd513..2a60815c9 100644 --- a/configure.ac +++ b/configure.ac @@ -33,7 +33,7 @@ AC_COPYRIGHT([ # Hardp deps FOLKS_REQUIRED=0.4.0 GCONF_REQUIRED=1.2.0 -GLIB_REQUIRED=2.27.2 +GLIB_REQUIRED=2.28.0 GNUTLS_REQUIRED=2.8.5 GSTREAMER_REQUIRED=0.10.32 GTK_REQUIRED=2.22.0 diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 922fcfc86..8384b3ef1 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -38,6 +38,7 @@ #include <telepathy-glib/account-manager.h> #include <telepathy-glib/util.h> #include <telepathy-logger/log-manager.h> +#include <telepathy-logger/text-event.h> #include <libempathy/empathy-contact-list.h> #include <libempathy/empathy-gsettings.h> #include <libempathy/empathy-utils.h> @@ -2052,12 +2053,32 @@ got_filtered_messages_cb (GObject *manager, for (l = messages; l; l = g_list_next (l)) { EmpathyMessage *message; + GList *supersedes; g_assert (TPL_IS_EVENT (l->data)); + /* we need the last message this one supersedes, which is the + * the original */ + supersedes = tpl_text_event_dup_supersedes (l->data); + + if (supersedes != NULL) { + message = empathy_message_from_tpl_log_event ( + g_list_last (supersedes)->data); + empathy_chat_view_append_message (chat->view, message); + + g_object_unref (message); + } + + g_list_free_full (supersedes, g_object_unref); + + /* append the latest message */ message = empathy_message_from_tpl_log_event (l->data); g_object_unref (l->data); - empathy_chat_view_append_message (chat->view, message); + if (empathy_message_is_edit (message)) + empathy_chat_view_edit_message (chat->view, message); + else + empathy_chat_view_append_message (chat->view, message); + g_object_unref (message); } g_list_free (messages); |