[empathy: 15/19] Update for new TPL API, we now get timestamp and edit_timestamp
- From: Danielle Madeley <daniellem src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy: 15/19] Update for new TPL API, we now get timestamp and edit_timestamp
- Date: Mon, 20 Jun 2011 10:09:11 +0000 (UTC)
commit 830ced19dc7166bbb5aafba8db7d9dfc12e8aae2
Author: Danielle Madeley <danielle madeley collabora co uk>
Date: Fri May 27 10:31:57 2011 +1000
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.
libempathy/empathy-message.c | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index 949c05b..7864ee2 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]