From 2dfd548d26e179dfb12d836b57a88c215d76a926 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 8 Apr 2013 19:20:23 +0200 Subject: Bug #271262 - Allow Send/Receive of local stores in offline --- libemail-engine/mail-ops.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'libemail-engine/mail-ops.c') diff --git a/libemail-engine/mail-ops.c b/libemail-engine/mail-ops.c index 2084aa1e01..b54ac06e23 100644 --- a/libemail-engine/mail-ops.c +++ b/libemail-engine/mail-ops.c @@ -242,6 +242,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m, struct _filter_mail_msg *fm = (struct _filter_mail_msg *) m; GObjectClass *class; CamelFolder *folder = NULL; + CamelProvider *provider; CamelService *service; CamelSession *session; CamelSettings *settings; @@ -258,6 +259,11 @@ fetch_mail_exec (struct _fetch_mail_msg *m, service = CAMEL_SERVICE (m->store); session = camel_service_ref_session (service); + provider = camel_service_get_provider (service); + + if (provider && (provider->flags & CAMEL_PROVIDER_IS_REMOTE) != 0 && + !camel_session_get_online (session)) + goto exit; fm->destination = e_mail_session_get_local_folder ( E_MAIL_SESSION (session), E_MAIL_LOCAL_FOLDER_LOCAL_INBOX); @@ -265,9 +271,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m, goto exit; g_object_ref (fm->destination); - service = CAMEL_SERVICE (m->store); uid = camel_service_get_uid (service); - settings = camel_service_ref_settings (service); /* XXX This is a POP3-specific setting. */ @@ -703,6 +707,12 @@ mail_send_message (struct _send_queue_msg *m, } if (camel_address_length (recipients) > 0) { + if (provider && (provider->flags & CAMEL_PROVIDER_IS_REMOTE) != 0 && + !camel_session_get_online (CAMEL_SESSION (m->session))) { + /* silently ignore */ + goto exit; + } + if (!camel_service_connect_sync ( service, cancellable, error)) goto exit; -- cgit