empathy r2579 - trunk/libempathy



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

Log:
Made get_last_messages source independent. (Jonny Lamb)

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

Modified:
   trunk/libempathy/empathy-log-manager.c
   trunk/libempathy/empathy-log-source-empathy.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:51:21 2009
@@ -246,29 +246,25 @@
                                        const gchar *chat_id,
                                        gboolean chatroom)
 {
-  GList *l, *out = NULL;
-  EmpathyLogManagerPriv *priv;
+  GList *messages = NULL;
+  GList *dates;
+  GList *l;
 
   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);
+  dates = empathy_log_manager_get_dates (manager, account, chat_id, chatroom);
 
-  for (l = priv->sources; l; l = l->next)
-    {
-      EmpathyLogSource *source = (EmpathyLogSource *) l->data;
+  l = g_list_last (dates);
+  if (l)
+    messages = empathy_log_manager_get_messages_for_date (manager, account,
+        chat_id, chatroom, l->data);
 
-      if (!source->get_last_messages)
-        continue;
-
-      if (!out)
-        out = source->get_last_messages (manager, account, chat_id, chatroom);
-      else
-        out = g_list_concat (out, source->get_last_messages (manager, account, chat_id, chatroom));
-    }
+  g_list_foreach (dates, (GFunc) g_free, NULL);
+  g_list_free (dates);
 
-  return out;
+  return messages;
 }
 
 GList *

Modified: trunk/libempathy/empathy-log-source-empathy.c
==============================================================================
--- trunk/libempathy/empathy-log-source-empathy.c	(original)
+++ trunk/libempathy/empathy-log-source-empathy.c	Fri Mar  6 11:51:21 2009
@@ -624,33 +624,6 @@
 }
 
 static GList *
-log_source_empathy_get_last_messages (EmpathyLogManager *manager,
-                                      McAccount *account,
-                                      const gchar *chat_id,
-                                      gboolean chatroom)
-{
-  GList *messages = NULL;
-  GList *dates;
-  GList *l;
-
-  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);
-
-  dates = log_source_empathy_get_dates (manager, account, chat_id, chatroom);
-
-  l = g_list_last (dates);
-  if (l)
-    messages = log_source_empathy_get_messages_for_date (manager, account,
-        chat_id, chatroom, l->data);
-
-  g_list_foreach (dates, (GFunc) g_free, NULL);
-  g_list_free (dates);
-
-  return messages;
-}
-
-static GList *
 log_source_empathy_get_chats (EmpathyLogManager *manager,
                               McAccount *account)
 {
@@ -679,7 +652,6 @@
   source->exists = log_source_empathy_exists;
   source->add_message = log_source_empathy_add_message;
   source->get_dates = log_source_empathy_get_dates;
-  source->get_last_messages = log_source_empathy_get_last_messages;
   source->get_messages_for_date = log_source_empathy_get_messages_for_date;
   source->get_chats = log_source_empathy_get_chats;
   source->search_new = log_source_empathy_search_new;



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