aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c53
1 files changed, 36 insertions, 17 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 4f310db812..d1116395b6 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -57,11 +57,11 @@
#include <libedataserver/e-data-server-util.h>
#include "e-util/e-util.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-util-private.h"
#include "em-filter-rule.h"
#include "em-utils.h"
-#include "mail-component.h"
#include "mail-config.h"
#include "mail-mt.h"
#include "mail-ops.h"
@@ -69,6 +69,8 @@
#include "mail-tools.h"
#include "mail-vfolder.h"
+#include "e-mail-shell-backend.h"
+
#define w(x)
#define d(x)
@@ -244,8 +246,11 @@ static char *
uid_cachename_hack (CamelStore *store)
{
CamelURL *url = CAMEL_SERVICE (store)->url;
+ EShellBackend *shell_backend;
char *encoded_url, *filename;
- const char *evolution_dir;
+ const gchar *data_dir;
+
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
encoded_url = g_strdup_printf ("%s%s%s@%s", url->user,
url->authmech ? ";auth=" : "",
@@ -253,8 +258,8 @@ uid_cachename_hack (CamelStore *store)
url->host);
e_filename_make_safe (encoded_url);
- evolution_dir = mail_component_peek_base_directory (mail_component_peek ());
- filename = g_build_filename (evolution_dir, "pop", encoded_url, "uid-cache", NULL);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ filename = g_build_filename (data_dir, "pop", encoded_url, "uid-cache", NULL);
g_free (encoded_url);
return filename;
@@ -275,9 +280,11 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
if (m->cancel)
camel_operation_register (m->cancel);
- if ((fm->destination = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_LOCAL_INBOX)) == NULL)
+ fm->destination = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_LOCAL_INBOX);
+ if (fm->destination == NULL)
goto fail;
- camel_object_ref(fm->destination);
+ camel_object_ref (fm->destination);
/* FIXME: this should support keep_on_server too, which would then perform a spool
access thingy, right? problem is matching raw messages to uid's etc. */
@@ -473,9 +480,9 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination,
char *name;
name = g_strstrip(g_strdup(tmp));
- if ((account = mail_config_get_account_by_uid(name))
+ if ((account = e_get_account_by_uid (name))
/* 'old' x-evolution-account stored the name, how silly */
- || (account = mail_config_get_account_by_name(name))) {
+ || (account = e_get_account_by_name (name))) {
if (account->transport && account->transport->url)
transport_url = g_strdup (account->transport->url);
@@ -579,7 +586,8 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination,
}
if (!folder) {
- folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT);
+ folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_SENT);
camel_object_ref(folder);
}
@@ -592,7 +600,8 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination,
if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL)
goto exit;
- sent_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT);
+ sent_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_SENT);
if (folder != sent_folder) {
const char *name;
@@ -687,13 +696,16 @@ report_status (struct _send_queue_msg *m, enum camel_filter_status_t status, int
static void
send_queue_exec (struct _send_queue_msg *m)
{
- CamelFolder *sent_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT);
+ CamelFolder *sent_folder;
GPtrArray *uids, *send_uids = NULL;
CamelException ex;
int i, j;
d(printf("sending queue\n"));
+ sent_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+
if (!(uids = camel_folder_get_uids (m->queue)))
return;
@@ -1269,7 +1281,8 @@ struct _get_quota_msg {
CamelFolder *folder;
CamelFolderQuotaInfo *quota;
- void (*done) (CamelFolder *folder, CamelFolderQuotaInfo *quota, void *data);
+ void (*done) (CamelFolder *folder, const gchar *folder_uri, CamelFolderQuotaInfo *quota, void *data);
+ gchar *folder_uri;
void *data;
};
@@ -1289,7 +1302,7 @@ static void
get_quota_done (struct _get_quota_msg *m)
{
if (m->done)
- m->done (m->folder, m->quota, m->data);
+ m->done (m->folder, m->folder_uri, m->quota, m->data);
}
static void
@@ -1299,6 +1312,7 @@ get_quota_free (struct _get_quota_msg *m)
camel_object_unref (m->folder);
if (m->quota)
camel_folder_quota_info_free (m->quota);
+ g_free (m->folder_uri);
}
static MailMsgInfo get_quota_info = {
@@ -1311,7 +1325,8 @@ static MailMsgInfo get_quota_info = {
int
mail_get_folder_quota (CamelFolder *folder,
- void (*done)(CamelFolder *folder, CamelFolderQuotaInfo *quota, void *data),
+ const gchar *folder_uri,
+ void (*done)(CamelFolder *folder, const gchar *uri, CamelFolderQuotaInfo *quota, void *data),
void *data, MailMsgDispatchFunc dispatch)
{
struct _get_quota_msg *m;
@@ -1321,6 +1336,7 @@ mail_get_folder_quota (CamelFolder *folder,
m = mail_msg_new (&get_quota_info);
m->folder = folder;
+ m->folder_uri = g_strdup (folder_uri);
m->data = data;
m->done = done;
@@ -1749,15 +1765,18 @@ empty_trash_desc (struct _empty_trash_msg *m)
static void
empty_trash_exec (struct _empty_trash_msg *m)
{
- const char *evolution_dir;
+ EShellBackend *shell_backend;
+ const gchar *data_dir;
CamelFolder *trash;
char *uri;
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
if (m->account) {
trash = mail_tool_get_trash (m->account->source->url, FALSE, &m->base.ex);
} else {
- evolution_dir = mail_component_peek_base_directory (mail_component_peek ());
- uri = g_strdup_printf ("mbox:%s/local", evolution_dir);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ uri = g_strdup_printf ("mbox:%s/local", data_dir);
trash = mail_tool_get_trash (uri, TRUE, &m->base.ex);
g_free (uri);
}