From 1837179f0253a133f9fd5636b9a4d347ba5d1201 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 7 Jun 2010 20:16:09 +0200 Subject: Bug #611100 - Forward-to filter stops at outbox --- mail/evolution-mail.schemas.in | 16 ++++++++++++++++ mail/mail-session.c | 27 +++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in index ad1dfdc27a..30ae3933a3 100644 --- a/mail/evolution-mail.schemas.in +++ b/mail/evolution-mail.schemas.in @@ -873,6 +873,22 @@ + + /schemas/apps/evolution/mail/filters/flush-outbox + /apps/evolution/mail/filters/flush-outbox + evolution-mail + bool + false + + Flush Outbox after filtering + + Whether to flush Outbox after filtering is done. Outbox flush will happen + only when there was used any 'Forward to' filter action and approximately + one minute after the last action invocation. + + + + diff --git a/mail/mail-session.c b/mail/mail-session.c index c4e1af7294..5e52aad86c 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -56,6 +56,7 @@ #include "mail-config.h" #include "mail-mt.h" #include "mail-ops.h" +#include "mail-send-recv.h" #include "mail-session.h" #include "mail-tools.h" @@ -649,13 +650,35 @@ ms_thread_status(CamelSession *session, CamelSessionThreadMsg *msg, const gchar printf("Thread status '%s' %d%%\n", text, pc); } +static gboolean +forward_to_flush_outbox_cb (gpointer data) +{ + guint *preparing_flush = data; + + g_return_val_if_fail (preparing_flush != NULL, FALSE); + + *preparing_flush = 0; + mail_send (); + + return FALSE; +} + static void ms_forward_to_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, gint queued, const gchar *appended_uid, gpointer data) { + static guint preparing_flush = 0; + camel_message_info_free (info); - /* do not call mail send, just pile them all in the outbox */ - /* mail_send (); */ + + /* do not call mail send immediately, just pile them all in the outbox */ + if (preparing_flush || + gconf_client_get_bool (mail_config_get_gconf_client (), "/apps/evolution/mail/filters/flush-outbox", NULL)) { + if (preparing_flush) + g_source_remove (preparing_flush); + + preparing_flush = g_timeout_add_seconds (60, forward_to_flush_outbox_cb, &preparing_flush); + } } static void -- cgit v1.2.3