diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2009-03-06 19:53:32 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-03-06 19:53:32 +0800 |
commit | c536ae1e0e182ff7cd163bef87990b7e5c0cec21 (patch) | |
tree | bfe5d970caba05296f23c5df987db26fb3ac437b /libempathy | |
parent | 1ee8cd491f818dc13fc68b34d36e66119681fcbf (diff) | |
download | gsoc2013-empathy-c536ae1e0e182ff7cd163bef87990b7e5c0cec21.tar gsoc2013-empathy-c536ae1e0e182ff7cd163bef87990b7e5c0cec21.tar.gz gsoc2013-empathy-c536ae1e0e182ff7cd163bef87990b7e5c0cec21.tar.bz2 gsoc2013-empathy-c536ae1e0e182ff7cd163bef87990b7e5c0cec21.tar.lz gsoc2013-empathy-c536ae1e0e182ff7cd163bef87990b7e5c0cec21.tar.xz gsoc2013-empathy-c536ae1e0e182ff7cd163bef87990b7e5c0cec21.tar.zst gsoc2013-empathy-c536ae1e0e182ff7cd163bef87990b7e5c0cec21.zip |
Little optimization of log_store_empathy_get_filtered_messages() and add a FIXME.
From: Xavier Claessens <xclaesse@gmail.com>
svn path=/trunk/; revision=2619
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-log-store-empathy.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libempathy/empathy-log-store-empathy.c b/libempathy/empathy-log-store-empathy.c index 3a924aa53..15a0b2e51 100644 --- a/libempathy/empathy-log-store-empathy.c +++ b/libempathy/empathy-log-store-empathy.c @@ -719,13 +719,16 @@ log_store_empathy_get_filtered_messages (EmpathyLogStore *self, 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 @@ log_store_empathy_get_filtered_messages (EmpathyLogStore *self, 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); |