]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-message.c
Merge branch 'sasl'
[empathy.git] / libempathy / empathy-message.c
index ab9e95d375a24a9d065f30e7e7ada18682837ae5..ca3b020ac9f793d1d8a73231f3e38a2c3c66b83f 100644 (file)
 #include <string.h>
 
 #include <telepathy-glib/util.h>
-#ifdef ENABLE_TPL
 #include <telepathy-glib/account.h>
 #include <telepathy-glib/account-manager.h>
 
 #include <telepathy-logger/entity.h>
 #include <telepathy-logger/entry.h>
 #include <telepathy-logger/entry-text.h>
-#endif /* ENABLE_TPL */
 
 #include "empathy-message.h"
 #include "empathy-utils.h"
@@ -260,7 +258,6 @@ empathy_message_new (const gchar *body)
                             NULL);
 }
 
-#ifdef ENABLE_TPL
 EmpathyMessage *
 empathy_message_from_tpl_log_entry (TplEntry *logentry)
 {
@@ -270,6 +267,7 @@ empathy_message_from_tpl_log_entry (TplEntry *logentry)
        TplEntity *receiver = NULL;
        TplEntity *sender = NULL;
        gchar *body= NULL;
+       EmpathyContact *contact;
 
        g_return_val_if_fail (TPL_IS_ENTRY (logentry), NULL);
 
@@ -306,24 +304,28 @@ empathy_message_from_tpl_log_entry (TplEntry *logentry)
        sender = tpl_entry_get_sender (logentry);
 
        retval = empathy_message_new (body);
-       if (receiver != NULL)
-               empathy_message_set_receiver (retval,
-                               empathy_contact_from_tpl_contact (account, receiver));
-       if (sender != NULL)
-               empathy_message_set_sender (retval,
-                               empathy_contact_from_tpl_contact (account, sender));
+       if (receiver != NULL) {
+               contact = empathy_contact_from_tpl_contact (account, receiver);
+               empathy_message_set_receiver (retval, contact);
+               g_object_unref (contact);
+       }
+
+       if (sender != NULL) {
+               contact = empathy_contact_from_tpl_contact (account, sender);
+               empathy_message_set_sender (retval, contact);
+               g_object_unref (contact);
+       }
 
        empathy_message_set_timestamp (retval,
                        tpl_entry_get_timestamp (logentry));
        empathy_message_set_id (retval,
                        tpl_entry_text_get_pending_msg_id (TPL_ENTRY_TEXT (logentry)));
-       empathy_message_set_is_backlog (retval, FALSE);
+       empathy_message_set_is_backlog (retval, TRUE);
 
        g_free (body);
 
        return retval;
 }
-#endif /* ENABLE_TPL */
 
 TpChannelTextMessageType
 empathy_message_get_tptype (EmpathyMessage *message)
@@ -534,7 +536,7 @@ empathy_message_should_highlight (EmpathyMessage *message)
                return FALSE;
        }
 
-       to = empathy_contact_get_name (contact);
+       to = empathy_contact_get_alias (contact);
        if (!to) {
                return FALSE;
        }
@@ -607,6 +609,9 @@ empathy_message_type_to_str (TpChannelTextMessageType type)
                return "notice";
        case TP_CHANNEL_TEXT_MESSAGE_TYPE_AUTO_REPLY:
                return "auto-reply";
+       case TP_CHANNEL_TEXT_MESSAGE_TYPE_DELIVERY_REPORT:
+               return "delivery-report";
+       case TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL:
        default:
                return "normal";
        }