empathy r2619 - trunk/libempathy



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

Log:
Little optimization of log_store_empathy_get_filtered_messages() and add a FIXME.

From: Xavier Claessens <xclaesse gmail com>

Modified:
   trunk/libempathy/empathy-log-store-empathy.c

Modified: trunk/libempathy/empathy-log-store-empathy.c
==============================================================================
--- trunk/libempathy/empathy-log-store-empathy.c	(original)
+++ trunk/libempathy/empathy-log-store-empathy.c	Fri Mar  6 11:53:32 2009
@@ -719,13 +719,16 @@
                                          gpointer user_data)
 {
   GList *dates, *l, *messages = NULL;
+  guint i = 0;
 
   dates = log_store_empathy_get_dates (self, account, chat_id, chatroom);
 
-  for (l = g_list_last (dates); l && g_list_length (messages) < num_messages; l = g_list_previous (l))
+  for (l = g_list_last (dates); l && i < num_messages; l = g_list_previous (l))
     {
       GList *new_messages, *n, *next;
 
+      /* FIXME: We should really restrict the message parsing to get only
+       * the newest num_messages. */
       new_messages = log_store_empathy_get_messages_for_date (self, account,
           chat_id, chatroom, l->data);
 
@@ -738,6 +741,10 @@
               g_object_unref (n->data);
               new_messages = g_list_delete_link (new_messages, n);
             }
+          else
+            {
+              i++;
+            }
           n = next;
         }
       messages = g_list_concat (messages, new_messages);



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