[empathy: 3/14] Port libempathy to EmpathyAccount



commit 370bb92f2ce8ccd70bd694a6ab4ba78abeb448f9
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Fri Jun 26 14:42:42 2009 +0100

    Port libempathy to EmpathyAccount

 libempathy/empathy-chatroom-manager.c   |   18 ++++++++--------
 libempathy/empathy-chatroom-manager.h   |   11 ++++-----
 libempathy/empathy-chatroom.c           |   20 +++++++-----------
 libempathy/empathy-chatroom.h           |   11 ++++-----
 libempathy/empathy-contact.c            |   13 +++++------
 libempathy/empathy-contact.h            |    6 ++--
 libempathy/empathy-dispatch-operation.c |    4 ++-
 libempathy/empathy-dispatch-operation.h |    2 +
 libempathy/empathy-log-manager.c        |   15 ++++---------
 libempathy/empathy-log-manager.h        |   12 +++++-----
 libempathy/empathy-log-store-empathy.c  |   34 +++++++++++++++++-------------
 libempathy/empathy-log-store.c          |   12 +++++-----
 libempathy/empathy-log-store.h          |   26 +++++++++++-----------
 libempathy/empathy-utils.c              |   15 ++-----------
 libempathy/empathy-utils.h              |    1 -
 15 files changed, 93 insertions(+), 107 deletions(-)
---
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index 4441667..08c36d9 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -100,7 +100,8 @@ chatroom_manager_file_save (EmpathyChatroomManager *manager)
 			continue;
 		}
 
-		account_id = mc_account_get_unique_name (empathy_chatroom_get_account (chatroom));
+		account_id = empathy_account_get_unique_name (
+		  empathy_chatroom_get_account (chatroom));
 
 		node = xmlNewChild (root, NULL, "chatroom", NULL);
 		xmlNewTextChild (node, NULL, "name", empathy_chatroom_get_name (chatroom));
@@ -174,7 +175,7 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
 {
 	EmpathyChatroomManagerPriv *priv;
 	EmpathyChatroom            *chatroom;
-	McAccount                 *account;
+	EmpathyAccount             *account;
 	xmlNodePtr                 child;
 	gchar                     *str;
 	gchar                     *name;
@@ -220,7 +221,7 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
 		xmlFree (str);
 	}
 
-	account = mc_account_lookup (account_id);
+	account = empathy_account_manager_lookup (priv->account_manager, account_id);
 	if (!account) {
 		g_free (name);
 		g_free (room);
@@ -556,21 +557,20 @@ empathy_chatroom_manager_remove (EmpathyChatroomManager *manager,
 
 EmpathyChatroom *
 empathy_chatroom_manager_find (EmpathyChatroomManager *manager,
-                               McAccount *account,
+                               EmpathyAccount *account,
                                const gchar *room)
 {
 	EmpathyChatroomManagerPriv *priv;
 	GList                     *l;
 
 	g_return_val_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager), NULL);
-	g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
 	g_return_val_if_fail (room != NULL, NULL);
 
 	priv = GET_PRIV (manager);
 
 	for (l = priv->chatrooms; l; l = l->next) {
 		EmpathyChatroom *chatroom;
-		McAccount      *this_account;
+		EmpathyAccount *this_account;
 		const gchar    *this_room;
 
 		chatroom = l->data;
@@ -589,7 +589,7 @@ empathy_chatroom_manager_find (EmpathyChatroomManager *manager,
 
 GList *
 empathy_chatroom_manager_get_chatrooms (EmpathyChatroomManager *manager,
-				       McAccount             *account)
+				       EmpathyAccount *account)
 {
 	EmpathyChatroomManagerPriv *priv;
 	GList                     *chatrooms, *l;
@@ -619,7 +619,7 @@ empathy_chatroom_manager_get_chatrooms (EmpathyChatroomManager *manager,
 
 guint
 empathy_chatroom_manager_get_count (EmpathyChatroomManager *manager,
-				   McAccount             *account)
+				   EmpathyAccount *account)
 {
 	EmpathyChatroomManagerPriv *priv;
 	GList                     *l;
@@ -686,7 +686,7 @@ chatroom_manager_observe_channel_cb (EmpathyDispatcher *dispatcher,
   const gchar *roomname;
   GQuark channel_type;
   TpHandleType handle_type;
-  McAccount *account;
+  EmpathyAccount *account;
   TpConnection *connection;
 
   channel_type = empathy_dispatch_operation_get_channel_type_id (operation);
diff --git a/libempathy/empathy-chatroom-manager.h b/libempathy/empathy-chatroom-manager.h
index 76c71d9..a6038f7 100644
--- a/libempathy/empathy-chatroom-manager.h
+++ b/libempathy/empathy-chatroom-manager.h
@@ -27,8 +27,7 @@
 
 #include <glib-object.h>
 
-#include <libmissioncontrol/mc-account.h>
-
+#include "empathy-account.h"
 #include "empathy-chatroom.h"
 #include "empathy-dispatcher.h"
 
@@ -60,12 +59,12 @@ gboolean               empathy_chatroom_manager_add           (EmpathyChatroomMa
 void                   empathy_chatroom_manager_remove        (EmpathyChatroomManager *manager,
 							      EmpathyChatroom        *chatroom);
 EmpathyChatroom *       empathy_chatroom_manager_find          (EmpathyChatroomManager *manager,
-							      McAccount             *account,
-							      const gchar           *room);
+							      EmpathyAccount           *account,
+							      const gchar              *room);
 GList *                empathy_chatroom_manager_get_chatrooms (EmpathyChatroomManager *manager,
-							      McAccount             *account);
+							      EmpathyAccount          *account);
 guint                  empathy_chatroom_manager_get_count     (EmpathyChatroomManager *manager,
-							      McAccount             *account);
+							      EmpathyAccount          *account);
 void                   empathy_chatroom_manager_observe       (EmpathyChatroomManager *manager,
 							      EmpathyDispatcher *dispatcher);
 
diff --git a/libempathy/empathy-chatroom.c b/libempathy/empathy-chatroom.c
index 147fca0..b62d6ad 100644
--- a/libempathy/empathy-chatroom.c
+++ b/libempathy/empathy-chatroom.c
@@ -31,7 +31,7 @@
 
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyChatroom)
 typedef struct {
-	McAccount *account;
+	EmpathyAccount *account;
 	gchar     *room;
 	gchar     *name;
 	gboolean   auto_connect;
@@ -84,7 +84,7 @@ empathy_chatroom_class_init (EmpathyChatroomClass *klass)
 					 g_param_spec_object ("account",
 							      "Chatroom Account",
 							      "The account associated with an chatroom",
-							      MC_TYPE_ACCOUNT,
+							      EMPATHY_TYPE_ACCOUNT,
 							      G_PARAM_READWRITE));
 
 	g_object_class_install_property (object_class,
@@ -312,22 +312,19 @@ chatroom_set_property (GObject      *object,
 }
 
 EmpathyChatroom *
-empathy_chatroom_new (McAccount *account)
+empathy_chatroom_new (EmpathyAccount *account)
 {
-	g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
-
 	return g_object_new (EMPATHY_TYPE_CHATROOM,
 			     "account", account,
 			     NULL);
 }
 
 EmpathyChatroom *
-empathy_chatroom_new_full (McAccount   *account,
+empathy_chatroom_new_full (EmpathyAccount *account,
 			  const gchar *room,
 			  const gchar *name,
 			  gboolean     auto_connect)
 {
-	g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
 	g_return_val_if_fail (room != NULL, NULL);
 
 	return g_object_new (EMPATHY_TYPE_CHATROOM,
@@ -338,7 +335,7 @@ empathy_chatroom_new_full (McAccount   *account,
 			     NULL);
 }
 
-McAccount *
+EmpathyAccount *
 empathy_chatroom_get_account (EmpathyChatroom *chatroom)
 {
 	EmpathyChatroomPriv *priv;
@@ -351,12 +348,11 @@ empathy_chatroom_get_account (EmpathyChatroom *chatroom)
 
 void
 empathy_chatroom_set_account (EmpathyChatroom *chatroom,
-			     McAccount      *account)
+			     EmpathyAccount *account)
 {
 	EmpathyChatroomPriv *priv;
 
 	g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom));
-	g_return_if_fail (MC_IS_ACCOUNT (account));
 
 	priv = GET_PRIV (chatroom);
 
@@ -470,8 +466,8 @@ gboolean
 empathy_chatroom_equal (gconstpointer v1,
 		       gconstpointer v2)
 {
-	McAccount   *account_a;
-	McAccount   *account_b;
+	EmpathyAccount *account_a;
+	EmpathyAccount *account_b;
 	const gchar *room_a;
 	const gchar *room_b;
 
diff --git a/libempathy/empathy-chatroom.h b/libempathy/empathy-chatroom.h
index 560517d..c18c274 100644
--- a/libempathy/empathy-chatroom.h
+++ b/libempathy/empathy-chatroom.h
@@ -24,8 +24,7 @@
 
 #include <glib-object.h>
 
-#include <libmissioncontrol/mc-account.h>
-
+#include <libempathy/empathy-account.h>
 #include <libempathy/empathy-tp-chat.h>
 
 G_BEGIN_DECLS
@@ -52,14 +51,14 @@ struct _EmpathyChatroomClass {
 };
 
 GType            empathy_chatroom_get_type        (void) G_GNUC_CONST;
-EmpathyChatroom *empathy_chatroom_new             (McAccount       *account);
-EmpathyChatroom *empathy_chatroom_new_full        (McAccount       *account,
+EmpathyChatroom *empathy_chatroom_new             (EmpathyAccount  *account);
+EmpathyChatroom *empathy_chatroom_new_full        (EmpathyAccount  *account,
 						   const gchar     *room,
 						   const gchar     *name,
 						   gboolean         auto_connect);
-McAccount *     empathy_chatroom_get_account      (EmpathyChatroom *chatroom);
+EmpathyAccount *     empathy_chatroom_get_account      (EmpathyChatroom *chatroom);
 void            empathy_chatroom_set_account      (EmpathyChatroom *chatroom,
-						   McAccount       *account);
+						   EmpathyAccount  *account);
 const gchar *   empathy_chatroom_get_room         (EmpathyChatroom *chatroom);
 void            empathy_chatroom_set_room         (EmpathyChatroom *chatroom,
 						   const gchar     *room);
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index bad6ef4..d351aec 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -39,7 +39,7 @@
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContact)
 typedef struct {
   TpContact *tp_contact;
-  McAccount *account;
+  EmpathyAccount *account;
   gchar *id;
   gchar *name;
   EmpathyAvatar *avatar;
@@ -159,7 +159,7 @@ empathy_contact_class_init (EmpathyContactClass *class)
       g_param_spec_object ("account",
         "The account",
         "The account associated with the contact",
-        MC_TYPE_ACCOUNT,
+        EMPATHY_TYPE_ACCOUNT,
         G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (object_class,
@@ -409,12 +409,11 @@ empathy_contact_new (TpContact *tp_contact)
 }
 
 EmpathyContact *
-empathy_contact_new_for_log (McAccount *account,
+empathy_contact_new_for_log (EmpathyAccount *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,
@@ -554,7 +553,7 @@ empathy_contact_set_avatar (EmpathyContact *contact,
   g_object_notify (G_OBJECT (contact), "avatar");
 }
 
-McAccount *
+EmpathyAccount *
 empathy_contact_get_account (EmpathyContact *contact)
 {
   EmpathyContactPriv *priv;
@@ -830,7 +829,7 @@ static gchar *
 contact_get_avatar_filename (EmpathyContact *contact,
                              const gchar *token)
 {
-  McAccount *account;
+  EmpathyAccount *account;
   gchar *avatar_path;
   gchar *avatar_file;
   gchar *token_escaped;
@@ -847,7 +846,7 @@ contact_get_avatar_filename (EmpathyContact *contact,
   avatar_path = g_build_filename (g_get_user_cache_dir (),
       PACKAGE_NAME,
       "avatars",
-      mc_account_get_unique_name (account),
+      empathy_account_get_unique_name (account),
       contact_escaped,
       NULL);
   g_mkdir_with_parents (avatar_path, 0700);
diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h
index f888313..d4e3859 100644
--- a/libempathy/empathy-contact.h
+++ b/libempathy/empathy-contact.h
@@ -25,7 +25,7 @@
 #include <glib-object.h>
 
 #include <telepathy-glib/contact.h>
-#include <libmissioncontrol/mc-account.h>
+#include <libempathy/empathy-account.h>
 
 G_BEGIN_DECLS
 
@@ -70,7 +70,7 @@ typedef enum {
 
 GType empathy_contact_get_type (void) G_GNUC_CONST;
 EmpathyContact * empathy_contact_new (TpContact *tp_contact);
-EmpathyContact * empathy_contact_new_for_log (McAccount *account,
+EmpathyContact * empathy_contact_new_for_log (EmpathyAccount *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);
@@ -80,7 +80,7 @@ void empathy_contact_set_name (EmpathyContact *contact, const gchar *name);
 EmpathyAvatar * empathy_contact_get_avatar (EmpathyContact *contact);
 void empathy_contact_set_avatar (EmpathyContact *contact,
     EmpathyAvatar *avatar);
-McAccount * empathy_contact_get_account (EmpathyContact *contact);
+EmpathyAccount * empathy_contact_get_account (EmpathyContact *contact);
 TpConnection * empathy_contact_get_connection (EmpathyContact *contact);
 TpConnectionPresenceType empathy_contact_get_presence (EmpathyContact *contact);
 void empathy_contact_set_presence (EmpathyContact *contact,
diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c
index 7a116f8..79fe8c6 100644
--- a/libempathy/empathy-dispatch-operation.c
+++ b/libempathy/empathy-dispatch-operation.c
@@ -22,6 +22,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <telepathy-glib/interfaces.h>
+
 #include "empathy-dispatch-operation.h"
 #include <libempathy/empathy-enum-types.h>
 #include <libempathy/empathy-tp-contact-factory.h>
@@ -215,7 +217,7 @@ empathy_dispatch_operation_constructed (GObject *object)
 
   handle = tp_channel_get_handle (priv->channel, &handle_type);
 
-  if (handle_type == TP_CONN_HANDLE_TYPE_CONTACT && priv->contact == NULL)
+  if (handle_type == TP_HANDLE_TYPE_CONTACT && priv->contact == NULL)
     {
       EmpathyTpContactFactory *factory;
 
diff --git a/libempathy/empathy-dispatch-operation.h b/libempathy/empathy-dispatch-operation.h
index 84ed360..148adec 100644
--- a/libempathy/empathy-dispatch-operation.h
+++ b/libempathy/empathy-dispatch-operation.h
@@ -24,6 +24,8 @@
 #include <glib-object.h>
 
 #include <libempathy/empathy-contact.h>
+#include <telepathy-glib/connection.h>
+#include <telepathy-glib/channel.h>
 
 G_BEGIN_DECLS
 
diff --git a/libempathy/empathy-log-manager.c b/libempathy/empathy-log-manager.c
index b4c1f1a..c1e20f4 100644
--- a/libempathy/empathy-log-manager.c
+++ b/libempathy/empathy-log-manager.c
@@ -157,7 +157,7 @@ empathy_log_manager_add_message (EmpathyLogManager *manager,
 
 gboolean
 empathy_log_manager_exists (EmpathyLogManager *manager,
-                            McAccount *account,
+                            EmpathyAccount *account,
                             const gchar *chat_id,
                             gboolean chatroom)
 {
@@ -165,7 +165,6 @@ empathy_log_manager_exists (EmpathyLogManager *manager,
   EmpathyLogManagerPriv *priv;
 
   g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), FALSE);
-  g_return_val_if_fail (MC_IS_ACCOUNT (account), FALSE);
   g_return_val_if_fail (chat_id != NULL, FALSE);
 
   priv = GET_PRIV (manager);
@@ -182,7 +181,7 @@ empathy_log_manager_exists (EmpathyLogManager *manager,
 
 GList *
 empathy_log_manager_get_dates (EmpathyLogManager *manager,
-                               McAccount *account,
+                               EmpathyAccount *account,
                                const gchar *chat_id,
                                gboolean chatroom)
 {
@@ -190,7 +189,6 @@ empathy_log_manager_get_dates (EmpathyLogManager *manager,
   EmpathyLogManagerPriv *priv;
 
   g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
-  g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
   g_return_val_if_fail (chat_id != NULL, NULL);
 
   priv = GET_PRIV (manager);
@@ -219,7 +217,7 @@ empathy_log_manager_get_dates (EmpathyLogManager *manager,
 
 GList *
 empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager,
-                                           McAccount *account,
+                                           EmpathyAccount *account,
                                            const gchar *chat_id,
                                            gboolean chatroom,
                                            const gchar *date)
@@ -228,7 +226,6 @@ empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager,
   EmpathyLogManagerPriv *priv;
 
   g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
-  g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
   g_return_val_if_fail (chat_id != NULL, NULL);
 
   priv = GET_PRIV (manager);
@@ -261,7 +258,7 @@ log_manager_message_date_cmp (gconstpointer a,
 
 GList *
 empathy_log_manager_get_filtered_messages (EmpathyLogManager *manager,
-					   McAccount *account,
+					   EmpathyAccount *account,
 					   const gchar *chat_id,
 					   gboolean chatroom,
 					   guint num_messages,
@@ -274,7 +271,6 @@ empathy_log_manager_get_filtered_messages (EmpathyLogManager *manager,
   guint i = 0;
 
   g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
-  g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
   g_return_val_if_fail (chat_id != NULL, NULL);
 
   priv = GET_PRIV (manager);
@@ -322,13 +318,12 @@ empathy_log_manager_get_filtered_messages (EmpathyLogManager *manager,
 
 GList *
 empathy_log_manager_get_chats (EmpathyLogManager *manager,
-                               McAccount *account)
+                               EmpathyAccount *account)
 {
   GList *l, *out = NULL;
   EmpathyLogManagerPriv *priv;
 
   g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
-  g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
 
   priv = GET_PRIV (manager);
 
diff --git a/libempathy/empathy-log-manager.h b/libempathy/empathy-log-manager.h
index da7be4a..6907e2e 100644
--- a/libempathy/empathy-log-manager.h
+++ b/libempathy/empathy-log-manager.h
@@ -65,7 +65,7 @@ struct _EmpathyLogManagerClass
 
 struct _EmpathyLogSearchHit
 {
-  McAccount *account;
+  EmpathyAccount *account;
   gchar     *chat_id;
   gboolean   is_chatroom;
   gchar     *filename;
@@ -81,17 +81,17 @@ gboolean empathy_log_manager_add_message (EmpathyLogManager *manager,
     const gchar *chat_id, gboolean chatroom, EmpathyMessage *message,
     GError **error);
 gboolean empathy_log_manager_exists (EmpathyLogManager *manager,
-    McAccount *account, const gchar *chat_id, gboolean chatroom);
+    EmpathyAccount *account, const gchar *chat_id, gboolean chatroom);
 GList *empathy_log_manager_get_dates (EmpathyLogManager *manager,
-    McAccount *account, const gchar *chat_id, gboolean chatroom);
+    EmpathyAccount *account, const gchar *chat_id, gboolean chatroom);
 GList *empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager,
-    McAccount *account, const gchar *chat_id, gboolean chatroom,
+    EmpathyAccount *account, const gchar *chat_id, gboolean chatroom,
     const gchar *date);
 GList *empathy_log_manager_get_filtered_messages (EmpathyLogManager *manager,
-    McAccount *account, const gchar *chat_id, gboolean chatroom,
+    EmpathyAccount *account, const gchar *chat_id, gboolean chatroom,
     guint num_messages, EmpathyLogMessageFilter filter, gpointer user_data);
 GList *empathy_log_manager_get_chats (EmpathyLogManager *manager,
-    McAccount *account);
+    EmpathyAccount *account);
 GList *empathy_log_manager_search_new (EmpathyLogManager *manager,
     const gchar *text);
 void empathy_log_manager_search_free (GList *hits);
diff --git a/libempathy/empathy-log-store-empathy.c b/libempathy/empathy-log-store-empathy.c
index 94f4d14..7e50cb1 100644
--- a/libempathy/empathy-log-store-empathy.c
+++ b/libempathy/empathy-log-store-empathy.c
@@ -32,6 +32,7 @@
 #include "empathy-log-store.h"
 #include "empathy-log-store-empathy.h"
 #include "empathy-log-manager.h"
+#include "empathy-account-manager.h"
 #include "empathy-contact.h"
 #include "empathy-time.h"
 #include "empathy-utils.h"
@@ -59,6 +60,7 @@ typedef struct
 {
   gchar *basedir;
   gchar *name;
+  EmpathyAccountManager *account_manager;
 } EmpathyLogStoreEmpathyPriv;
 
 static void log_store_iface_init (gpointer g_iface,gpointer iface_data);
@@ -73,6 +75,7 @@ log_store_empathy_finalize (GObject *object)
   EmpathyLogStoreEmpathy *self = EMPATHY_LOG_STORE_EMPATHY (object);
   EmpathyLogStoreEmpathyPriv *priv = GET_PRIV (self);
 
+  g_object_unref (priv->account_manager);
   g_free (priv->basedir);
   g_free (priv->name);
 }
@@ -99,11 +102,12 @@ empathy_log_store_empathy_init (EmpathyLogStoreEmpathy *self)
       ".gnome2", PACKAGE_NAME, "logs", NULL);
 
   priv->name = g_strdup ("Empathy");
+  priv->account_manager = empathy_account_manager_dup_singleton ();
 }
 
 static gchar *
 log_store_empathy_get_dir (EmpathyLogStore *self,
-                           McAccount *account,
+                           EmpathyAccount *account,
                            const gchar *chat_id,
                            gboolean chatroom)
 {
@@ -113,7 +117,7 @@ log_store_empathy_get_dir (EmpathyLogStore *self,
 
   priv = GET_PRIV (self);
 
-  account_id = mc_account_get_unique_name (account);
+  account_id = empathy_account_get_unique_name (account);
 
   if (chatroom)
     basedir = g_build_path (G_DIR_SEPARATOR_S, priv->basedir, account_id,
@@ -154,7 +158,7 @@ log_store_empathy_get_timestamp_from_message (EmpathyMessage *message)
 
 static gchar *
 log_store_empathy_get_filename (EmpathyLogStore *self,
-                                McAccount *account,
+                                EmpathyAccount *account,
                                 const gchar *chat_id,
                                 gboolean chatroom)
 {
@@ -180,7 +184,7 @@ log_store_empathy_add_message (EmpathyLogStore *self,
                                GError **error)
 {
   FILE *file;
-  McAccount *account;
+  EmpathyAccount *account;
   EmpathyContact *sender;
   const gchar *body_str;
   const gchar *str;
@@ -267,7 +271,7 @@ log_store_empathy_add_message (EmpathyLogStore *self,
 
 static gboolean
 log_store_empathy_exists (EmpathyLogStore *self,
-                          McAccount *account,
+                          EmpathyAccount *account,
                           const gchar *chat_id,
                           gboolean chatroom)
 {
@@ -283,7 +287,7 @@ log_store_empathy_exists (EmpathyLogStore *self,
 
 static GList *
 log_store_empathy_get_dates (EmpathyLogStore *self,
-                             McAccount *account,
+                             EmpathyAccount *account,
                              const gchar *chat_id,
                              gboolean chatroom)
 {
@@ -295,7 +299,6 @@ log_store_empathy_get_dates (EmpathyLogStore *self,
   const gchar *p;
 
   g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
-  g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
   g_return_val_if_fail (chat_id != NULL, NULL);
 
   directory = log_store_empathy_get_dir (self, account, chat_id, chatroom);
@@ -336,7 +339,7 @@ log_store_empathy_get_dates (EmpathyLogStore *self,
 
 static gchar *
 log_store_empathy_get_filename_for_date (EmpathyLogStore *self,
-                                         McAccount *account,
+                                         EmpathyAccount *account,
                                          const gchar *chat_id,
                                          gboolean chatroom,
                                          const gchar *date)
@@ -359,6 +362,7 @@ static EmpathyLogSearchHit *
 log_store_empathy_search_hit_new (EmpathyLogStore *self,
                                   const gchar *filename)
 {
+  EmpathyLogStoreEmpathyPriv *priv = GET_PRIV (self);
   EmpathyLogSearchHit *hit;
   const gchar *account_name;
   const gchar *end;
@@ -383,7 +387,8 @@ log_store_empathy_search_hit_new (EmpathyLogStore *self,
   else
     account_name = strv[len-3];
 
-  hit->account = mc_account_lookup (account_name);
+  hit->account = empathy_account_manager_lookup (priv->account_manager,
+    account_name);
   hit->filename = g_strdup (filename);
 
   g_strfreev (strv);
@@ -401,7 +406,7 @@ log_store_empathy_get_messages_for_file (EmpathyLogStore *self,
   xmlNodePtr log_node;
   xmlNodePtr node;
   EmpathyLogSearchHit *hit;
-  McAccount *account;
+  EmpathyAccount *account;
 
   g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
   g_return_val_if_fail (filename != NULL, NULL);
@@ -666,7 +671,7 @@ log_store_empathy_get_chats_for_dir (EmpathyLogStore *self,
 
 static GList *
 log_store_empathy_get_messages_for_date (EmpathyLogStore *self,
-                                         McAccount *account,
+                                         EmpathyAccount *account,
                                          const gchar *chat_id,
                                          gboolean chatroom,
                                          const gchar *date)
@@ -675,7 +680,6 @@ log_store_empathy_get_messages_for_date (EmpathyLogStore *self,
   GList *messages;
 
   g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
-  g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
   g_return_val_if_fail (chat_id != NULL, NULL);
 
   filename = log_store_empathy_get_filename_for_date (self, account,
@@ -688,7 +692,7 @@ log_store_empathy_get_messages_for_date (EmpathyLogStore *self,
 
 static GList *
 log_store_empathy_get_chats (EmpathyLogStore *self,
-                              McAccount *account)
+                              EmpathyAccount *account)
 {
   gchar *dir;
   GList *hits;
@@ -697,7 +701,7 @@ log_store_empathy_get_chats (EmpathyLogStore *self,
   priv = GET_PRIV (self);
 
   dir = g_build_filename (priv->basedir,
-      mc_account_get_unique_name (account), NULL);
+      empathy_account_get_unique_name (account), NULL);
 
   hits = log_store_empathy_get_chats_for_dir (self, dir, FALSE);
 
@@ -716,7 +720,7 @@ log_store_empathy_get_name (EmpathyLogStore *self)
 
 static GList *
 log_store_empathy_get_filtered_messages (EmpathyLogStore *self,
-                                         McAccount *account,
+                                         EmpathyAccount *account,
                                          const gchar *chat_id,
                                          gboolean chatroom,
                                          guint num_messages,
diff --git a/libempathy/empathy-log-store.c b/libempathy/empathy-log-store.c
index 21a8815..f136f79 100644
--- a/libempathy/empathy-log-store.c
+++ b/libempathy/empathy-log-store.c
@@ -55,7 +55,7 @@ empathy_log_store_get_name (EmpathyLogStore *self)
 
 gboolean
 empathy_log_store_exists (EmpathyLogStore *self,
-                          McAccount *account,
+                          EmpathyAccount *account,
                           const gchar *chat_id,
                           gboolean chatroom)
 {
@@ -84,7 +84,7 @@ empathy_log_store_add_message (EmpathyLogStore *self,
 
 GList *
 empathy_log_store_get_dates (EmpathyLogStore *self,
-                             McAccount *account,
+                             EmpathyAccount *account,
                              const gchar *chat_id,
                              gboolean chatroom)
 {
@@ -97,7 +97,7 @@ empathy_log_store_get_dates (EmpathyLogStore *self,
 
 GList *
 empathy_log_store_get_messages_for_date (EmpathyLogStore *self,
-                                         McAccount *account,
+                                         EmpathyAccount *account,
                                          const gchar *chat_id,
                                          gboolean chatroom,
                                          const gchar *date)
@@ -111,7 +111,7 @@ empathy_log_store_get_messages_for_date (EmpathyLogStore *self,
 
 GList *
 empathy_log_store_get_last_messages (EmpathyLogStore *self,
-                                     McAccount *account,
+                                     EmpathyAccount *account,
                                      const gchar *chat_id,
                                      gboolean chatroom)
 {
@@ -124,7 +124,7 @@ empathy_log_store_get_last_messages (EmpathyLogStore *self,
 
 GList *
 empathy_log_store_get_chats (EmpathyLogStore *self,
-                             McAccount *account)
+                             EmpathyAccount *account)
 {
   if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_chats)
     return NULL;
@@ -157,7 +157,7 @@ empathy_log_store_ack_message (EmpathyLogStore *self,
 
 GList *
 empathy_log_store_get_filtered_messages (EmpathyLogStore *self,
-                                         McAccount *account,
+                                         EmpathyAccount *account,
                                          const gchar *chat_id,
                                          gboolean chatroom,
                                          guint num_messages,
diff --git a/libempathy/empathy-log-store.h b/libempathy/empathy-log-store.h
index db698c4..5b6a878 100644
--- a/libempathy/empathy-log-store.h
+++ b/libempathy/empathy-log-store.h
@@ -25,7 +25,7 @@
 
 #include <glib-object.h>
 
-#include <libmissioncontrol/mc-account.h>
+#include <libempathy/empathy-account.h>
 
 #include "empathy-message.h"
 #include "empathy-log-manager.h"
@@ -50,23 +50,23 @@ struct _EmpathyLogStoreInterface
   GTypeInterface parent;
 
   const gchar * (*get_name) (EmpathyLogStore *self);
-  gboolean (*exists) (EmpathyLogStore *self, McAccount *account,
+  gboolean (*exists) (EmpathyLogStore *self, EmpathyAccount *account,
       const gchar *chat_id, gboolean chatroom);
   gboolean (*add_message) (EmpathyLogStore *self, const gchar *chat_id,
       gboolean chatroom, EmpathyMessage *message, GError **error);
-  GList * (*get_dates) (EmpathyLogStore *self, McAccount *account,
+  GList * (*get_dates) (EmpathyLogStore *self, EmpathyAccount *account,
       const gchar *chat_id, gboolean chatroom);
   GList * (*get_messages_for_date) (EmpathyLogStore *self,
-      McAccount *account, const gchar *chat_id, gboolean chatroom,
+      EmpathyAccount *account, const gchar *chat_id, gboolean chatroom,
       const gchar *date);
-  GList * (*get_last_messages) (EmpathyLogStore *self, McAccount *account,
+  GList * (*get_last_messages) (EmpathyLogStore *self, EmpathyAccount *account,
       const gchar *chat_id, gboolean chatroom);
   GList * (*get_chats) (EmpathyLogStore *self,
-            McAccount         *account);
+            EmpathyAccount    *account);
   GList * (*search_new) (EmpathyLogStore *self, const gchar *text);
   void (*ack_message) (EmpathyLogStore *self, const gchar *chat_id,
       gboolean chatroom, EmpathyMessage *message);
-  GList * (*get_filtered_messages) (EmpathyLogStore *self, McAccount *account,
+  GList * (*get_filtered_messages) (EmpathyLogStore *self, EmpathyAccount *account,
       const gchar *chat_id, gboolean chatroom, guint num_messages,
       EmpathyLogMessageFilter filter, gpointer user_data);
 };
@@ -75,25 +75,25 @@ GType empathy_log_store_get_type (void) G_GNUC_CONST;
 
 const gchar *empathy_log_store_get_name (EmpathyLogStore *self);
 gboolean empathy_log_store_exists (EmpathyLogStore *self,
-    McAccount *account, const gchar *chat_id, gboolean chatroom);
+    EmpathyAccount *account, const gchar *chat_id, gboolean chatroom);
 gboolean empathy_log_store_add_message (EmpathyLogStore *self,
     const gchar *chat_id, gboolean chatroom, EmpathyMessage *message,
     GError **error);
 GList *empathy_log_store_get_dates (EmpathyLogStore *self,
-    McAccount *account, const gchar *chat_id, gboolean chatroom);
+    EmpathyAccount *account, const gchar *chat_id, gboolean chatroom);
 GList *empathy_log_store_get_messages_for_date (EmpathyLogStore *self,
-    McAccount *account, const gchar *chat_id, gboolean chatroom,
+    EmpathyAccount *account, const gchar *chat_id, gboolean chatroom,
     const gchar *date);
 GList *empathy_log_store_get_last_messages (EmpathyLogStore *self,
-    McAccount *account, const gchar *chat_id, gboolean chatroom);
+    EmpathyAccount *account, const gchar *chat_id, gboolean chatroom);
 GList *empathy_log_store_get_chats (EmpathyLogStore *self,
-    McAccount *account);
+    EmpathyAccount *account);
 GList *empathy_log_store_search_new (EmpathyLogStore *self,
     const gchar *text);
 void empathy_log_store_ack_message (EmpathyLogStore *self,
     const gchar *chat_id, gboolean chatroom, EmpathyMessage *message);
 GList *empathy_log_store_get_filtered_messages (EmpathyLogStore *self,
-    McAccount *account, const gchar *chat_id, gboolean chatroom,
+    EmpathyAccount *account, const gchar *chat_id, gboolean chatroom,
     guint num_messages, EmpathyLogMessageFilter filter, gpointer user_data);
 
 G_END_DECLS
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index fca7fcb..fd54c9a 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -230,25 +230,16 @@ empathy_xml_node_find_child_prop_value (xmlNodePtr   node,
 guint
 empathy_account_hash (gconstpointer key)
 {
-	g_return_val_if_fail (MC_IS_ACCOUNT (key), 0);
+	g_return_val_if_fail (EMPATHY_IS_ACCOUNT (key), 0);
 
-	return g_str_hash (mc_account_get_unique_name (MC_ACCOUNT (key)));
+	return g_str_hash (empathy_account_get_unique_name (EMPATHY_ACCOUNT (key)));
 }
 
 gboolean
 empathy_account_equal (gconstpointer a,
 		       gconstpointer b)
 {
-	const gchar *name_a;
-	const gchar *name_b;
-
-	g_return_val_if_fail (MC_IS_ACCOUNT (a), FALSE);
-	g_return_val_if_fail (MC_IS_ACCOUNT (b), FALSE);
-
-	name_a = mc_account_get_unique_name (MC_ACCOUNT (a));
-	name_b = mc_account_get_unique_name (MC_ACCOUNT (b));
-
-	return g_str_equal (name_a, name_b);
+  return a == b;
 }
 
 MissionControl *
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index de1437b..42acbc8 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -32,7 +32,6 @@
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
-#include <libmissioncontrol/mc-account.h>
 #include <libmissioncontrol/mission-control.h>
 
 #include "empathy-contact.h"



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