diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/evolution-mail.schemas.in | 16 | ||||
-rw-r--r-- | 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 @@ </locale> </schema> + <schema> + <key>/schemas/apps/evolution/mail/filters/flush-outbox</key> + <applyto>/apps/evolution/mail/filters/flush-outbox</applyto> + <owner>evolution-mail</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Flush Outbox after filtering</short> + <long> + 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. + </long> + </locale> + </schema> + <!-- Format settings --> <schema> 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 |