[empathy] Add empathy_contact_new_static() to create a contact that comes from logs



commit 65ed272fef1016fff3403024e3417491ecf30015
Author: Xavier Claessens <xclaesse gmail com>
Date:   Tue Apr 21 00:43:41 2009 +0200

    Add empathy_contact_new_static() to create a contact that comes from logs
---
 libempathy/empathy-contact.c           |   17 +++++++++++++++++
 libempathy/empathy-contact.h           |    2 ++
 libempathy/empathy-log-store-empathy.c |    9 +++------
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 813982b..27f3ff9 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -388,6 +388,23 @@ empathy_contact_new (TpContact *tp_contact)
       NULL);
 }
 
+EmpathyContact *
+empathy_contact_new_static (McAccount *account,
+                            const gchar *id,
+                            const gchar *name,
+                            gboolean is_user)
+{
+  g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
+  g_return_val_if_fail (id != NULL, NULL);
+
+  return g_object_new (EMPATHY_TYPE_CONTACT,
+      "account", account,
+      "id", id,
+      "name", name,
+      "is-user", is_user,
+      NULL);
+}
+
 TpContact *
 empathy_contact_get_tp_contact (EmpathyContact *contact)
 {
diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h
index 11f329e..0fab904 100644
--- a/libempathy/empathy-contact.h
+++ b/libempathy/empathy-contact.h
@@ -68,6 +68,8 @@ typedef enum {
 
 GType empathy_contact_get_type (void) G_GNUC_CONST;
 EmpathyContact * empathy_contact_new (TpContact *tp_contact);
+EmpathyContact * empathy_contact_new_static (McAccount *account,
+    const gchar *id, const gchar *name, gboolean is_user);
 TpContact * empathy_contact_get_tp_contact (EmpathyContact *contact);
 const gchar * empathy_contact_get_id (EmpathyContact *contact);
 void empathy_contact_set_id (EmpathyContact *contact, const gchar *id);
diff --git a/libempathy/empathy-log-store-empathy.c b/libempathy/empathy-log-store-empathy.c
index d431e0d..6485d00 100644
--- a/libempathy/empathy-log-store-empathy.c
+++ b/libempathy/empathy-log-store-empathy.c
@@ -481,12 +481,9 @@ log_store_empathy_get_messages_for_file (EmpathyLogStore *self,
 
       t = empathy_time_parse (time);
 
-      sender = g_object_new (EMPATHY_TYPE_CONTACT,
-          "account", account,
-          "id", sender_id,
-          "name", sender_name,
-          "is-user", is_user,
-          NULL);
+      sender = empathy_contact_new_static (account, sender_id, sender_name,
+      					   is_user);
+
       if (!EMP_STR_EMPTY (sender_avatar_token))
         empathy_contact_load_avatar_cache (sender,
             sender_avatar_token);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]