aboutsummaryrefslogtreecommitdiffstats
path: root/libemail-engine/e-mail-utils.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-04-19 19:46:56 +0800
committerMilan Crha <mcrha@redhat.com>2012-04-19 19:46:56 +0800
commit785515dcbd70d041ce3da2e7ea2283e1e7d87a31 (patch)
treeb998898e8b2a9047107a32da946e0f605ffe4170 /libemail-engine/e-mail-utils.c
parentf95463a46e4077c90baed1b5543cd3efd5501b18 (diff)
downloadgsoc2013-evolution-785515dcbd70d041ce3da2e7ea2283e1e7d87a31.tar.gz
gsoc2013-evolution-785515dcbd70d041ce3da2e7ea2283e1e7d87a31.tar.zst
gsoc2013-evolution-785515dcbd70d041ce3da2e7ea2283e1e7d87a31.zip
Bug #465076 - INBOX confusion with outbox
Diffstat (limited to 'libemail-engine/e-mail-utils.c')
-rw-r--r--libemail-engine/e-mail-utils.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c
index e60e08aa3f..fcf24a8c57 100644
--- a/libemail-engine/e-mail-utils.c
+++ b/libemail-engine/e-mail-utils.c
@@ -128,6 +128,9 @@ em_utils_folder_is_drafts (CamelFolder *folder)
CamelFolder *local_drafts_folder;
CamelSession *session;
CamelStore *store;
+ MailFolderCache *cache;
+ EMailSession *mail_session;
+ CamelFolderInfoFlags flags = 0;
EAccountList *account_list;
EIterator *iterator;
gchar *folder_uri;
@@ -137,14 +140,22 @@ em_utils_folder_is_drafts (CamelFolder *folder)
store = camel_folder_get_parent_store (folder);
session = camel_service_get_session (CAMEL_SERVICE (store));
+ mail_session = E_MAIL_SESSION (session);
local_drafts_folder =
e_mail_session_get_local_folder (
- E_MAIL_SESSION (session), E_MAIL_LOCAL_FOLDER_DRAFTS);
+ mail_session, E_MAIL_LOCAL_FOLDER_DRAFTS);
if (folder == local_drafts_folder)
return TRUE;
+ cache = e_mail_session_get_folder_cache (mail_session);
+
+ /* user can select Inbox as his Draft folder - in that case prefer Inbox type */
+ if (mail_folder_cache_get_folder_info_flags (cache, folder, &flags) &&
+ (flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
+ return FALSE;
+
folder_uri = e_mail_folder_uri_from_folder (folder);
account_list = e_get_account_list ();
@@ -184,6 +195,9 @@ em_utils_folder_is_sent (CamelFolder *folder)
CamelFolder *local_sent_folder;
CamelSession *session;
CamelStore *store;
+ MailFolderCache *cache;
+ EMailSession *mail_session;
+ CamelFolderInfoFlags flags = 0;
EAccountList *account_list;
EIterator *iterator;
gchar *folder_uri;
@@ -193,14 +207,22 @@ em_utils_folder_is_sent (CamelFolder *folder)
store = camel_folder_get_parent_store (folder);
session = camel_service_get_session (CAMEL_SERVICE (store));
+ mail_session = E_MAIL_SESSION (session);
local_sent_folder =
e_mail_session_get_local_folder (
- E_MAIL_SESSION (session), E_MAIL_LOCAL_FOLDER_SENT);
+ mail_session, E_MAIL_LOCAL_FOLDER_SENT);
if (folder == local_sent_folder)
return TRUE;
+ cache = e_mail_session_get_folder_cache (mail_session);
+
+ /* user can select Inbox as his Sent folder - in that case prefer Inbox type */
+ if (mail_folder_cache_get_folder_info_flags (cache, folder, &flags) &&
+ (flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
+ return FALSE;
+
folder_uri = e_mail_folder_uri_from_folder (folder);
account_list = e_get_account_list ();