aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-message.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index 322fb2df9..15999dcdd 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -309,11 +309,12 @@ empathy_message_from_tpl_log_event (TplEvent *logevent)
body = g_strdup (tpl_text_event_get_message (
TPL_TEXT_EVENT (logevent)));
- retval = empathy_message_new (body);
-
- empathy_message_set_tptype (retval,
- tpl_text_event_get_message_type (TPL_TEXT_EVENT (logevent)));
- empathy_message_set_is_backlog (retval, TRUE);
+ retval = g_object_new (EMPATHY_TYPE_MESSAGE,
+ "type", tpl_text_event_get_message_type (TPL_TEXT_EVENT (logevent)),
+ "body", body,
+ "timestamp", tpl_event_get_timestamp (logevent),
+ "is-backlog", TRUE,
+ NULL);
g_free (body);
} else if (TPL_IS_CALL_EVENT (logevent)) {
@@ -328,20 +329,18 @@ empathy_message_from_tpl_log_event (TplEvent *logevent)
body = g_strdup_printf (_("Call from %s"),
tpl_entity_get_alias (tpl_event_get_sender (logevent)));
- retval = empathy_message_new (body);
+ retval = g_object_new (EMPATHY_TYPE_MESSAGE,
+ "body", body,
+ "timestamp", tpl_event_get_timestamp (logevent),
+ NULL);
g_free (body);
+ } else {
+ return NULL;
}
receiver = tpl_event_get_receiver (logevent);
sender = tpl_event_get_sender (logevent);
- retval = g_object_new (EMPATHY_TYPE_MESSAGE,
- "type", tpl_text_event_get_message_type (TPL_TEXT_EVENT (logevent)),
- "body", body,
- "is-backlog", TRUE,
- "timestamp", tpl_event_get_timestamp (logevent),
- NULL);
-
if (receiver != NULL) {
contact = empathy_contact_from_tpl_contact (account, receiver);
empathy_message_set_receiver (retval, contact);
@@ -354,8 +353,6 @@ empathy_message_from_tpl_log_event (TplEvent *logevent)
g_object_unref (contact);
}
- g_free (body);
-
return retval;
}