diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-03-06 19:52:54 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-03-06 19:52:54 +0800 |
commit | 372dfdc6bc54f5005969a944708aee2e0d38b64b (patch) | |
tree | a9b283c61d1a8febd1ae35a4a7f2adbcb4327986 /libempathy | |
parent | 81a2b2be4616eecd70b122e5ca045f27d033dd4c (diff) | |
download | gsoc2013-empathy-372dfdc6bc54f5005969a944708aee2e0d38b64b.tar gsoc2013-empathy-372dfdc6bc54f5005969a944708aee2e0d38b64b.tar.gz gsoc2013-empathy-372dfdc6bc54f5005969a944708aee2e0d38b64b.tar.bz2 gsoc2013-empathy-372dfdc6bc54f5005969a944708aee2e0d38b64b.tar.lz gsoc2013-empathy-372dfdc6bc54f5005969a944708aee2e0d38b64b.tar.xz gsoc2013-empathy-372dfdc6bc54f5005969a944708aee2e0d38b64b.tar.zst gsoc2013-empathy-372dfdc6bc54f5005969a944708aee2e0d38b64b.zip |
Implemented get_filtered_messages in empathy log store.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
svn path=/trunk/; revision=2607
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-log-store-empathy.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libempathy/empathy-log-store-empathy.c b/libempathy/empathy-log-store-empathy.c index 8df57a2e2..8bae29685 100644 --- a/libempathy/empathy-log-store-empathy.c +++ b/libempathy/empathy-log-store-empathy.c @@ -709,6 +709,46 @@ log_store_empathy_get_name (EmpathyLogStore *self) return priv->name; } +static GList * +log_store_empathy_get_filtered_messages (EmpathyLogStore *self, + McAccount *account, + const gchar *chat_id, + gboolean chatroom, + guint num_messages, + EmpathyLogMessageFilter filter, + gpointer user_data) +{ + GList *dates, *l, *messages = NULL; + + 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)) + { + GList *new_messages, *n, *next; + + new_messages = log_store_empathy_get_messages_for_date (self, account, + chat_id, chatroom, l->data); + + n = new_messages; + while (n) + { + next = g_list_next (n); + if (!filter (n->data, user_data)) + { + g_object_unref (n->data); + new_messages = g_list_remove (new_messages, n->data); + } + n = next; + } + messages = g_list_concat (messages, new_messages); + } + + g_list_foreach (dates, (GFunc) g_free, NULL); + g_list_free (dates); + + return messages; +} + static void log_store_iface_init (gpointer g_iface, gpointer iface_data) @@ -723,4 +763,5 @@ log_store_iface_init (gpointer g_iface, iface->get_chats = log_store_empathy_get_chats; iface->search_new = log_store_empathy_search_new; iface->ack_message = NULL; + iface->get_filtered_messages = log_store_empathy_get_filtered_messages; } |