aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-folder.c79
1 files changed, 12 insertions, 67 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index a6953c524e..36136d452c 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -1658,51 +1658,6 @@ imap_update_summary (CamelFolder *folder,
imap_update_summary (folder, changes, recents, ex);
}
-struct _filter_timeout_data {
- CamelFolder *folder;
- GPtrArray *recents;
- guint timeout_id;
-};
-
-static gboolean
-imap_filter_timeout (gpointer user_data)
-{
- struct _filter_timeout_data *ftd = (struct _filter_timeout_data *) user_data;
- CamelFilterDriver *driver;
- CamelException ex;
- int i;
-
- camel_exception_init (&ex);
- driver = camel_session_get_filter_driver (CAMEL_SERVICE (ftd->folder->parent_store)->session,
- "incoming", &ex);
-
- if (driver) {
- camel_filter_driver_filter_folder (driver, ftd->folder, NULL,
- ftd->recents, FALSE, &ex);
-
- if (camel_exception_is_set (&ex))
- printf ("imap INBOX filter failed: %s\n",
- camel_exception_get_description (&ex));
-
- camel_object_unref (CAMEL_OBJECT (driver));
- } else
- printf ("imap INBOX filter failed: couldn't get filter driver: %s\n",
- camel_exception_get_description (&ex));
-
- camel_exception_clear (&ex);
- camel_object_unref ((CamelObject *) ftd->folder);
-
- for (i = 0; i < ftd->recents->len; i++)
- g_free (ftd->recents->pdata[i]);
-
- g_ptr_array_free (ftd->recents, TRUE);
-
- camel_session_remove_timeout (CAMEL_SERVICE (ftd->folder->parent_store)->session,
- ftd->timeout_id);
- g_free (user_data);
- return FALSE;
-}
-
/* Called with the store's command_lock locked */
void
camel_imap_folder_changed (CamelFolder *folder, int exists,
@@ -1753,28 +1708,18 @@ camel_imap_folder_changed (CamelFolder *folder, int exists,
if (recents) {
if (!camel_exception_is_set (ex) && recents->len) {
- /* is there any reason to protect against multiple
- * filters at once? */
-
- struct _filter_timeout_data *ftd;
- int i;
-
- ftd = (struct _filter_timeout_data *) g_malloc (sizeof (struct _filter_timeout_data));
- ftd->folder = folder;
- camel_object_ref ((CamelObject *) folder);
-
- /* Dup these in case they get removed */
-
- for (i = 0; i < recents->len; i++)
- recents->pdata[i] = g_strdup (recents->pdata[i]);
-
- ftd->recents = recents;
-
- /* interval must be > 1000 */
- ftd->timeout_id = camel_session_register_timeout (CAMEL_SERVICE (folder->parent_store)->session,
- 1001, imap_filter_timeout, ftd);
- } else
- g_ptr_array_free (recents, TRUE);
+ CamelFilterDriver *driver;
+
+ driver = camel_session_get_filter_driver (
+ CAMEL_SERVICE (folder->parent_store)->session,
+ "incoming", ex);
+ if (driver) {
+ camel_filter_driver_filter_folder (
+ driver, folder, NULL, recents, FALSE, ex);
+ camel_object_unref (CAMEL_OBJECT (driver));
+ }
+ }
+ g_ptr_array_free (recents, TRUE);
}
camel_folder_summary_save (folder->summary);