empathy r2593 - trunk/libempathy



Author: xclaesse
Date: Fri Mar  6 11:52:08 2009
New Revision: 2593
URL: http://svn.gnome.org/viewvc/empathy?rev=2593&view=rev

Log:
Renamed EmpathyLogSource to EmpathyLogStore.

Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>

Added:
   trunk/libempathy/empathy-log-store-empathy.c
      - copied, changed from r2592, /trunk/libempathy/empathy-log-source-empathy.c
   trunk/libempathy/empathy-log-store-empathy.h
   trunk/libempathy/empathy-log-store.c
   trunk/libempathy/empathy-log-store.h
Removed:
   trunk/libempathy/empathy-log-source-empathy.c
   trunk/libempathy/empathy-log-source.c
   trunk/libempathy/empathy-log-source.h
Modified:
   trunk/libempathy/Makefile.am
   trunk/libempathy/empathy-log-manager.c

Modified: trunk/libempathy/Makefile.am
==============================================================================
--- trunk/libempathy/Makefile.am	(original)
+++ trunk/libempathy/Makefile.am	Fri Mar  6 11:52:08 2009
@@ -36,8 +36,8 @@
 	empathy-irc-network-manager.c			\
 	empathy-irc-server.c				\
 	empathy-log-manager.c				\
-	empathy-log-source.c				\
-	empathy-log-source-empathy.c			\
+	empathy-log-store.c				\
+	empathy-log-store-empathy.c			\
 	empathy-message.c				\
 	empathy-status-presets.c			\
 	empathy-time.c					\

Modified: trunk/libempathy/empathy-log-manager.c
==============================================================================
--- trunk/libempathy/empathy-log-manager.c	(original)
+++ trunk/libempathy/empathy-log-manager.c	Fri Mar  6 11:52:08 2009
@@ -31,8 +31,8 @@
 #include <telepathy-glib/util.h>
 
 #include "empathy-log-manager.h"
-#include "empathy-log-source-empathy.h"
-#include "empathy-log-source.h"
+#include "empathy-log-store-empathy.h"
+#include "empathy-log-store.h"
 #include "empathy-tp-chat.h"
 #include "empathy-utils.h"
 
@@ -42,7 +42,7 @@
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyLogManager)
 typedef struct
 {
-  GList *sources;
+  GList *stores;
 } EmpathyLogManagerPriv;
 
 G_DEFINE_TYPE (EmpathyLogManager, empathy_log_manager, G_TYPE_OBJECT);
@@ -57,13 +57,13 @@
 
   priv = GET_PRIV (object);
 
-  for (l = priv->sources; l; l = l->next)
+  for (l = priv->stores; l; l = l->next)
     {
-      EmpathyLogSource *source = (EmpathyLogSource *) l->data;
-      g_object_unref (source);
+      EmpathyLogStore *store = (EmpathyLogStore *) l->data;
+      g_object_unref (store);
     }
 
-  g_list_free (priv->sources);
+  g_list_free (priv->stores);
 }
 
 static GObject *
@@ -111,8 +111,8 @@
   EmpathyLogManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
       EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManagerPriv);
 
-  priv->sources = g_list_append (priv->sources,
-      g_object_new (EMPATHY_TYPE_LOG_SOURCE_EMPATHY, NULL));
+  priv->stores = g_list_append (priv->stores,
+      g_object_new (EMPATHY_TYPE_LOG_STORE_EMPATHY, NULL));
 
   manager->priv = priv;
 }
@@ -135,9 +135,9 @@
   gboolean out = FALSE;
   gboolean found = FALSE;
 
-  /* TODO: When multiple log sources appear with add_message implementations
+  /* TODO: When multiple log stores appear with add_message implementations
    * make this customisable. */
-  const gchar *add_source = "Empathy";
+  const gchar *add_store = "Empathy";
 
   g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), FALSE);
   g_return_val_if_fail (chat_id != NULL, FALSE);
@@ -145,12 +145,12 @@
 
   priv = GET_PRIV (manager);
 
-  for (l = priv->sources; l; l = l->next)
+  for (l = priv->stores; l; l = l->next)
     {
-      if (!tp_strdiff (empathy_log_source_get_name (
-              EMPATHY_LOG_SOURCE (l->data)), add_source))
+      if (!tp_strdiff (empathy_log_store_get_name (
+              EMPATHY_LOG_STORE (l->data)), add_store))
         {
-          out = empathy_log_source_add_message (EMPATHY_LOG_SOURCE (l->data),
+          out = empathy_log_store_add_message (EMPATHY_LOG_STORE (l->data),
               chat_id, chatroom, message, error);
           found = TRUE;
           break;
@@ -158,7 +158,7 @@
     }
 
   if (!found)
-    DEBUG ("Failed to find chosen log source to write to.");
+    DEBUG ("Failed to find chosen log store to write to.");
 
   return out;
 }
@@ -178,9 +178,9 @@
 
   priv = GET_PRIV (manager);
 
-  for (l = priv->sources; l; l = l->next)
+  for (l = priv->stores; l; l = l->next)
     {
-      if (empathy_log_source_exists (EMPATHY_LOG_SOURCE (l->data),
+      if (empathy_log_store_exists (EMPATHY_LOG_STORE (l->data),
             account, chat_id, chatroom))
         return TRUE;
     }
@@ -214,15 +214,15 @@
 
   priv = GET_PRIV (manager);
 
-  for (l = priv->sources; l; l = l->next)
+  for (l = priv->stores; l; l = l->next)
     {
-      EmpathyLogSource *source = EMPATHY_LOG_SOURCE (l->data);
+      EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
 
       if (!out)
-        out = empathy_log_source_get_dates (source, account, chat_id, chatroom);
+        out = empathy_log_store_get_dates (store, account, chat_id, chatroom);
       else
         {
-          GList *new = empathy_log_source_get_dates (source, account, chat_id,
+          GList *new = empathy_log_store_get_dates (store, account, chat_id,
               chatroom);
           g_list_foreach (new, log_manager_get_dates_foreach, out);
 
@@ -253,12 +253,12 @@
 
   priv = GET_PRIV (manager);
 
-  for (l = priv->sources; l; l = l->next)
+  for (l = priv->stores; l; l = l->next)
     {
-      EmpathyLogSource *source = EMPATHY_LOG_SOURCE (l->data);
+      EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
 
-      out = g_list_concat (out, empathy_log_source_get_messages_for_date (
-          source, account, chat_id, chatroom, date));
+      out = g_list_concat (out, empathy_log_store_get_messages_for_date (
+          store, account, chat_id, chatroom, date));
     }
 
   return out;
@@ -303,12 +303,12 @@
 
   priv = GET_PRIV (manager);
 
-  for (l = priv->sources; l; l = l->next)
+  for (l = priv->stores; l; l = l->next)
     {
-      EmpathyLogSource *source = EMPATHY_LOG_SOURCE (l->data);
+      EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
 
       out = g_list_concat (out,
-          empathy_log_source_get_chats (source, account));
+          empathy_log_store_get_chats (store, account));
     }
 
   return out;
@@ -326,12 +326,12 @@
 
   priv = GET_PRIV (manager);
 
-  for (l = priv->sources; l; l = l->next)
+  for (l = priv->stores; l; l = l->next)
     {
-      EmpathyLogSource *source = EMPATHY_LOG_SOURCE (l->data);
+      EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
 
       out = g_list_concat (out,
-          empathy_log_source_search_new (source, text));
+          empathy_log_store_search_new (store, text));
     }
 
   return out;

Copied: trunk/libempathy/empathy-log-store-empathy.c (from r2592, /trunk/libempathy/empathy-log-source-empathy.c)
==============================================================================
--- /trunk/libempathy/empathy-log-source-empathy.c	(original)
+++ trunk/libempathy/empathy-log-store-empathy.c	Fri Mar  6 11:52:08 2009
@@ -29,8 +29,8 @@
 #include <stdlib.h>
 #include <glib/gstdio.h>
 
-#include "empathy-log-source.h"
-#include "empathy-log-source-empathy.h"
+#include "empathy-log-store.h"
+#include "empathy-log-store-empathy.h"
 #include "empathy-log-manager.h"
 #include "empathy-contact.h"
 #include "empathy-time.h"
@@ -54,44 +54,44 @@
     "</log>\n"
 
 
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyLogSourceEmpathy)
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyLogStoreEmpathy)
 typedef struct
 {
   gchar *basedir;
   gchar *name;
-} EmpathyLogSourceEmpathyPriv;
+} EmpathyLogStoreEmpathyPriv;
 
-static void log_source_iface_init (gpointer g_iface,gpointer iface_data);
+static void log_store_iface_init (gpointer g_iface,gpointer iface_data);
 
-G_DEFINE_TYPE_WITH_CODE (EmpathyLogSourceEmpathy, empathy_log_source_empathy,
-    G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (EMPATHY_TYPE_LOG_SOURCE,
-      log_source_iface_init));
+G_DEFINE_TYPE_WITH_CODE (EmpathyLogStoreEmpathy, empathy_log_store_empathy,
+    G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (EMPATHY_TYPE_LOG_STORE,
+      log_store_iface_init));
 
 static void
-log_source_empathy_finalize (GObject *object)
+log_store_empathy_finalize (GObject *object)
 {
-  EmpathyLogSourceEmpathy *self = EMPATHY_LOG_SOURCE_EMPATHY (object);
-  EmpathyLogSourceEmpathyPriv *priv = GET_PRIV (self);
+  EmpathyLogStoreEmpathy *self = EMPATHY_LOG_STORE_EMPATHY (object);
+  EmpathyLogStoreEmpathyPriv *priv = GET_PRIV (self);
 
   g_free (priv->basedir);
   g_free (priv->name);
 }
 
 static void
-empathy_log_source_empathy_class_init (EmpathyLogSourceEmpathyClass *klass)
+empathy_log_store_empathy_class_init (EmpathyLogStoreEmpathyClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  object_class->finalize = log_source_empathy_finalize;
+  object_class->finalize = log_store_empathy_finalize;
 
-  g_type_class_add_private (object_class, sizeof (EmpathyLogSourceEmpathyPriv));
+  g_type_class_add_private (object_class, sizeof (EmpathyLogStoreEmpathyPriv));
 }
 
 static void
-empathy_log_source_empathy_init (EmpathyLogSourceEmpathy *self)
+empathy_log_store_empathy_init (EmpathyLogStoreEmpathy *self)
 {
-  EmpathyLogSourceEmpathyPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      EMPATHY_TYPE_LOG_SOURCE_EMPATHY, EmpathyLogSourceEmpathyPriv);
+  EmpathyLogStoreEmpathyPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+      EMPATHY_TYPE_LOG_STORE_EMPATHY, EmpathyLogStoreEmpathyPriv);
 
   self->priv = priv;
 
@@ -102,14 +102,14 @@
 }
 
 static gchar *
-log_source_empathy_get_dir (EmpathyLogSource *self,
-                            McAccount *account,
-                            const gchar *chat_id,
-                            gboolean chatroom)
+log_store_empathy_get_dir (EmpathyLogStore *self,
+                           McAccount *account,
+                           const gchar *chat_id,
+                           gboolean chatroom)
 {
   const gchar *account_id;
   gchar *basedir;
-  EmpathyLogSourceEmpathyPriv *priv;
+  EmpathyLogStoreEmpathyPriv *priv;
 
   priv = GET_PRIV (self);
 
@@ -126,7 +126,7 @@
 }
 
 static gchar *
-log_source_empathy_get_timestamp_filename (void)
+log_store_empathy_get_timestamp_filename (void)
 {
   time_t t;
   gchar *time_str;
@@ -142,7 +142,7 @@
 }
 
 static gchar *
-log_source_empathy_get_timestamp_from_message (EmpathyMessage *message)
+log_store_empathy_get_timestamp_from_message (EmpathyMessage *message)
 {
   time_t t;
 
@@ -153,17 +153,17 @@
 }
 
 static gchar *
-log_source_empathy_get_filename (EmpathyLogSource *self,
-                                 McAccount *account,
-                                 const gchar *chat_id,
-                                 gboolean chatroom)
+log_store_empathy_get_filename (EmpathyLogStore *self,
+                                McAccount *account,
+                                const gchar *chat_id,
+                                gboolean chatroom)
 {
   gchar *basedir;
   gchar *timestamp;
   gchar *filename;
 
-  basedir = log_source_empathy_get_dir (self, account, chat_id, chatroom);
-  timestamp = log_source_empathy_get_timestamp_filename ();
+  basedir = log_store_empathy_get_dir (self, account, chat_id, chatroom);
+  timestamp = log_store_empathy_get_timestamp_filename ();
   filename = g_build_filename (basedir, timestamp, NULL);
 
   g_free (basedir);
@@ -173,11 +173,11 @@
 }
 
 static gboolean
-log_source_empathy_add_message (EmpathyLogSource *self,
-                                const gchar *chat_id,
-                                gboolean chatroom,
-                                EmpathyMessage *message,
-                                GError **error)
+log_store_empathy_add_message (EmpathyLogStore *self,
+                               const gchar *chat_id,
+                               gboolean chatroom,
+                               EmpathyMessage *message,
+                               GError **error)
 {
   FILE *file;
   McAccount *account;
@@ -194,7 +194,7 @@
   gchar *contact_id;
   TpChannelTextMessageType msg_type;
 
-  g_return_val_if_fail (EMPATHY_IS_LOG_SOURCE (self), FALSE);
+  g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), FALSE);
   g_return_val_if_fail (chat_id != NULL, FALSE);
   g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), FALSE);
 
@@ -206,7 +206,7 @@
   if (G_STR_EMPTY (body_str))
     return FALSE;
 
-  filename = log_source_empathy_get_filename (self, account, chat_id, chatroom);
+  filename = log_store_empathy_get_filename (self, account, chat_id, chatroom);
   basedir = g_path_get_dirname (filename);
   if (!g_file_test (basedir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
     {
@@ -233,7 +233,7 @@
     }
 
   body = g_markup_escape_text (body_str, -1);
-  timestamp = log_source_empathy_get_timestamp_from_message (message);
+  timestamp = log_store_empathy_get_timestamp_from_message (message);
 
   str = empathy_contact_get_name (sender);
   contact_name = g_markup_escape_text (str, -1);
@@ -264,15 +264,15 @@
 }
 
 static gboolean
-log_source_empathy_exists (EmpathyLogSource *self,
-                           McAccount *account,
-                           const gchar *chat_id,
-                           gboolean chatroom)
+log_store_empathy_exists (EmpathyLogStore *self,
+                          McAccount *account,
+                          const gchar *chat_id,
+                          gboolean chatroom)
 {
   gchar *dir;
   gboolean exists;
 
-  dir = log_source_empathy_get_dir (self, account, chat_id, chatroom);
+  dir = log_store_empathy_get_dir (self, account, chat_id, chatroom);
   exists = g_file_test (dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR);
   g_free (dir);
 
@@ -280,10 +280,10 @@
 }
 
 static GList *
-log_source_empathy_get_dates (EmpathyLogSource *self,
-                              McAccount *account,
-                              const gchar *chat_id,
-                              gboolean chatroom)
+log_store_empathy_get_dates (EmpathyLogStore *self,
+                             McAccount *account,
+                             const gchar *chat_id,
+                             gboolean chatroom)
 {
   GList *dates = NULL;
   gchar *date;
@@ -292,11 +292,11 @@
   const gchar *filename;
   const gchar *p;
 
-  g_return_val_if_fail (EMPATHY_IS_LOG_SOURCE (self), NULL);
+  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_source_empathy_get_dir (self, account, chat_id, chatroom);
+  directory = log_store_empathy_get_dir (self, account, chat_id, chatroom);
   dir = g_dir_open (directory, 0, NULL);
   if (!dir)
     {
@@ -333,17 +333,17 @@
 }
 
 static gchar *
-log_source_empathy_get_filename_for_date (EmpathyLogSource *self,
-                                          McAccount *account,
-                                          const gchar *chat_id,
-                                          gboolean chatroom,
-                                          const gchar *date)
+log_store_empathy_get_filename_for_date (EmpathyLogStore *self,
+                                         McAccount *account,
+                                         const gchar *chat_id,
+                                         gboolean chatroom,
+                                         const gchar *date)
 {
   gchar *basedir;
   gchar *timestamp;
   gchar *filename;
 
-  basedir = log_source_empathy_get_dir (self, account, chat_id, chatroom);
+  basedir = log_store_empathy_get_dir (self, account, chat_id, chatroom);
   timestamp = g_strconcat (date, LOG_FILENAME_SUFFIX, NULL);
   filename = g_build_filename (basedir, timestamp, NULL);
 
@@ -354,8 +354,8 @@
 }
 
 static EmpathyLogSearchHit *
-log_source_empathy_search_hit_new (EmpathyLogSource *self,
-                                   const gchar *filename)
+log_store_empathy_search_hit_new (EmpathyLogStore *self,
+                                  const gchar *filename)
 {
   EmpathyLogSearchHit *hit;
   const gchar *account_name;
@@ -390,8 +390,8 @@
 }
 
 static GList *
-log_source_empathy_get_messages_for_file (EmpathyLogSource *self,
-                                          const gchar *filename)
+log_store_empathy_get_messages_for_file (EmpathyLogStore *self,
+                                         const gchar *filename)
 {
   GList *messages = NULL;
   xmlParserCtxtPtr ctxt;
@@ -401,7 +401,7 @@
   EmpathyLogSearchHit *hit;
   McAccount *account;
 
-  g_return_val_if_fail (EMPATHY_IS_LOG_SOURCE (self), NULL);
+  g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
   g_return_val_if_fail (filename != NULL, NULL);
 
   DEBUG ("Attempting to parse filename:'%s'...", filename);
@@ -413,7 +413,7 @@
     }
 
   /* Get the account from the filename */
-  hit = log_source_empathy_search_hit_new (self, filename);
+  hit = log_store_empathy_search_hit_new (self, filename);
   account = g_object_ref (hit->account);
   empathy_log_manager_search_hit_free (hit);
 
@@ -504,14 +504,14 @@
 }
 
 static GList *
-log_source_empathy_get_all_files (EmpathyLogSource *self,
-                                  const gchar *dir)
+log_store_empathy_get_all_files (EmpathyLogStore *self,
+                                 const gchar *dir)
 {
   GDir *gdir;
   GList *files = NULL;
   const gchar *name;
   const gchar *basedir;
-  EmpathyLogSourceEmpathyPriv *priv;
+  EmpathyLogStoreEmpathyPriv *priv;
 
   priv = GET_PRIV (self);
 
@@ -536,7 +536,7 @@
         {
           /* Recursively get all log files */
           files = g_list_concat (files,
-              log_source_empathy_get_all_files (self, filename));
+              log_store_empathy_get_all_files (self, filename));
         }
 
       g_free (filename);
@@ -548,19 +548,19 @@
 }
 
 static GList *
-log_source_empathy_search_new (EmpathyLogSource *self,
-                               const gchar *text)
+log_store_empathy_search_new (EmpathyLogStore *self,
+                              const gchar *text)
 {
   GList *files, *l;
   GList *hits = NULL;
   gchar *text_casefold;
 
-  g_return_val_if_fail (EMPATHY_IS_LOG_SOURCE (self), NULL);
+  g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
   g_return_val_if_fail (!G_STR_EMPTY (text), NULL);
 
   text_casefold = g_utf8_casefold (text, -1);
 
-  files = log_source_empathy_get_all_files (self, NULL);
+  files = log_store_empathy_get_all_files (self, NULL);
   DEBUG ("Found %d log files in total", g_list_length (files));
 
   for (l = files; l; l = l->next)
@@ -587,7 +587,7 @@
         {
           EmpathyLogSearchHit *hit;
 
-          hit = log_source_empathy_search_hit_new (self, filename);
+          hit = log_store_empathy_search_hit_new (self, filename);
 
           if (hit)
             {
@@ -608,9 +608,9 @@
 }
 
 static GList *
-log_source_empathy_get_chats_for_dir (EmpathyLogSource *self,
-                                      const gchar *dir,
-                                      gboolean is_chatroom)
+log_store_empathy_get_chats_for_dir (EmpathyLogStore *self,
+                                     const gchar *dir,
+                                     gboolean is_chatroom)
 {
   GDir *gdir;
   GList *hits = NULL;
@@ -628,7 +628,7 @@
       filename = g_build_filename (dir, name, NULL);
       if (strcmp (name, LOG_DIR_CHATROOMS) == 0)
         {
-          hits = g_list_concat (hits, log_source_empathy_get_chats_for_dir (
+          hits = g_list_concat (hits, log_store_empathy_get_chats_for_dir (
                 self, dir, TRUE));
           g_free (filename);
           continue;
@@ -648,41 +648,41 @@
 
 
 static GList *
-log_source_empathy_get_messages_for_date (EmpathyLogSource *self,
-                                          McAccount *account,
-                                          const gchar *chat_id,
-                                          gboolean chatroom,
-                                          const gchar *date)
+log_store_empathy_get_messages_for_date (EmpathyLogStore *self,
+                                         McAccount *account,
+                                         const gchar *chat_id,
+                                         gboolean chatroom,
+                                         const gchar *date)
 {
   gchar *filename;
   GList *messages;
 
-  g_return_val_if_fail (EMPATHY_IS_LOG_SOURCE (self), NULL);
+  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_source_empathy_get_filename_for_date (self, account,
+  filename = log_store_empathy_get_filename_for_date (self, account,
       chat_id, chatroom, date);
-  messages = log_source_empathy_get_messages_for_file (self, filename);
+  messages = log_store_empathy_get_messages_for_file (self, filename);
   g_free (filename);
 
   return messages;
 }
 
 static GList *
-log_source_empathy_get_chats (EmpathyLogSource *self,
+log_store_empathy_get_chats (EmpathyLogStore *self,
                               McAccount *account)
 {
   gchar *dir;
   GList *hits;
-  EmpathyLogSourceEmpathyPriv *priv;
+  EmpathyLogStoreEmpathyPriv *priv;
 
   priv = GET_PRIV (self);
 
   dir = g_build_filename (priv->basedir,
       mc_account_get_unique_name (account), NULL);
 
-  hits = log_source_empathy_get_chats_for_dir (self, dir, FALSE);
+  hits = log_store_empathy_get_chats_for_dir (self, dir, FALSE);
 
   g_free (dir);
 
@@ -690,25 +690,25 @@
 }
 
 static const gchar *
-log_source_empathy_get_name (EmpathyLogSource *self)
+log_store_empathy_get_name (EmpathyLogStore *self)
 {
-  EmpathyLogSourceEmpathyPriv *priv = GET_PRIV (self);
+  EmpathyLogStoreEmpathyPriv *priv = GET_PRIV (self);
 
   return priv->name;
 }
 
 static void
-log_source_iface_init (gpointer g_iface,
-                       gpointer iface_data)
+log_store_iface_init (gpointer g_iface,
+                      gpointer iface_data)
 {
-  EmpathyLogSourceInterface *iface = (EmpathyLogSourceInterface *) g_iface;
+  EmpathyLogStoreInterface *iface = (EmpathyLogStoreInterface *) g_iface;
 
-  iface->get_name = log_source_empathy_get_name;
-  iface->exists = log_source_empathy_exists;
-  iface->add_message = log_source_empathy_add_message;
-  iface->get_dates = log_source_empathy_get_dates;
-  iface->get_messages_for_date = log_source_empathy_get_messages_for_date;
-  iface->get_chats = log_source_empathy_get_chats;
-  iface->search_new = log_source_empathy_search_new;
+  iface->get_name = log_store_empathy_get_name;
+  iface->exists = log_store_empathy_exists;
+  iface->add_message = log_store_empathy_add_message;
+  iface->get_dates = log_store_empathy_get_dates;
+  iface->get_messages_for_date = log_store_empathy_get_messages_for_date;
+  iface->get_chats = log_store_empathy_get_chats;
+  iface->search_new = log_store_empathy_search_new;
   iface->ack_message = NULL;
 }

Added: trunk/libempathy/empathy-log-store-empathy.h
==============================================================================
--- (empty file)
+++ trunk/libempathy/empathy-log-store-empathy.h	Fri Mar  6 11:52:08 2009
@@ -0,0 +1,66 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003-2007 Imendio AB
+ * Copyright (C) 2007-2008 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Xavier Claessens <xclaesse gmail com>
+ *          Jonny Lamb <jonny lamb collabora co uk>
+ */
+
+#ifndef __EMPATHY_LOG_STORE_EMPATHY_H__
+#define __EMPATHY_LOG_STORE_EMPATHY_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#define EMPATHY_TYPE_LOG_STORE_EMPATHY \
+  (empathy_log_store_empathy_get_type ())
+#define EMPATHY_LOG_STORE_EMPATHY(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMPATHY_TYPE_LOG_STORE_EMPATHY, \
+                               EmpathyLogStoreEmpathy))
+#define EMPATHY_LOG_STORE_EMPATHY_CLASS(vtable) \
+  (G_TYPE_CHECK_CLASS_CAST ((vtable), EMPATHY_TYPE_LOG_STORE_EMPATHY, \
+                            EmpathyLogStoreEmpathyClass))
+#define EMPATHY_IS_LOG_STORE_EMPATHY(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_LOG_STORE_EMPATHY))
+#define EMPATHY_IS_LOG_STORE_EMPATHY_CLASS(vtable) \
+  (G_TYPE_CHECK_CLASS_TYPE ((vtable), EMPATHY_TYPE_LOG_STORE_EMPATHY))
+#define EMPATHY_LOG_STORE_EMPATHY_GET_CLASS(inst) \
+  (G_TYPE_INSTANCE_GET_CLASS ((inst), EMPATHY_TYPE_LOG_STORE_EMPATHY, \
+                              EmpathyLogStoreEmpathyClass))
+
+typedef struct _EmpathyLogStoreEmpathy EmpathyLogStoreEmpathy;
+typedef struct _EmpathyLogStoreEmpathyClass EmpathyLogStoreEmpathyClass;
+
+struct _EmpathyLogStoreEmpathy
+{
+  GObject parent;
+  gpointer priv;
+};
+
+struct _EmpathyLogStoreEmpathyClass
+{
+  GObjectClass parent;
+};
+
+GType empathy_log_store_empathy_get_type (void);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_LOG_STORE_EMPATHY_H__ */

Added: trunk/libempathy/empathy-log-store.c
==============================================================================
--- (empty file)
+++ trunk/libempathy/empathy-log-store.c	Fri Mar  6 11:52:08 2009
@@ -0,0 +1,156 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Jonny Lamb <jonny lamb collabora co uk>
+ */
+
+#include "empathy-log-store.h"
+
+GType
+empathy_log_store_get_type (void)
+{
+  static GType type = 0;
+  if (type == 0) {
+    static const GTypeInfo info = {
+      sizeof (EmpathyLogStoreInterface),
+      NULL,   /* base_init */
+      NULL,   /* base_finalize */
+      NULL,   /* class_init */
+      NULL,   /* class_finalize */
+      NULL,   /* class_data */
+      0,
+      0,      /* n_preallocs */
+      NULL    /* instance_init */
+    };
+    type = g_type_register_static (G_TYPE_INTERFACE, "EmpathyLogStore",
+        &info, 0);
+  }
+  return type;
+}
+
+const gchar *
+empathy_log_store_get_name (EmpathyLogStore *self)
+{
+  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_name)
+    return NULL;
+
+  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_name (self);
+}
+
+gboolean
+empathy_log_store_exists (EmpathyLogStore *self,
+                          McAccount *account,
+                          const gchar *chat_id,
+                          gboolean chatroom)
+{
+  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->exists)
+    return FALSE;
+
+  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->exists (
+      self, account, chat_id, chatroom);
+}
+
+
+
+gboolean
+empathy_log_store_add_message (EmpathyLogStore *self,
+                               const gchar *chat_id,
+                               gboolean chatroom,
+                               EmpathyMessage *message,
+                               GError **error)
+{
+  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->add_message)
+    return FALSE;
+
+  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->add_message (
+      self, chat_id, chatroom, message, error);
+}
+
+GList *
+empathy_log_store_get_dates (EmpathyLogStore *self,
+                             McAccount *account,
+                             const gchar *chat_id,
+                             gboolean chatroom)
+{
+  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_dates)
+    return NULL;
+
+  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_dates (
+      self, account, chat_id, chatroom);
+}
+
+GList *
+empathy_log_store_get_messages_for_date (EmpathyLogStore *self,
+                                         McAccount *account,
+                                         const gchar *chat_id,
+                                         gboolean chatroom,
+                                         const gchar *date)
+{
+  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_messages_for_date)
+    return NULL;
+
+  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_messages_for_date (
+      self, account, chat_id, chatroom, date);
+}
+
+GList *
+empathy_log_store_get_last_messages (EmpathyLogStore *self,
+                                     McAccount *account,
+                                     const gchar *chat_id,
+                                     gboolean chatroom)
+{
+  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_last_messages)
+    return NULL;
+
+  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_last_messages (
+      self, account, chat_id, chatroom);
+}
+
+GList *
+empathy_log_store_get_chats (EmpathyLogStore *self,
+                             McAccount *account)
+{
+  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_chats)
+    return NULL;
+
+  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_chats (self, account);
+}
+
+GList *
+empathy_log_store_search_new (EmpathyLogStore *self,
+                              const gchar *text)
+{
+  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->search_new)
+    return NULL;
+
+  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->search_new (self, text);
+}
+
+void
+empathy_log_store_ack_message (EmpathyLogStore *self,
+                               const gchar *chat_id,
+                               gboolean chatroom,
+                               EmpathyMessage *message)
+{
+  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->ack_message)
+    return;
+
+  EMPATHY_LOG_STORE_GET_INTERFACE (self)->ack_message (
+      self, chat_id, chatroom, message);
+}

Added: trunk/libempathy/empathy-log-store.h
==============================================================================
--- (empty file)
+++ trunk/libempathy/empathy-log-store.h	Fri Mar  6 11:52:08 2009
@@ -0,0 +1,94 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Jonny Lamb <jonny lamb collabora co uk>
+ */
+
+#ifndef __EMPATHY_LOG_STORE_H__
+#define __EMPATHY_LOG_STORE_H__
+
+#include <glib-object.h>
+
+#include <libmissioncontrol/mc-account.h>
+
+#include "empathy-message.h"
+
+G_BEGIN_DECLS
+
+#define EMPATHY_TYPE_LOG_STORE (empathy_log_store_get_type ())
+#define EMPATHY_LOG_STORE(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMPATHY_TYPE_LOG_STORE, \
+                               EmpathyLogStore))
+#define EMPATHY_IS_LOG_STORE(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_LOG_STORE))
+#define EMPATHY_LOG_STORE_GET_INTERFACE(inst) \
+  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EMPATHY_TYPE_LOG_STORE, \
+                                  EmpathyLogStoreInterface))
+
+typedef struct _EmpathyLogStore EmpathyLogStore; /* dummy object */
+typedef struct _EmpathyLogStoreInterface EmpathyLogStoreInterface;
+
+struct _EmpathyLogStoreInterface
+{
+  GTypeInterface parent;
+
+  const gchar * (*get_name) (EmpathyLogStore *self);
+  gboolean (*exists) (EmpathyLogStore *self, McAccount *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,
+      const gchar *chat_id, gboolean chatroom);
+  GList * (*get_messages_for_date) (EmpathyLogStore *self,
+      McAccount *account, const gchar *chat_id, gboolean chatroom,
+      const gchar *date);
+  GList * (*get_last_messages) (EmpathyLogStore *self, McAccount *account,
+      const gchar *chat_id, gboolean chatroom);
+  GList * (*get_chats) (EmpathyLogStore *self,
+            McAccount         *account);
+  GList * (*search_new) (EmpathyLogStore *self, const gchar *text);
+  void (*ack_message) (EmpathyLogStore *self, const gchar *chat_id,
+      gboolean chatroom, EmpathyMessage *message);
+};
+
+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);
+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);
+GList *empathy_log_store_get_messages_for_date (EmpathyLogStore *self,
+    McAccount *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);
+GList *empathy_log_store_get_chats (EmpathyLogStore *self,
+    McAccount *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);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_LOG_STORE_H__ */



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