aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-tools.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail-tools.c')
-rw-r--r--mail/mail-tools.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 96ef278567..383060d2b8 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -93,16 +93,24 @@ mail_tool_get_inbox (const gchar *url, CamelException *ex)
}
CamelFolder *
-mail_tool_get_trash (const gchar *url, CamelException *ex)
+mail_tool_get_trash (const gchar *url, int connect, CamelException *ex)
{
CamelStore *store;
CamelFolder *trash;
-
- store = camel_session_get_store (session, url, ex);
+
+ if (connect)
+ store = camel_session_get_store (session, url, ex);
+ else
+ store = (CamelStore *)camel_session_get_service(session, url, CAMEL_PROVIDER_STORE, ex);
+
if (!store)
return NULL;
- trash = camel_store_get_trash (store, ex);
+ if (connect || ((CamelService *)store)->status == CAMEL_SERVICE_CONNECTED)
+ trash = camel_store_get_trash (store, ex);
+ else
+ trash = NULL;
+
camel_object_unref (CAMEL_OBJECT (store));
return trash;