diff options
-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); |