empathy r2607 - trunk/libempathy
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r2607 - trunk/libempathy
- Date: Fri, 6 Mar 2009 11:52:54 +0000 (UTC)
Author: xclaesse
Date: Fri Mar 6 11:52:54 2009
New Revision: 2607
URL: http://svn.gnome.org/viewvc/empathy?rev=2607&view=rev
Log:
Implemented get_filtered_messages in empathy log store.
Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>
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:52:54 2009
@@ -709,6 +709,46 @@
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 @@
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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]