aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-27 08:31:57 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-06-14 00:04:04 +0800
commit830ced19dc7166bbb5aafba8db7d9dfc12e8aae2 (patch)
tree6cd797f06cbbb3186d19d3b9cfd181aedacce434 /libempathy
parente0dd22a058f51c159937ebf9a4af7edbd386b02f (diff)
downloadgsoc2013-empathy-830ced19dc7166bbb5aafba8db7d9dfc12e8aae2.tar
gsoc2013-empathy-830ced19dc7166bbb5aafba8db7d9dfc12e8aae2.tar.gz
gsoc2013-empathy-830ced19dc7166bbb5aafba8db7d9dfc12e8aae2.tar.bz2
gsoc2013-empathy-830ced19dc7166bbb5aafba8db7d9dfc12e8aae2.tar.lz
gsoc2013-empathy-830ced19dc7166bbb5aafba8db7d9dfc12e8aae2.tar.xz
gsoc2013-empathy-830ced19dc7166bbb5aafba8db7d9dfc12e8aae2.tar.zst
gsoc2013-empathy-830ced19dc7166bbb5aafba8db7d9dfc12e8aae2.zip
Update for new TPL API, we now get timestamp and edit_timestamp
This makes it backwards to what we get in Telepathy, but we can manage by translating it into the Telepathy form.
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-message.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index 949c05bd9..7864ee2ba 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -360,7 +360,7 @@ empathy_message_from_tpl_log_event (TplEvent *logevent)
const gchar *token = NULL, *supersedes = NULL;
EmpathyContact *contact;
TpChannelTextMessageType type = TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
- gint64 original_timestamp;
+ gint64 timestamp, original_timestamp = 0;
g_return_val_if_fail (TPL_IS_EVENT (logevent), NULL);
@@ -383,18 +383,32 @@ empathy_message_from_tpl_log_event (TplEvent *logevent)
if (TPL_IS_TEXT_EVENT (logevent)) {
TplTextEvent *textevent = TPL_TEXT_EVENT (logevent);
+ supersedes = tpl_text_event_get_supersedes_token (textevent);
+
+ /* tp-logger is kind of messy in that instead of having
+ * timestamp and original-timestamp like Telepathy it has
+ * timestamp (which is the original) and edited-timestamp,
+ * (which is when the message was edited) */
+ if (tp_str_empty (supersedes)) {
+ /* not an edited message */
+ timestamp = tpl_event_get_timestamp (logevent);
+ } else {
+ /* this is an edited event */
+ original_timestamp = tpl_event_get_timestamp (logevent);
+ timestamp = tpl_text_event_get_edit_timestamp (textevent);
+ }
+
body = g_strdup (tpl_text_event_get_message (textevent));
type = tpl_text_event_get_message_type (TPL_TEXT_EVENT (logevent));
token = tpl_text_event_get_message_token (textevent);
- supersedes = tpl_text_event_get_supersedes_token (textevent);
-
- original_timestamp = tpl_text_event_get_original_timestamp (textevent);
}
#ifdef HAVE_CALL_LOGS
else if (TPL_IS_CALL_EVENT (logevent)) {
TplCallEvent *call = TPL_CALL_EVENT (logevent);
+ timestamp = tpl_event_get_timestamp (logevent);
+
if (tpl_call_event_get_end_reason (call) == TPL_CALL_END_REASON_NO_ANSWER)
body = g_strdup_printf (_("Missed call from %s"),
tpl_entity_get_alias (tpl_event_get_sender (logevent)));
@@ -420,7 +434,7 @@ empathy_message_from_tpl_log_event (TplEvent *logevent)
"supersedes", supersedes,
"body", body,
"is-backlog", TRUE,
- "timestamp", tpl_event_get_timestamp (logevent),
+ "timestamp", timestamp,
"original-timestamp", original_timestamp,
NULL);