aboutsummaryrefslogtreecommitdiffstats
path: root/libemail-engine
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-09-05 21:41:16 +0800
committerMilan Crha <mcrha@redhat.com>2012-09-05 21:42:03 +0800
commit511acab89a83114aad35e9c6f76a8f284907dab9 (patch)
tree4455567f90a3708dc43b172491388daf0f8c590e /libemail-engine
parent86c5e71225cda76616a5a5d5cfba46b84351b863 (diff)
downloadgsoc2013-evolution-511acab89a83114aad35e9c6f76a8f284907dab9.tar
gsoc2013-evolution-511acab89a83114aad35e9c6f76a8f284907dab9.tar.gz
gsoc2013-evolution-511acab89a83114aad35e9c6f76a8f284907dab9.tar.bz2
gsoc2013-evolution-511acab89a83114aad35e9c6f76a8f284907dab9.tar.lz
gsoc2013-evolution-511acab89a83114aad35e9c6f76a8f284907dab9.tar.xz
gsoc2013-evolution-511acab89a83114aad35e9c6f76a8f284907dab9.tar.zst
gsoc2013-evolution-511acab89a83114aad35e9c6f76a8f284907dab9.zip
Bug #682425 - Can do network operations on disabled accounts
Diffstat (limited to 'libemail-engine')
-rw-r--r--libemail-engine/e-mail-folder-utils.c7
-rw-r--r--libemail-engine/e-mail-utils.c38
-rw-r--r--libemail-engine/e-mail-utils.h3
3 files changed, 44 insertions, 4 deletions
diff --git a/libemail-engine/e-mail-folder-utils.c b/libemail-engine/e-mail-folder-utils.c
index 5d4fa2e2b1..971a67257f 100644
--- a/libemail-engine/e-mail-folder-utils.c
+++ b/libemail-engine/e-mail-folder-utils.c
@@ -29,6 +29,8 @@
#include <libemail-engine/e-mail-session.h>
#include <libemail-engine/mail-tools.h>
+#include "e-mail-utils.h"
+
/* X-Mailer header value */
#define X_MAILER ("Evolution " VERSION SUB_VERSION " " VERSION_COMMENT)
@@ -298,15 +300,14 @@ mail_folder_expunge_pop3_stores (CamelFolder *folder,
gboolean any_found = FALSE;
gboolean delete_expunged = FALSE;
gboolean keep_on_server = FALSE;
- gboolean enabled;
source_uid = e_source_get_uid (source);
- enabled = e_source_get_enabled (source);
extension = e_source_get_extension (source, extension_name);
backend_name = e_source_backend_get_backend_name (extension);
- if (!enabled || g_strcmp0 (backend_name, "pop") != 0)
+ if (!em_utils_is_source_enabled_with_parents (registry, source) ||
+ g_strcmp0 (backend_name, "pop") != 0)
continue;
service = camel_session_ref_service (
diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c
index d842b35fdb..8f91971866 100644
--- a/libemail-engine/e-mail-utils.c
+++ b/libemail-engine/e-mail-utils.c
@@ -1176,7 +1176,8 @@ second_preference:
for (iter = list; iter != NULL; iter = g_list_next (iter)) {
ESource *temp = E_SOURCE (iter->data);
- if (mail_account_in_recipients (registry, temp, recipients)) {
+ if (em_utils_is_source_enabled_with_parents (registry, temp) &&
+ mail_account_in_recipients (registry, temp, recipients)) {
source = g_object_ref (temp);
break;
}
@@ -1272,6 +1273,41 @@ em_utils_ref_mail_identity_for_store (ESourceRegistry *registry,
return source;
}
+gboolean
+em_utils_is_source_enabled_with_parents (ESourceRegistry *registry,
+ ESource *source)
+{
+ ESource *parent;
+ const gchar *parent_uid;
+
+ g_return_val_if_fail (registry != NULL, FALSE);
+ g_return_val_if_fail (source != NULL, FALSE);
+
+ if (!e_source_get_enabled (source))
+ return FALSE;
+
+ parent = g_object_ref (source);
+ while (parent_uid = e_source_get_parent (parent), parent_uid) {
+ ESource *next = e_source_registry_ref_source (registry, parent_uid);
+
+ if (!next)
+ break;
+
+ g_object_unref (parent);
+
+ if (!e_source_get_enabled (next)) {
+ g_object_unref (next);
+ return FALSE;
+ }
+
+ parent = next;
+ }
+
+ g_object_unref (parent);
+
+ return TRUE;
+}
+
/**
* em_utils_uids_free:
* @uids: array of uids
diff --git a/libemail-engine/e-mail-utils.h b/libemail-engine/e-mail-utils.h
index 1844b49e36..e7521d6e26 100644
--- a/libemail-engine/e-mail-utils.h
+++ b/libemail-engine/e-mail-utils.h
@@ -62,6 +62,9 @@ ESource * em_utils_guess_mail_identity_with_recipients
ESource * em_utils_ref_mail_identity_for_store
(ESourceRegistry *registry,
CamelStore *store);
+gboolean em_utils_is_source_enabled_with_parents
+ (ESourceRegistry *registry,
+ ESource *source);
void emu_remove_from_mail_cache (const GSList *addresses);
void emu_remove_from_mail_cache_1 (const gchar *address);
void emu_free_mail_cache (GDestroyNotify done_cb,