[evolution/account-mgmt: 20/50] Adapt mail to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/account-mgmt: 20/50] Adapt mail to the new ESource API.
- Date: Fri, 23 Dec 2011 19:50:22 +0000 (UTC)
commit 553485cf464ecc469f03c41ad9cd86303948fb8c
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Apr 13 10:30:40 2011 -0400
Adapt mail to the new ESource API.
mail/Makefile.am | 2 +
mail/e-mail-account-manager.c | 23 +-
mail/e-mail-account-manager.h | 6 +-
mail/e-mail-account-store.c | 284 +++++-------
mail/e-mail-authenticator.c | 267 +++++++++++
mail/e-mail-authenticator.h | 76 ++++
mail/e-mail-backend.c | 209 ++++++----
mail/e-mail-folder-pane.c | 17 +-
mail/e-mail-migrate.c | 249 +----------
mail/e-mail-paned-view.c | 8 +-
mail/e-mail-reader-utils.c | 27 +-
mail/e-mail-reader.c | 52 ++-
mail/e-mail-session-utils.c | 38 +-
mail/e-mail-session.c | 923 ++++++++++++++++++++++++---------------
mail/e-mail-session.h | 17 +-
mail/e-mail.h | 1 +
mail/em-account-editor.c | 237 +++++++---
mail/em-account-editor.h | 10 +-
mail/em-composer-utils.c | 158 +++++--
mail/em-composer-utils.h | 3 +-
mail/em-filter-source-element.c | 111 ++----
mail/em-folder-tree-model.c | 56 ++-
mail/em-subscription-editor.c | 12 +-
mail/em-utils.c | 649 ++++++++++++++++++---------
mail/em-utils.h | 36 +-
mail/mail-config.c | 20 -
mail/mail-config.h | 1 -
mail/mail-config.ui | 50 ---
mail/mail-folder-cache.c | 11 +-
mail/mail-ops.c | 369 +++++++++-------
mail/mail-ops.h | 1 -
mail/mail-send-recv.c | 297 +++----------
mail/mail.error.xml | 28 --
33 files changed, 2398 insertions(+), 1850 deletions(-)
---
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 8310cff..ea7d895 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -50,6 +50,7 @@ mailinclude_HEADERS = \
e-mail-account-store.h \
e-mail-account-tree-view.h \
e-mail-attachment-bar.h \
+ e-mail-authenticator.h \
e-mail-backend.h \
e-mail-browser.h \
e-mail-display.h \
@@ -126,6 +127,7 @@ libevolution_mail_la_SOURCES = \
e-mail-account-store.c \
e-mail-account-tree-view.c \
e-mail-attachment-bar.c \
+ e-mail-authenticator.c \
e-mail-backend.c \
e-mail-browser.c \
e-mail-display.c \
diff --git a/mail/e-mail-account-manager.c b/mail/e-mail-account-manager.c
index 522e26e..61a90f7 100644
--- a/mail/e-mail-account-manager.c
+++ b/mail/e-mail-account-manager.c
@@ -70,18 +70,25 @@ static void
mail_account_manager_edit_cb (EMailAccountManager *manager)
{
EMailAccountTreeView *tree_view;
- EAccount *account;
+ EMailAccountStore *store;
+ ESourceRegistry *registry;
+ EMailSession *session;
CamelService *service;
+ ESource *source;
const gchar *uid;
+ store = e_mail_account_manager_get_store (manager);
+ session = e_mail_account_store_get_session (store);
+ registry = e_mail_session_get_registry (session);
+
tree_view = E_MAIL_ACCOUNT_TREE_VIEW (manager->priv->tree_view);
service = e_mail_account_tree_view_get_selected_service (tree_view);
uid = camel_service_get_uid (service);
- account = e_get_account_by_uid (uid);
- g_return_if_fail (account != NULL);
+ source = e_source_registry_lookup_by_uid (registry, uid);
+ g_return_if_fail (source != NULL);
- e_mail_account_manager_edit_account (manager, account);
+ e_mail_account_manager_edit_account (manager, source);
}
static void
@@ -519,7 +526,7 @@ e_mail_account_manager_class_init (EMailAccountManagerClass *class)
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
- E_TYPE_ACCOUNT);
+ E_TYPE_SOURCE);
}
static void
@@ -556,11 +563,11 @@ e_mail_account_manager_add_account (EMailAccountManager *manager)
void
e_mail_account_manager_edit_account (EMailAccountManager *manager,
- EAccount *account)
+ ESource *source)
{
g_return_if_fail (E_IS_MAIL_ACCOUNT_MANAGER (manager));
- g_return_if_fail (E_IS_ACCOUNT (account));
+ g_return_if_fail (E_IS_SOURCE (source));
- g_signal_emit (manager, signals[EDIT_ACCOUNT], 0, account);
+ g_signal_emit (manager, signals[EDIT_ACCOUNT], 0, source);
}
diff --git a/mail/e-mail-account-manager.h b/mail/e-mail-account-manager.h
index 23f7890..a17ff2a 100644
--- a/mail/e-mail-account-manager.h
+++ b/mail/e-mail-account-manager.h
@@ -20,7 +20,7 @@
#define E_MAIL_ACCOUNT_MANAGER_H
#include <gtk/gtk.h>
-#include <e-util/e-account-utils.h>
+#include <libedataserver/e-source.h>
#include <mail/e-mail-account-store.h>
/* Standard GObject macros */
@@ -59,7 +59,7 @@ struct _EMailAccountManagerClass {
/* Signals */
void (*add_account) (EMailAccountManager *manager);
void (*edit_account) (EMailAccountManager *manager,
- EAccount *account);
+ ESource *source);
};
GType e_mail_account_manager_get_type (void) G_GNUC_CONST;
@@ -71,7 +71,7 @@ void e_mail_account_manager_add_account
(EMailAccountManager *manager);
void e_mail_account_manager_edit_account
(EMailAccountManager *manager,
- EAccount *account);
+ ESource *source);
G_END_DECLS
diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c
index 824a521..18ec970 100644
--- a/mail/e-mail-account-store.c
+++ b/mail/e-mail-account-store.c
@@ -25,7 +25,6 @@
#include <libebackend/e-extensible.h>
#include <e-util/e-marshal.h>
-#include <e-util/e-account-utils.h>
#include <e-util/e-alert-dialog.h>
#include <mail/mail-ops.h>
#include <mail/mail-vfolder.h>
@@ -99,24 +98,6 @@ index_item_free (IndexItem *item)
g_slice_free (IndexItem, item);
}
-static void
-mail_account_store_save_default (EMailAccountStore *store)
-{
- EAccountList *account_list;
- EAccount *account;
- CamelService *service;
- const gchar *uid;
-
- service = e_mail_account_store_get_default_service (store);
-
- account_list = e_get_account_list ();
- uid = camel_service_get_uid (service);
- account = e_get_account_by_uid (uid);
- g_return_if_fail (account != NULL);
-
- e_account_list_set_default (account_list, account);
-}
-
static gboolean
mail_account_store_get_iter (EMailAccountStore *store,
CamelService *service,
@@ -236,6 +217,46 @@ mail_account_store_service_notify_cb (CamelService *service,
}
static void
+mail_account_store_remove_source_cb (ESourceRegistry *registry,
+ GAsyncResult *result,
+ EMailAccountStore *store)
+{
+ GError *error = NULL;
+
+ /* FIXME EMailAccountStore should implement EAlertSink. */
+ if (!e_source_registry_remove_source_finish (registry, result, &error)) {
+ g_warning ("%s: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
+
+ g_return_if_fail (store->priv->busy_count > 0);
+ store->priv->busy_count--;
+ g_object_notify (G_OBJECT (store), "busy");
+
+ g_object_unref (store);
+}
+
+static void
+mail_account_store_write_source_cb (ESource *source,
+ GAsyncResult *result,
+ EMailAccountStore *store)
+{
+ GError *error = NULL;
+
+ /* FIXME EMailAccountStore should implement EAlertSink. */
+ if (!e_source_write_finish (source, result, &error)) {
+ g_warning ("%s: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
+
+ g_return_if_fail (store->priv->busy_count > 0);
+ store->priv->busy_count--;
+ g_object_notify (G_OBJECT (store), "busy");
+
+ g_object_unref (store);
+}
+
+static void
mail_account_store_clean_index (EMailAccountStore *store)
{
GQueue trash = G_QUEUE_INIT;
@@ -425,23 +446,34 @@ static void
mail_account_store_constructed (GObject *object)
{
EMailAccountStore *store;
+ EMailSession *session;
+ ESourceRegistry *registry;
const gchar *config_dir;
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_mail_account_store_parent_class)->constructed (object);
store = E_MAIL_ACCOUNT_STORE (object);
+ session = e_mail_account_store_get_session (store);
+ registry = e_mail_session_get_registry (session);
+
+ /* Bind the default mail account ESource to our default
+ * CamelService, with help from some transform functions. */
+ g_object_bind_property_full (
+ registry, "default-mail-account",
+ store, "default-service",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE,
+ e_binding_transform_source_to_service,
+ e_binding_transform_service_to_source,
+ session, (GDestroyNotify) NULL);
+
config_dir = mail_session_get_config_dir ();
/* XXX Should we take the filename as a constructor property? */
store->priv->sort_order_filename = g_build_filename (
config_dir, "sortorder.ini", NULL);
- /* XXX This is kinda lame, but should work until EAccount dies. */
- g_signal_connect (
- object, "notify::default-service",
- G_CALLBACK (mail_account_store_save_default), NULL);
-
e_extensible_load_extensions (E_EXTENSIBLE (object));
}
@@ -456,75 +488,55 @@ static void
mail_account_store_service_removed (EMailAccountStore *store,
CamelService *service)
{
- /* XXX On the account-mgmt branch this operation is asynchronous.
- * The 'busy_count' is bumped until changes are written back
- * to the D-Bus service. For now I guess we'll just block. */
-
- EAccountList *account_list;
- EAccount *account;
+ EMailSession *session;
+ ESourceRegistry *registry;
+ ESource *source;
const gchar *uid;
- account_list = e_get_account_list ();
- uid = camel_service_get_uid (service);
- account = e_get_account_by_uid (uid);
- g_return_if_fail (account != NULL);
+ session = e_mail_account_store_get_session (store);
+ registry = e_mail_session_get_registry (session);
- if (account->enabled) {
- CamelProvider *provider;
+ uid = camel_service_get_uid (service);
+ source = e_source_registry_lookup_by_uid (registry, uid);
- provider = camel_service_get_provider (service);
- g_return_if_fail (provider != NULL);
+ if (E_IS_SOURCE (source)) {
+ store->priv->busy_count++;
+ g_object_notify (G_OBJECT (store), "busy");
- if (provider->flags & CAMEL_PROVIDER_IS_STORAGE)
- mail_disconnect_store (CAMEL_STORE (service));
+ /* XXX Should this be cancellable? */
+ e_source_registry_remove_source (
+ registry, source, NULL, (GAsyncReadyCallback)
+ mail_account_store_remove_source_cb,
+ g_object_ref (store));
}
-
- /* Remove all the proxies the account has created.
- * FIXME This proxy stuff belongs in evolution-groupwise. */
- e_account_list_remove_account_proxies (account_list, account);
-
- e_account_list_remove (account_list, account);
-
- e_account_list_save (account_list);
}
static void
mail_account_store_service_enabled (EMailAccountStore *store,
CamelService *service)
{
- /* XXX On the account-mgmt branch this operation is asynchronous.
- * The 'busy_count' is bumped until changes are written back
- * to the D-Bus service. For now I guess we'll just block. */
-
- GSettings *settings;
+ EMailSession *session;
+ ESourceRegistry *registry;
+ ESource *source;
const gchar *uid;
- uid = camel_service_get_uid (service);
-
- /* Handle built-in services that don't have an EAccount. */
-
- if (g_strcmp0 (uid, E_MAIL_SESSION_LOCAL_UID) == 0) {
- settings = g_settings_new ("org.gnome.evolution.mail");
- g_settings_set_boolean (settings, "enable-local", TRUE);
- g_object_unref (settings);
-
- } else if (g_strcmp0 (uid, E_MAIL_SESSION_VFOLDER_UID) == 0) {
- settings = g_settings_new ("org.gnome.evolution.mail");
- g_settings_set_boolean (settings, "enable-vfolders", TRUE);
- g_object_unref (settings);
+ session = e_mail_account_store_get_session (store);
+ registry = e_mail_session_get_registry (session);
- } else {
- EAccountList *account_list;
- EAccount *account;
+ uid = camel_service_get_uid (service);
+ source = e_source_registry_lookup_by_uid (registry, uid);
- account_list = e_get_account_list ();
- account = e_get_account_by_uid (uid);
- g_return_if_fail (account != NULL);
+ if (E_IS_SOURCE (source)) {
+ e_source_set_enabled (source, TRUE);
- account->enabled = TRUE;
+ store->priv->busy_count++;
+ g_object_notify (G_OBJECT (store), "busy");
- e_account_list_change (account_list, account);
- e_account_list_save (account_list);
+ /* XXX Should this be cancellable? */
+ e_source_write (
+ source, NULL, (GAsyncReadyCallback)
+ mail_account_store_write_source_cb,
+ g_object_ref (store));
}
}
@@ -532,52 +544,28 @@ static void
mail_account_store_service_disabled (EMailAccountStore *store,
CamelService *service)
{
- /* XXX On the account-mgmt branch this operation is asynchronous.
- * The 'busy_count' is bumped until changes are written back
- * to the D-Bus service. For now I guess we'll just block. */
-
- GSettings *settings;
+ EMailSession *session;
+ ESourceRegistry *registry;
+ ESource *source;
const gchar *uid;
- uid = camel_service_get_uid (service);
-
- /* Handle built-in services that don't have an EAccount. */
-
- if (g_strcmp0 (uid, E_MAIL_SESSION_LOCAL_UID) == 0) {
- settings = g_settings_new ("org.gnome.evolution.mail");
- g_settings_set_boolean (settings, "enable-local", FALSE);
- g_object_unref (settings);
-
- } else if (g_strcmp0 (uid, E_MAIL_SESSION_VFOLDER_UID) == 0) {
- settings = g_settings_new ("org.gnome.evolution.mail");
- g_settings_set_boolean (settings, "enable-vfolders", FALSE);
- g_object_unref (settings);
-
- } else {
- EAccountList *account_list;
- EAccount *account;
- CamelProvider *provider;
-
- account_list = e_get_account_list ();
- account = e_get_account_by_uid (uid);
- g_return_if_fail (account != NULL);
-
- account->enabled = FALSE;
-
- provider = camel_service_get_provider (service);
- g_return_if_fail (provider != NULL);
+ session = e_mail_account_store_get_session (store);
+ registry = e_mail_session_get_registry (session);
- if (provider->flags & CAMEL_PROVIDER_IS_STORAGE)
- mail_disconnect_store (CAMEL_STORE (service));
+ uid = camel_service_get_uid (service);
+ source = e_source_registry_lookup_by_uid (registry, uid);
- /* FIXME This proxy stuff belongs in evolution-groupwise. */
- e_account_list_remove_account_proxies (account_list, account);
+ if (E_IS_SOURCE (source)) {
+ e_source_set_enabled (source, FALSE);
- if (account->parent_uid != NULL)
- e_account_list_remove (account_list, account);
+ store->priv->busy_count++;
+ g_object_notify (G_OBJECT (store), "busy");
- e_account_list_change (account_list, account);
- e_account_list_save (account_list);
+ /* XXX Should this be cancellable? */
+ e_source_write (
+ source, NULL, (GAsyncReadyCallback)
+ mail_account_store_write_source_cb,
+ g_object_ref (store));
}
}
@@ -611,25 +599,14 @@ mail_account_store_remove_requested (EMailAccountStore *store,
GtkWindow *parent_window,
CamelService *service)
{
- EAccountList *account_list;
- EAccount *account;
- const gchar *alert;
- const gchar *uid;
gint response;
- account_list = e_get_account_list ();
- uid = camel_service_get_uid (service);
- account = e_get_account_by_uid (uid);
-
- g_return_val_if_fail (account != NULL, FALSE);
-
- /* FIXME This proxy stuff belongs in evolution-groupwise. */
- if (e_account_list_account_has_proxies (account_list, account))
- alert = "mail:ask-delete-account-with-proxies";
- else
- alert = "mail:ask-delete-account";
+ /* FIXME Need to use "mail:ask-delete-account-with-proxies" if the
+ * mail account has proxies. But this is groupwise-specific
+ * and doesn't belong here anyway. Think of a better idea. */
- response = e_alert_run_dialog_for_args (parent_window, alert, NULL);
+ response = e_alert_run_dialog_for_args (
+ parent_window, "mail:ask-delete-account", NULL);
return (response == GTK_RESPONSE_YES);
}
@@ -647,34 +624,12 @@ mail_account_store_disable_requested (EMailAccountStore *store,
GtkWindow *parent_window,
CamelService *service)
{
- EAccountList *account_list;
- EAccount *account;
- const gchar *uid;
- gint response;
-
- account_list = e_get_account_list ();
- uid = camel_service_get_uid (service);
- account = e_get_account_by_uid (uid);
-
- /* "On This Computer" and "Search Folders" do not have
- * EAccounts, so just silently return TRUE if we failed
- * to find a matching EAccount for the CamelService. */
-
- /* Silently return TRUE if we failed to find a matching
- * EAccount since "On This Computer" and "Search Folders"
- * do not have EAccounts. */
- if (account == NULL)
- return TRUE;
-
- /* FIXME This proxy stuff belongs in evolution-groupwise. */
- if (e_account_list_account_has_proxies (account_list, account))
- response = e_alert_run_dialog_for_args (
- parent_window,
- "mail:ask-delete-proxy-accounts", NULL);
- else
- response = GTK_RESPONSE_YES;
+ /* FIXME Need to check whether the account has proxies and run a
+ * "mail:ask-delete-proxy-accounts" alert dialog, but this
+ * is groupwise-specific and doesn't belong here anyway.
+ * Think of a better idea. */
- return (response == GTK_RESPONSE_YES);
+ return TRUE;
}
static void
@@ -1054,13 +1009,18 @@ e_mail_account_store_add_service (EMailAccountStore *store,
g_object_unref (settings);
} else {
- EAccount *account;
+ EMailSession *session;
+ ESourceRegistry *registry;
+ ESource *source;
+
+ session = e_mail_account_store_get_session (store);
- account = e_get_account_by_uid (uid);
- g_return_if_fail (account != NULL);
+ registry = e_mail_session_get_registry (session);
+ source = e_source_registry_lookup_by_uid (registry, uid);
+ g_return_if_fail (source != NULL);
builtin = FALSE;
- enabled = account->enabled;
+ enabled = e_source_get_enabled (source);
}
/* Where do we insert new services now that accounts can be
diff --git a/mail/e-mail-authenticator.c b/mail/e-mail-authenticator.c
new file mode 100644
index 0000000..9729d35
--- /dev/null
+++ b/mail/e-mail-authenticator.c
@@ -0,0 +1,267 @@
+/*
+ * e-mail-authenticator.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-mail-authenticator.h"
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+
+#define E_MAIL_AUTHENTICATOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_AUTHENTICATOR, EMailAuthenticatorPrivate))
+
+struct _EMailAuthenticatorPrivate {
+ CamelService *service;
+ gchar *mechanism;
+};
+
+enum {
+ PROP_0,
+ PROP_MECHANISM,
+ PROP_SERVICE
+};
+
+/* Forward Declarations */
+static void e_mail_authenticator_interface_init
+ (ESourceAuthenticatorInterface *interface);
+
+G_DEFINE_TYPE_WITH_CODE (
+ EMailAuthenticator,
+ e_mail_authenticator,
+ G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (
+ E_TYPE_SOURCE_AUTHENTICATOR,
+ e_mail_authenticator_interface_init))
+
+static void
+mail_authenticator_set_mechanism (EMailAuthenticator *auth,
+ const gchar *mechanism)
+{
+ g_return_if_fail (auth->priv->mechanism == NULL);
+
+ auth->priv->mechanism = g_strdup (mechanism);
+}
+
+static void
+mail_authenticator_set_service (EMailAuthenticator *auth,
+ CamelService *service)
+{
+ g_return_if_fail (CAMEL_IS_SERVICE (service));
+ g_return_if_fail (auth->priv->service == NULL);
+
+ auth->priv->service = g_object_ref (service);
+}
+
+static void
+mail_authenticator_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MECHANISM:
+ mail_authenticator_set_mechanism (
+ E_MAIL_AUTHENTICATOR (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_SERVICE:
+ mail_authenticator_set_service (
+ E_MAIL_AUTHENTICATOR (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_authenticator_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MECHANISM:
+ g_value_set_string (
+ value,
+ e_mail_authenticator_get_mechanism (
+ E_MAIL_AUTHENTICATOR (object)));
+ return;
+
+ case PROP_SERVICE:
+ g_value_set_object (
+ value,
+ e_mail_authenticator_get_service (
+ E_MAIL_AUTHENTICATOR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_authenticator_dispose (GObject *object)
+{
+ EMailAuthenticatorPrivate *priv;
+
+ priv = E_MAIL_AUTHENTICATOR_GET_PRIVATE (object);
+
+ if (priv->service != NULL) {
+ g_object_unref (priv->service);
+ priv->service = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (e_mail_authenticator_parent_class)->dispose (object);
+}
+
+static void
+mail_authenticator_finalize (GObject *object)
+{
+ EMailAuthenticatorPrivate *priv;
+
+ priv = E_MAIL_AUTHENTICATOR_GET_PRIVATE (object);
+
+ g_free (priv->mechanism);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (e_mail_authenticator_parent_class)->finalize (object);
+}
+
+static ESourceAuthenticationResult
+mail_authenticator_try_password_sync (ESourceAuthenticator *auth,
+ const GString *password,
+ GCancellable *cancellable,
+ GError **error)
+{
+ CamelService *service;
+ EMailAuthenticator *mail_auth;
+ CamelAuthenticationResult camel_result;
+ ESourceAuthenticationResult source_result;
+ const gchar *mechanism;
+
+ mail_auth = E_MAIL_AUTHENTICATOR (auth);
+ service = e_mail_authenticator_get_service (mail_auth);
+ mechanism = e_mail_authenticator_get_mechanism (mail_auth);
+
+ camel_service_set_password (service, password->str);
+
+ camel_result = camel_service_authenticate_sync (
+ service, mechanism, cancellable, error);
+
+ switch (camel_result) {
+ case CAMEL_AUTHENTICATION_ERROR:
+ source_result = E_SOURCE_AUTHENTICATION_ERROR;
+ break;
+ case CAMEL_AUTHENTICATION_ACCEPTED:
+ source_result = E_SOURCE_AUTHENTICATION_ACCEPTED;
+ break;
+ case CAMEL_AUTHENTICATION_REJECTED:
+ source_result = E_SOURCE_AUTHENTICATION_REJECTED;
+ break;
+ default:
+ g_set_error (
+ error, CAMEL_SERVICE_ERROR,
+ CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
+ _("Invalid authentication result code (%d)"),
+ camel_result);
+ source_result = E_SOURCE_AUTHENTICATION_ERROR;
+ break;
+ }
+
+ return source_result;
+}
+
+static void
+e_mail_authenticator_class_init (EMailAuthenticatorClass *class)
+{
+ GObjectClass *object_class;
+
+ g_type_class_add_private (class, sizeof (EMailAuthenticatorPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = mail_authenticator_set_property;
+ object_class->get_property = mail_authenticator_get_property;
+ object_class->dispose = mail_authenticator_dispose;
+ object_class->finalize = mail_authenticator_finalize;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MECHANISM,
+ g_param_spec_string (
+ "mechanism",
+ "Mechanism",
+ "Authentication mechanism",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SERVICE,
+ g_param_spec_object (
+ "service",
+ "Service",
+ "The CamelService to authenticate",
+ CAMEL_TYPE_SERVICE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+}
+
+static void
+e_mail_authenticator_interface_init (ESourceAuthenticatorInterface *interface)
+{
+ interface->try_password_sync = mail_authenticator_try_password_sync;
+}
+
+static void
+e_mail_authenticator_init (EMailAuthenticator *auth)
+{
+ auth->priv = E_MAIL_AUTHENTICATOR_GET_PRIVATE (auth);
+}
+
+ESourceAuthenticator *
+e_mail_authenticator_new (CamelService *service,
+ const gchar *mechanism)
+{
+ g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
+
+ return g_object_new (
+ E_TYPE_MAIL_AUTHENTICATOR,
+ "service", service, "mechanism", mechanism, NULL);
+}
+
+CamelService *
+e_mail_authenticator_get_service (EMailAuthenticator *auth)
+{
+ g_return_val_if_fail (E_IS_MAIL_AUTHENTICATOR (auth), NULL);
+
+ return auth->priv->service;
+}
+
+const gchar *
+e_mail_authenticator_get_mechanism (EMailAuthenticator *auth)
+{
+ g_return_val_if_fail (E_IS_MAIL_AUTHENTICATOR (auth), NULL);
+
+ return auth->priv->mechanism;
+}
+
diff --git a/mail/e-mail-authenticator.h b/mail/e-mail-authenticator.h
new file mode 100644
index 0000000..bcc3299
--- /dev/null
+++ b/mail/e-mail-authenticator.h
@@ -0,0 +1,76 @@
+/*
+ * e-mail-authenticator.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_MAIL_AUTHENTICATOR_H
+#define E_MAIL_AUTHENTICATOR_H
+
+#include <camel/camel.h>
+#include <libedataserver/e-source-authenticator.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_AUTHENTICATOR \
+ (e_mail_authenticator_get_type ())
+#define E_MAIL_AUTHENTICATOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_AUTHENTICATOR, EMailAuthenticator))
+#define E_MAIL_AUTHENTICATOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_AUTHENTICATOR, EMailAuthenticatorClass))
+#define E_IS_MAIL_AUTHENTICATOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_AUTHENTICATOR))
+#define E_IS_MAIL_AUTHENTICATOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_AUTHENTICATOR))
+#define E_MAIL_AUTHENTICATOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_AUTHENTICATOR, EMailAuthenticatorClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailAuthenticator EMailAuthenticator;
+typedef struct _EMailAuthenticatorClass EMailAuthenticatorClass;
+typedef struct _EMailAuthenticatorPrivate EMailAuthenticatorPrivate;
+
+/**
+ * EMailAuthenticator:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _EMailAuthenticator {
+ GObject parent;
+ EMailAuthenticatorPrivate *priv;
+};
+
+struct _EMailAuthenticatorClass {
+ GObjectClass parent_class;
+};
+
+GType e_mail_authenticator_get_type (void);
+ESourceAuthenticator *
+ e_mail_authenticator_new (CamelService *service,
+ const gchar *mechanism);
+CamelService * e_mail_authenticator_get_service
+ (EMailAuthenticator *auth);
+const gchar * e_mail_authenticator_get_mechanism
+ (EMailAuthenticator *auth);
+
+G_END_DECLS
+
+#endif /* E_MAIL_AUTHENTICATOR_H */
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index 2f769e9..9c9178b 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -31,13 +31,13 @@
#include <string.h>
#include <glib/gstdio.h>
#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-source-camel.h>
+#include <libedataserver/e-source-mail-composition.h>
+#include <libedataserver/e-source-mail-submission.h>
-#include "e-util/e-account-utils.h"
#include "e-util/e-alert-dialog.h"
#include "e-util/e-alert-sink.h"
-#include "misc/e-account-combo-box.h"
-
#include "shell/e-shell.h"
#include "mail/e-mail-folder-utils.h"
@@ -257,7 +257,6 @@ mail_backend_prepare_for_quit_cb (EShell *shell,
EActivity *activity,
EMailBackend *backend)
{
- EAccountList *account_list;
EMailSession *session;
GList *list, *link;
gboolean delete_junk;
@@ -270,9 +269,6 @@ mail_backend_prepare_for_quit_cb (EShell *shell,
camel_application_is_exiting = TRUE;
- account_list = e_get_account_list ();
- e_account_list_prune_proxies (account_list);
-
mail_vfolder_shutdown ();
/* Cancel all pending activities. */
@@ -383,20 +379,26 @@ mail_backend_folder_deleted_cb (MailFolderCache *folder_cache,
const gchar *folder_name,
EMailBackend *backend)
{
+ EShell *shell;
CamelStoreClass *class;
- EAccountList *account_list;
- EIterator *iterator;
+ ESourceRegistry *registry;
+ EShellBackend *shell_backend;
EMailSession *session;
EAlertSink *alert_sink;
+ GList *list, *link;
+ const gchar *extension_name;
const gchar *local_drafts_folder_uri;
const gchar *local_sent_folder_uri;
- gboolean write_config = FALSE;
gchar *uri;
/* Check whether the deleted folder was a designated Drafts or
* Sent folder for any mail account, and if so revert the setting
* to the equivalent local folder, which is always present. */
+ shell_backend = E_SHELL_BACKEND (backend);
+ shell = e_shell_backend_get_shell (shell_backend);
+ registry = e_shell_get_registry (shell);
+
class = CAMEL_STORE_GET_CLASS (store);
g_return_if_fail (class->compare_folder_name != NULL);
@@ -413,51 +415,69 @@ mail_backend_folder_deleted_cb (MailFolderCache *folder_cache,
uri = e_mail_folder_uri_build (store, folder_name);
- account_list = e_get_account_list ();
- iterator = e_list_get_iterator (E_LIST (account_list));
+ extension_name = E_SOURCE_EXTENSION_MAIL_COMPOSITION;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESourceExtension *extension;
+ const gchar *drafts_folder_uri;
- while (e_iterator_is_valid (iterator)) {
- EAccount *account;
+ extension = e_source_get_extension (source, extension_name);
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iterator);
+ drafts_folder_uri =
+ e_source_mail_composition_get_drafts_folder (
+ E_SOURCE_MAIL_COMPOSITION (extension));
- if (account->sent_folder_uri != NULL) {
- gboolean match;
+ if (class->compare_folder_name (drafts_folder_uri, uri)) {
+ GError *error = NULL;
- match = class->compare_folder_name (
- account->sent_folder_uri, uri);
+ e_source_mail_composition_set_drafts_folder (
+ E_SOURCE_MAIL_COMPOSITION (extension),
+ local_drafts_folder_uri);
- if (match) {
- g_free (account->sent_folder_uri);
- account->sent_folder_uri =
- g_strdup (local_sent_folder_uri);
- write_config = TRUE;
+ /* FIXME This is a blocking D-Bus method call. */
+ if (!e_source_write_sync (source, NULL, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
}
}
+ }
+
+ g_list_free (list);
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_SUBMISSION;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESourceExtension *extension;
+ const gchar *sent_folder_uri;
+
+ extension = e_source_get_extension (source, extension_name);
+
+ sent_folder_uri =
+ e_source_mail_submission_get_sent_folder (
+ E_SOURCE_MAIL_SUBMISSION (extension));
- if (account->drafts_folder_uri != NULL) {
- gboolean match;
+ if (class->compare_folder_name (sent_folder_uri, uri)) {
+ GError *error = NULL;
- match = class->compare_folder_name (
- account->drafts_folder_uri, uri);
+ e_source_mail_submission_set_sent_folder (
+ E_SOURCE_MAIL_SUBMISSION (extension),
+ local_sent_folder_uri);
- if (match) {
- g_free (account->drafts_folder_uri);
- account->drafts_folder_uri =
- g_strdup (local_drafts_folder_uri);
- write_config = TRUE;
+ /* FIXME This is a blocking D-Bus method call. */
+ if (!e_source_write_sync (source, NULL, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
}
}
-
- e_iterator_next (iterator);
}
- g_object_unref (iterator);
- g_free (uri);
+ g_list_free (list);
- if (write_config)
- mail_config_write ();
+ g_free (uri);
/* This does something completely different.
* XXX Make it a separate signal handler? */
@@ -471,10 +491,12 @@ mail_backend_folder_renamed_cb (MailFolderCache *folder_cache,
const gchar *new_folder_name,
EMailBackend *backend)
{
+ EShell *shell;
CamelStoreClass *class;
- EAccountList *account_list;
- EIterator *iterator;
- gboolean write_config = FALSE;
+ ESourceRegistry *registry;
+ EShellBackend *shell_backend;
+ GList *list, *link;
+ const gchar *extension_name;
gchar *old_uri;
gchar *new_uri;
gint ii;
@@ -484,54 +506,84 @@ mail_backend_folder_renamed_cb (MailFolderCache *folder_cache,
"views/custom_view-"
};
+ /* Check whether the renamed folder was a designated Drafts or
+ * Sent folder for any mail account, and if so update the setting
+ * to the new folder name. */
+
+ shell_backend = E_SHELL_BACKEND (backend);
+ shell = e_shell_backend_get_shell (shell_backend);
+ registry = e_shell_get_registry (shell);
+
class = CAMEL_STORE_GET_CLASS (store);
g_return_if_fail (class->compare_folder_name != NULL);
old_uri = e_mail_folder_uri_build (store, old_folder_name);
new_uri = e_mail_folder_uri_build (store, new_folder_name);
- account_list = e_get_account_list ();
- iterator = e_list_get_iterator (E_LIST (account_list));
+ extension_name = E_SOURCE_EXTENSION_MAIL_COMPOSITION;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESourceExtension *extension;
+ const gchar *drafts_folder_uri;
- while (e_iterator_is_valid (iterator)) {
- EAccount *account;
+ extension = e_source_get_extension (source, extension_name);
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iterator);
+ drafts_folder_uri =
+ e_source_mail_composition_get_drafts_folder (
+ E_SOURCE_MAIL_COMPOSITION (extension));
- if (account->sent_folder_uri != NULL) {
- gboolean match;
+ if (class->compare_folder_name (drafts_folder_uri, old_uri)) {
+ GError *error = NULL;
- match = class->compare_folder_name (
- account->sent_folder_uri, old_uri);
+ e_source_mail_composition_set_drafts_folder (
+ E_SOURCE_MAIL_COMPOSITION (extension),
+ new_uri);
- if (match) {
- g_free (account->sent_folder_uri);
- account->sent_folder_uri = g_strdup (new_uri);
- write_config = TRUE;
+ /* FIXME This is a blocking D-Bus method call. */
+ if (!e_source_write_sync (source, NULL, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
}
}
+ }
+
+ g_list_free (list);
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_SUBMISSION;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESourceExtension *extension;
+ const gchar *sent_folder_uri;
+
+ extension = e_source_get_extension (source, extension_name);
+
+ sent_folder_uri =
+ e_source_mail_submission_get_sent_folder (
+ E_SOURCE_MAIL_SUBMISSION (extension));
- if (account->drafts_folder_uri != NULL) {
- gboolean match;
+ if (class->compare_folder_name (sent_folder_uri, old_uri)) {
+ GError *error = NULL;
- match = class->compare_folder_name (
- account->drafts_folder_uri, old_uri);
+ e_source_mail_submission_set_sent_folder (
+ E_SOURCE_MAIL_SUBMISSION (extension),
+ new_uri);
- if (match) {
- g_free (account->drafts_folder_uri);
- account->drafts_folder_uri = g_strdup (new_uri);
- write_config = TRUE;
+ /* FIXME This is a blocking D-Bus method call. */
+ if (!e_source_write_sync (source, NULL, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
}
}
-
- e_iterator_next (iterator);
}
- g_object_unref (iterator);
+ g_list_free (list);
- if (write_config)
- mail_config_write ();
+ g_free (old_uri);
+ g_free (new_uri);
/* Rename GalView files. */
@@ -549,9 +601,6 @@ mail_backend_folder_renamed_cb (MailFolderCache *folder_cache,
g_free (newname);
}
- g_free (old_uri);
- g_free (new_uri);
-
/* This does something completely different.
* XXX Make it a separate signal handler? */
mail_filter_rename_folder (
@@ -587,10 +636,8 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache,
g_object_unref (folder);
}
- g_free (folder_uri);
-
target = em_event_target_new_folder (
- event, store, folder_name, new_messages,
+ event, store, folder_uri, new_messages,
msg_uid, msg_sender, msg_subject);
folder_type = (flags & CAMEL_FOLDER_TYPE_MASK);
@@ -766,6 +813,7 @@ mail_backend_constructed (GObject *object)
EShell *shell;
EShellBackend *shell_backend;
MailFolderCache *folder_cache;
+ ESourceRegistry *registry;
priv = E_MAIL_BACKEND_GET_PRIVATE (object);
@@ -775,9 +823,10 @@ mail_backend_constructed (GObject *object)
if (camel_init (e_get_user_data_dir (), TRUE) != 0)
exit (0);
- camel_provider_init ();
+ e_source_camel_register_types ();
- priv->session = e_mail_session_new ();
+ registry = e_shell_get_registry (shell);
+ priv->session = e_mail_session_new (registry);
g_object_bind_property (
shell, "online",
@@ -801,10 +850,6 @@ mail_backend_constructed (GObject *object)
G_CALLBACK (mail_backend_job_finished_cb),
shell_backend);
- /* FIXME This is an evil hack that needs to die.
- * Give EAccountComboBox a CamelSession property. */
- e_account_combo_box_set_session (CAMEL_SESSION (priv->session));
-
g_signal_connect (
shell, "prepare-for-offline",
G_CALLBACK (mail_backend_prepare_for_offline_cb),
diff --git a/mail/e-mail-folder-pane.c b/mail/e-mail-folder-pane.c
index 2772280..ff98409 100644
--- a/mail/e-mail-folder-pane.c
+++ b/mail/e-mail-folder-pane.c
@@ -70,7 +70,10 @@ folder_pane_set_preview_visible (EMailView *view,
static guint
mail_paned_view_open_selected_mail (EMailPanedView *view)
{
+ EShell *shell;
EMailReader *reader;
+ EMailBackend *backend;
+ ESourceRegistry *registry;
GPtrArray *uids;
gint i;
GtkWindow *window;
@@ -84,6 +87,10 @@ mail_paned_view_open_selected_mail (EMailPanedView *view)
uids = e_mail_reader_get_selected_uids (reader);
g_return_val_if_fail (uids != NULL, 0);
+ backend = e_mail_reader_get_backend (reader);
+ shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
+ registry = e_shell_get_registry (shell);
+
/* XXX Either e_mail_reader_get_selected_uids()
* or MessageList should do this itself. */
g_ptr_array_set_free_func (uids, (GDestroyNotify) g_free);
@@ -93,9 +100,9 @@ mail_paned_view_open_selected_mail (EMailPanedView *view)
return 0;
}
- if (em_utils_folder_is_drafts (folder) ||
- em_utils_folder_is_outbox (folder) ||
- em_utils_folder_is_templates (folder)) {
+ if (em_utils_folder_is_drafts (registry, folder) ||
+ em_utils_folder_is_outbox (registry, folder) ||
+ em_utils_folder_is_templates (registry, folder)) {
em_utils_edit_messages (reader, folder, uids, TRUE);
g_ptr_array_unref (uids);
return 0;
@@ -123,8 +130,8 @@ mail_paned_view_open_selected_mail (EMailPanedView *view)
CAMEL_VEE_FOLDER (folder),
(CamelVeeMessageInfo *) info, &real_uid);
- if (em_utils_folder_is_drafts (real_folder) ||
- em_utils_folder_is_outbox (real_folder)) {
+ if (em_utils_folder_is_drafts (registry, real_folder) ||
+ em_utils_folder_is_outbox (registry, real_folder)) {
GPtrArray *edits;
edits = g_ptr_array_new_with_free_func (
diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c
index fdf5684..c2eedea 100644
--- a/mail/e-mail-migrate.c
+++ b/mail/e-mail-migrate.c
@@ -53,11 +53,9 @@
#include <libedataserver/e-data-server-util.h>
#include <e-util/e-xml-utils.h>
-#include "e-util/e-account-utils.h"
#include "e-util/e-alert-dialog.h"
#include "e-util/e-util-private.h"
#include "e-util/e-plugin.h"
-#include "e-util/e-signature-utils.h"
#include "shell/e-shell.h"
#include "shell/e-shell-migrate.h"
@@ -226,6 +224,7 @@ cp (const gchar *src,
static void
em_update_accounts_2_11 (void)
{
+#if 0 /* ACCOUNT_MGMT */
EAccountList *accounts;
EIterator *iter;
gboolean changed = FALSE;
@@ -258,6 +257,7 @@ em_update_accounts_2_11 (void)
if (changed)
e_account_list_save (accounts);
+#endif /* ACCOUNT_MGMT */
}
#endif /* !G_OS_WIN32 */
@@ -667,6 +667,7 @@ static gboolean
create_mbox_account (EShellBackend *shell_backend,
EMMigrateSession *session)
{
+#if 0 /* ACCOUNT_MGMT */
EMailBackend *mail_backend;
EMailSession *mail_session;
CamelService *service;
@@ -736,6 +737,7 @@ exit:
g_free (uri);
g_free (name);
g_free (id);
+#endif /* ACCOUNT_MGMT */
return TRUE;
}
@@ -743,6 +745,7 @@ exit:
static void
change_sent_and_drafts_local_folders (EShellBackend *shell_backend)
{
+#if 0 /* ACCOUNT_MGMT */
EMailBackend *backend;
EMailSession *session;
EAccountList *accounts;
@@ -824,243 +827,7 @@ change_sent_and_drafts_local_folders (EShellBackend *shell_backend)
if (changed)
e_account_list_save (accounts);
-}
-
-static void
-em_rename_camel_url_params (CamelURL *url)
-{
- /* This list includes known URL parameters from built-in providers
- * in Camel, as well as from evolution-exchange, evolution-groupwise,
- * and evolution-mapi. Add more as needed. */
- static struct {
- const gchar *url_parameter;
- const gchar *property_name;
- } camel_url_conversion[] = {
- { "ad_auth", "gc-auth-method" },
- { "ad_browse", "gc-allow-browse" },
- { "ad_expand_groups", "gc-expand-groups" },
- { "ad_limit", "gc-results-limit" },
- { "ad_server", "gc-server-name" },
- { "all_headers", "fetch-headers" },
- { "basic_headers", "fetch-headers" },
- { "cachedconn" "concurrent-connections" },
- { "check_all", "check-all" },
- { "check_lsub", "check-subscribed" },
- { "command", "shell-command" },
- { "delete_after", "delete-after-days" },
- { "delete_expunged", "delete-expunged" },
- { "disable_extensions", "disable-extensions" },
- { "dotfolders", "use-dot-folders" },
- { "filter", "filter-inbox" },
- { "filter_junk", "filter-junk" },
- { "filter_junk_inbox", "filter-junk-inbox" },
- { "folder_hierarchy_relative", "folder-hierarchy-relative" },
- { "imap_custom_headers", "fetch-headers-extra" },
- { "keep_on_server", "keep-on-server" },
- { "offline_sync", "stay-synchronized" },
- { "override_namespace", "use-namespace" },
- { "owa_path", "owa-path" },
- { "owa_url", "owa-url" },
- { "password_exp_warn_period", "password-exp-warn-period" },
- { "real_junk_path", "real-junk-path" },
- { "real_trash_path", "real-trash-path" },
- { "show_short_notation", "short-folder-names" },
- { "soap_port", "soap-port" },
- { "ssl", "security-method" },
- { "sync_offline", "stay-synchronized" },
- { "use_command", "use-shell-command" },
- { "use_idle", "use-idle" },
- { "use_lsub", "use-subscriptions" },
- { "use_qresync", "use-qresync" },
- { "use_ssl", "security-method" },
- { "xstatus", "use-xstatus-headers" }
- };
-
- const gchar *param;
- const gchar *use_param;
- gint ii;
-
- for (ii = 0; ii < G_N_ELEMENTS (camel_url_conversion); ii++) {
- const gchar *key;
- gpointer value;
-
- key = camel_url_conversion[ii].url_parameter;
- value = g_datalist_get_data (&url->params, key);
-
- if (value == NULL)
- continue;
-
- g_datalist_remove_no_notify (&url->params, key);
-
- key = camel_url_conversion[ii].property_name;
-
- /* Deal with a few special enum cases where
- * the parameter value also needs renamed. */
-
- if (strcmp (key, "all_headers") == 0) {
- GEnumClass *enum_class;
- GEnumValue *enum_value;
-
- enum_class = g_type_class_ref (
- CAMEL_TYPE_FETCH_HEADERS_TYPE);
- enum_value = g_enum_get_value (
- enum_class, CAMEL_FETCH_HEADERS_ALL);
- if (enum_value != NULL) {
- g_free (value);
- value = g_strdup (enum_value->value_nick);
- } else
- g_warn_if_reached ();
- g_type_class_unref (enum_class);
- }
-
- if (strcmp (key, "basic_headers") == 0) {
- GEnumClass *enum_class;
- GEnumValue *enum_value;
-
- enum_class = g_type_class_ref (
- CAMEL_TYPE_FETCH_HEADERS_TYPE);
- enum_value = g_enum_get_value (
- enum_class, CAMEL_FETCH_HEADERS_BASIC);
- if (enum_value != NULL) {
- g_free (value);
- value = g_strdup (enum_value->value_nick);
- } else
- g_warn_if_reached ();
- g_type_class_unref (enum_class);
- }
-
- if (strcmp (key, "imap_custom_headers") == 0)
- g_strdelimit (value, " ", ',');
-
- if (strcmp (key, "security-method") == 0) {
- CamelNetworkSecurityMethod method;
- GEnumClass *enum_class;
- GEnumValue *enum_value;
-
- if (strcmp (value, "always") == 0)
- method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT;
- else if (strcmp (value, "1") == 0)
- method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT;
- else if (strcmp (value, "when-possible") == 0)
- method = CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT;
- else
- method = CAMEL_NETWORK_SECURITY_METHOD_NONE;
-
- enum_class = g_type_class_ref (
- CAMEL_TYPE_NETWORK_SECURITY_METHOD);
- enum_value = g_enum_get_value (enum_class, method);
- if (enum_value != NULL) {
- g_free (value);
- value = g_strdup (enum_value->value_nick);
- } else
- g_warn_if_reached ();
- g_type_class_unref (enum_class);
- }
-
- g_datalist_set_data_full (&url->params, key, value, g_free);
- }
-
- /* A few more adjustments...
- *
- * These are all CAMEL_PROVIDER_CONF_CHECKSPIN settings. The spin
- * button value is bound to "param" and the checkbox state is bound
- * to "use-param". The "use-param" settings are new. If "param"
- * exists but no "use-param", then set "use-param" to "true". */
-
- param = g_datalist_get_data (&url->params, "gc-results-limit");
- use_param = g_datalist_get_data (&url->params, "use-gc-results-limit");
- if (param != NULL && *param != '\0' && use_param == NULL) {
- g_datalist_set_data_full (
- &url->params, "use-gc-results-limit",
- g_strdup ("true"), (GDestroyNotify) g_free);
- }
-
- param = g_datalist_get_data (&url->params, "kerberos");
- if (g_strcmp0 (param, "required") == 0) {
- g_datalist_set_data_full (
- &url->params, "kerberos",
- g_strdup ("true"), (GDestroyNotify) g_free);
- }
-
- param = g_datalist_get_data (
- &url->params, "password-exp-warn-period");
- use_param = g_datalist_get_data (
- &url->params, "use-password-exp-warn-period");
- if (param != NULL && *param != '\0' && use_param == NULL) {
- g_datalist_set_data_full (
- &url->params, "use-password-exp-warn-period",
- g_strdup ("true"), (GDestroyNotify) g_free);
- }
-
- param = g_datalist_get_data (&url->params, "real-junk-path");
- use_param = g_datalist_get_data (&url->params, "use-real-junk-path");
- if (param != NULL && *param != '\0' && use_param == NULL) {
- g_datalist_set_data_full (
- &url->params, "use-real-junk-path",
- g_strdup ("true"), (GDestroyNotify) g_free);
- }
-
- param = g_datalist_get_data (&url->params, "real-trash-path");
- use_param = g_datalist_get_data (&url->params, "use-real-trash-path");
- if (param != NULL && *param != '\0' && use_param == NULL) {
- g_datalist_set_data_full (
- &url->params, "use-real-trash-path",
- g_strdup ("true"), (GDestroyNotify) g_free);
- }
-}
-
-static void
-em_rename_account_params (void)
-{
- EAccountList *account_list;
- EIterator *iterator;
-
- /* XXX As of 3.2, CamelServices store settings in GObject properties,
- * not CamelURL parameters. CamelURL parameters are still used
- * for storage in GConf until we can move account information to
- * key files, but this is only within Evolution. Some of the new
- * GObject property names differ from the old CamelURL parameter
- * names. This routine renames the CamelURL parameter names to
- * the GObject property names for all accounts, both the source
- * and tranport URLs. */
-
- account_list = e_get_account_list ();
- iterator = e_list_get_iterator (E_LIST (account_list));
-
- while (e_iterator_is_valid (iterator)) {
- EAccount *account;
- CamelURL *url = NULL;
-
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iterator);
-
- if (account->source->url != NULL)
- url = camel_url_new (account->source->url, NULL);
-
- if (url != NULL) {
- em_rename_camel_url_params (url);
- g_free (account->source->url);
- account->source->url = camel_url_to_string (url, 0);
- camel_url_free (url);
- }
-
- url = NULL;
-
- if (account->transport->url != NULL)
- url = camel_url_new (account->transport->url, NULL);
-
- if (url != NULL) {
- em_rename_camel_url_params (url);
- g_free (account->transport->url);
- account->transport->url = camel_url_to_string (url, 0);
- camel_url_free (url);
- }
-
- e_iterator_next (iterator);
- }
-
- g_object_unref (iterator);
- e_account_list_save (account_list);
+#endif /* ACCOUNT_MGMT */
}
static gboolean
@@ -1209,10 +976,6 @@ e_mail_migrate (EShellBackend *shell_backend,
em_ensure_proxy_ignore_hosts_being_list ();
}
- /* Rename account URL parameters to
- * match CamelSettings property names. */
- em_rename_account_params ();
-
if (!migrate_local_store (shell_backend))
return FALSE;
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index 0098462..b4e100f 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -786,6 +786,7 @@ mail_paned_view_update_view_instance (EMailView *view)
EShellWindow *shell_window;
EShellViewClass *shell_view_class;
EShellSettings *shell_settings;
+ ESourceRegistry *registry;
GalViewCollection *view_collection;
GalViewInstance *view_instance;
CamelFolder *folder;
@@ -803,6 +804,7 @@ mail_paned_view_update_view_instance (EMailView *view)
shell_window = e_shell_view_get_shell_window (shell_view);
shell = e_shell_window_get_shell (shell_window);
+ registry = e_shell_get_registry (shell);
shell_settings = e_shell_get_shell_settings (shell);
reader = E_MAIL_READER (view);
@@ -821,9 +823,9 @@ mail_paned_view_update_view_instance (EMailView *view)
e_filename_make_safe (view_id);
outgoing_folder =
- em_utils_folder_is_drafts (folder) ||
- em_utils_folder_is_outbox (folder) ||
- em_utils_folder_is_sent (folder);
+ em_utils_folder_is_drafts (registry, folder) ||
+ em_utils_folder_is_outbox (registry, folder) ||
+ em_utils_folder_is_sent (registry, folder);
if (e_shell_settings_get_boolean (shell_settings, "mail-global-view-setting"))
view_instance = e_shell_view_new_view_instance (
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index bd51c97..91530af 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -30,6 +30,7 @@
#include <glib/gi18n.h>
#include <libxml/tree.h>
#include <gtkhtml/gtkhtml.h>
+#include <gconf/gconf-client.h>
#include <camel/camel.h>
#include "e-util/e-alert-dialog.h"
@@ -342,7 +343,9 @@ copy_tree_state (EMailReader *src_reader,
guint
e_mail_reader_open_selected (EMailReader *reader)
{
+ EShell *shell;
EMailBackend *backend;
+ ESourceRegistry *registry;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *views;
@@ -352,6 +355,9 @@ e_mail_reader_open_selected (EMailReader *reader)
g_return_val_if_fail (E_IS_MAIL_READER (reader), 0);
backend = e_mail_reader_get_backend (reader);
+ shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
+ registry = e_shell_get_registry (shell);
+
folder = e_mail_reader_get_folder (reader);
uids = e_mail_reader_get_selected_uids (reader);
window = e_mail_reader_get_window (reader);
@@ -361,9 +367,9 @@ e_mail_reader_open_selected (EMailReader *reader)
return 0;
}
- if (em_utils_folder_is_drafts (folder) ||
- em_utils_folder_is_outbox (folder) ||
- em_utils_folder_is_templates (folder)) {
+ if (em_utils_folder_is_drafts (registry, folder) ||
+ em_utils_folder_is_outbox (registry, folder) ||
+ em_utils_folder_is_templates (registry, folder)) {
em_utils_edit_messages (reader, folder, uids, TRUE);
return uids->len;
}
@@ -390,8 +396,8 @@ e_mail_reader_open_selected (EMailReader *reader)
CAMEL_VEE_FOLDER (folder),
(CamelVeeMessageInfo *) info, &real_uid);
- if (em_utils_folder_is_drafts (real_folder) ||
- em_utils_folder_is_outbox (real_folder)) {
+ if (em_utils_folder_is_drafts (registry, real_folder) ||
+ em_utils_folder_is_outbox (registry, real_folder)) {
GPtrArray *edits;
edits = g_ptr_array_new ();
@@ -1149,9 +1155,12 @@ void
e_mail_reader_create_filter_from_selected (EMailReader *reader,
gint filter_type)
{
+ EShell *shell;
EActivity *activity;
+ EMailBackend *backend;
AsyncContext *context;
GCancellable *cancellable;
+ ESourceRegistry *registry;
CamelFolder *folder;
GPtrArray *uids;
const gchar *filter_source;
@@ -1159,12 +1168,16 @@ e_mail_reader_create_filter_from_selected (EMailReader *reader,
g_return_if_fail (E_IS_MAIL_READER (reader));
+ backend = e_mail_reader_get_backend (reader);
+ shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
+ registry = e_shell_get_registry (shell);
+
folder = e_mail_reader_get_folder (reader);
g_return_if_fail (CAMEL_IS_FOLDER (folder));
- if (em_utils_folder_is_sent (folder))
+ if (em_utils_folder_is_sent (registry, folder))
filter_source = E_FILTER_SOURCE_OUTGOING;
- else if (em_utils_folder_is_outbox (folder))
+ else if (em_utils_folder_is_outbox (registry, folder))
filter_source = E_FILTER_SOURCE_OUTGOING;
else
filter_source = E_FILTER_SOURCE_INCOMING;
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 12e3a8a..124e082 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -28,11 +28,12 @@
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
+#include <libedataserver/e-source-mail-account.h>
+
#ifdef HAVE_XFREE
#include <X11/XF86keysym.h>
#endif
-#include "e-util/e-account-utils.h"
#include "e-util/e-charset.h"
#include "e-util/e-util.h"
#include "e-util/e-alert-dialog.h"
@@ -752,6 +753,9 @@ static void
action_mail_message_edit_cb (GtkAction *action,
EMailReader *reader)
{
+ EShell *shell;
+ EMailBackend *backend;
+ ESourceRegistry *registry;
CamelFolder *folder;
GPtrArray *uids;
gboolean replace;
@@ -760,11 +764,15 @@ action_mail_message_edit_cb (GtkAction *action,
uids = e_mail_reader_get_selected_uids (reader);
g_return_if_fail (uids != NULL);
+ backend = e_mail_reader_get_backend (reader);
+ shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
+ registry = e_shell_get_registry (shell);
+
/* XXX Either e_mail_reader_get_selected_uids()
* or MessageList should do this itself. */
g_ptr_array_set_free_func (uids, (GDestroyNotify) g_free);
- replace = em_utils_folder_is_drafts (folder);
+ replace = em_utils_folder_is_drafts (registry, folder);
em_utils_edit_messages (reader, folder, uids, replace);
g_ptr_array_unref (uids);
@@ -2797,6 +2805,7 @@ mail_reader_set_folder (EMailReader *reader,
EMailReaderPrivate *priv;
EMFormatHTML *formatter;
CamelFolder *previous_folder;
+ ESourceRegistry *registry;
GtkWidget *message_list;
EMailBackend *backend;
EShell *shell;
@@ -2804,13 +2813,14 @@ mail_reader_set_folder (EMailReader *reader,
priv = E_MAIL_READER_GET_PRIVATE (reader);
- backend = e_mail_reader_get_backend (reader);
formatter = e_mail_reader_get_formatter (reader);
message_list = e_mail_reader_get_message_list (reader);
previous_folder = e_mail_reader_get_folder (reader);
+ backend = e_mail_reader_get_backend (reader);
shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
+ registry = e_shell_get_registry (shell);
/* Only synchronize the folder if we're online. */
if (previous_folder != NULL && e_shell_get_online (shell))
@@ -2821,9 +2831,9 @@ mail_reader_set_folder (EMailReader *reader,
return;
outgoing = folder != NULL && (
- em_utils_folder_is_drafts (folder) ||
- em_utils_folder_is_outbox (folder) ||
- em_utils_folder_is_sent (folder));
+ em_utils_folder_is_drafts (registry, folder) ||
+ em_utils_folder_is_outbox (registry, folder) ||
+ em_utils_folder_is_sent (registry, folder));
/* FIXME Need to pass a GCancellable. */
em_format_format (EM_FORMAT (formatter), NULL, NULL, NULL, NULL);
@@ -3799,9 +3809,14 @@ e_mail_reader_changed (EMailReader *reader)
guint32
e_mail_reader_check_state (EMailReader *reader)
{
+ EShell *shell;
GPtrArray *uids;
CamelFolder *folder;
CamelStore *store = NULL;
+ EMailBackend *backend;
+ ESourceRegistry *registry;
+ GList *list, *iter;
+ const gchar *extension_name;
const gchar *tag;
gboolean can_clear_flags = FALSE;
gboolean can_flag_completed = FALSE;
@@ -3815,6 +3830,7 @@ e_mail_reader_check_state (EMailReader *reader)
gboolean has_undeleted = FALSE;
gboolean has_unimportant = FALSE;
gboolean has_unread = FALSE;
+ gboolean have_enabled_account = FALSE;
gboolean drafts_or_outbox = FALSE;
gboolean store_supports_vjunk = FALSE;
gboolean is_mailing_list;
@@ -3824,6 +3840,10 @@ e_mail_reader_check_state (EMailReader *reader)
g_return_val_if_fail (E_IS_MAIL_READER (reader), 0);
+ backend = e_mail_reader_get_backend (reader);
+ shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
+ registry = e_shell_get_registry (shell);
+
folder = e_mail_reader_get_folder (reader);
uids = e_mail_reader_get_selected_uids (reader);
@@ -3833,8 +3853,8 @@ e_mail_reader_check_state (EMailReader *reader)
is_junk_folder =
(folder->folder_flags & CAMEL_FOLDER_IS_JUNK) != 0;
drafts_or_outbox =
- em_utils_folder_is_drafts (folder) ||
- em_utils_folder_is_outbox (folder);
+ em_utils_folder_is_drafts (registry, folder) ||
+ em_utils_folder_is_outbox (registry, folder);
}
/* Initialize this flag based on whether there are any
@@ -3919,7 +3939,21 @@ e_mail_reader_check_state (EMailReader *reader)
camel_folder_free_message_info (folder, info);
}
- if (e_get_any_enabled_account () != NULL)
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+ ESource *source = E_SOURCE (iter->data);
+
+ if (e_source_get_enabled (source)) {
+ have_enabled_account = TRUE;
+ break;
+ }
+ }
+
+ g_list_free (list);
+
+ if (have_enabled_account)
state |= E_MAIL_READER_HAVE_ENABLED_ACCOUNT;
if (uids->len == 1)
state |= E_MAIL_READER_SELECTION_SINGLE;
diff --git a/mail/e-mail-session-utils.c b/mail/e-mail-session-utils.c
index f1c27a3..15f211d 100644
--- a/mail/e-mail-session-utils.c
+++ b/mail/e-mail-session-utils.c
@@ -25,10 +25,10 @@
#include "em-utils.h"
#include <glib/gi18n-lib.h>
+#include <libedataserver/e-source-mail-submission.h>
#include <mail/mail-tools.h>
#include <mail/e-mail-folder-utils.h>
-#include <e-util/e-account-utils.h>
#include <filter/e-filter-rule.h>
/* X-Mailer header value */
@@ -642,7 +642,8 @@ e_mail_session_send_to (EMailSession *session,
CamelAddress *recipients;
CamelMedium *medium;
CamelMessageInfo *info;
- EAccount *account = NULL;
+ ESourceRegistry *registry;
+ ESource *source;
GPtrArray *post_to_uris;
struct _camel_header_raw *xev;
struct _camel_header_raw *header;
@@ -655,6 +656,8 @@ e_mail_session_send_to (EMailSession *session,
g_return_if_fail (E_IS_MAIL_SESSION (session));
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
+ registry = e_mail_session_get_registry (session);
+
medium = CAMEL_MEDIUM (message);
camel_medium_set_header (medium, "X-Mailer", X_MAILER);
@@ -663,28 +666,25 @@ e_mail_session_send_to (EMailSession *session,
/* Extract directives from X-Evolution headers. */
- string = camel_header_raw_find (&xev, "X-Evolution-Account", NULL);
+ string = camel_header_raw_find (&xev, "X-Evolution-Identity", NULL);
if (string != NULL) {
- gchar *account_uid;
-
- account_uid = g_strstrip (g_strdup (string));
- account = e_get_account_by_uid (account_uid);
- g_free (account_uid);
+ gchar *uid = g_strstrip (g_strdup (string));
+ source = e_source_registry_lookup_by_uid (registry, uid);
+ g_free (uid);
}
- if (account != NULL) {
- if (account->transport != NULL) {
+ if (E_IS_SOURCE (source)) {
+ ESourceMailSubmission *extension;
+ const gchar *extension_name;
- /* XXX Transport UIDs are kludgy right now. We
- * use the EAccount's regular UID and tack on
- * "-transport". Will be better soon. */
- transport_uid = g_strconcat (
- account->uid, "-transport", NULL);
+ extension_name = E_SOURCE_EXTENSION_MAIL_SUBMISSION;
+ extension = e_source_get_extension (source, extension_name);
- /* to reprompt password on sending if needed */
- account->transport->get_password_canceled = FALSE;
- }
- sent_folder_uri = g_strdup (account->sent_folder_uri);
+ string = e_source_mail_submission_get_sent_folder (extension);
+ sent_folder_uri = g_strdup (string);
+
+ string = e_source_mail_submission_get_transport_uid (extension);
+ transport_uid = g_strdup (string);
}
string = camel_header_raw_find (&xev, "X-Evolution-Fcc", NULL);
diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c
index 042a71a..516fa67 100644
--- a/mail/e-mail-session.c
+++ b/mail/e-mail-session.c
@@ -45,10 +45,17 @@
#include <libedataserver/e-flag.h>
#include <libedataserver/e-proxy.h>
#include <libebackend/e-extensible.h>
+#include <libedataserver/e-source-authentication.h>
+#include <libedataserver/e-source-camel.h>
+#include <libedataserver/e-source-mail-account.h>
+#include <libedataserver/e-source-mail-identity.h>
+#include <libedataserver/e-source-mail-submission.h>
+#include <libedataserver/e-source-mail-transport.h>
+#include <libedataserver/e-source-password.h>
+#include <libedataserver/e-source-refresh.h>
#include <libedataserverui/e-passwords.h>
#include "e-util/e-util.h"
-#include "e-util/e-account-utils.h"
#include "e-util/e-alert-dialog.h"
#include "e-util/e-util-private.h"
@@ -58,12 +65,14 @@
#include "shell/e-shell-window.h"
#include "e-mail-account-store.h"
+#include "e-mail-authenticator.h"
#include "e-mail-folder-utils.h"
#include "e-mail-junk-filter.h"
#include "e-mail-session.h"
#include "em-composer-utils.h"
#include "em-filter-context.h"
#include "em-filter-rule.h"
+#include "em-folder-tree-model.h"
#include "em-utils.h"
#include "mail-config.h"
#include "mail-mt.h"
@@ -81,10 +90,14 @@ typedef struct _SourceContext SourceContext;
struct _EMailSessionPrivate {
EMailAccountStore *account_store;
MailFolderCache *folder_cache;
+ ESourceRegistry *registry;
- EAccountList *account_list;
- gulong account_added_handler_id;
- gulong account_changed_handler_id;
+ /* ESource UID -> Timeout ID */
+ GHashTable *auto_refresh_table;
+
+ gulong source_added_handler_id;
+ gulong source_changed_handler_id;
+ gulong source_removed_handler_id;
CamelStore *local_store;
CamelStore *vfolder_store;
@@ -119,6 +132,7 @@ enum {
PROP_FOLDER_CACHE,
PROP_JUNK_FILTER_NAME,
PROP_LOCAL_STORE,
+ PROP_REGISTRY,
PROP_VFOLDER_STORE
};
@@ -562,21 +576,66 @@ source_context_free (SourceContext *context)
}
static gchar *
-mail_session_make_key (CamelService *service,
- const gchar *item)
+mail_session_resolve_popb4smtp (ESourceRegistry *registry,
+ CamelService *smtp_service)
{
- gchar *key;
+ GList *list, *link;
+ const gchar *extension_name;
+ const gchar *smtp_uid;
+ gchar *pop_uid = NULL;
+
+ /* Find a POP account that uses the given smtp_service as its
+ * transport. XXX This isn't foolproof though, since we don't
+ * check that the POP server is at the same domain as the SMTP
+ * server, which is kind of the point of POPB4SMTP. */
+
+ smtp_uid = camel_service_get_uid (smtp_service);
- if (service != NULL) {
- CamelURL *url;
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ list = e_source_registry_list_sources (registry, extension_name);
- url = camel_service_new_camel_url (service);
- key = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
- camel_url_free (url);
- } else
- key = g_strdup (item);
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESourceExtension *extension;
+ const gchar *backend_name;
+ const gchar *uid;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ extension = e_source_get_extension (source, extension_name);
- return key;
+ /* We're only interested in POP accounts. */
+
+ backend_name = e_source_backend_get_backend_name (
+ E_SOURCE_BACKEND (extension));
+ if (g_strcmp0 (backend_name, "pop") != 0)
+ continue;
+
+ /* Get the mail account's default mail identity. */
+
+ source = e_source_mail_account_get_identity (
+ E_SOURCE_MAIL_ACCOUNT (extension));
+ if (source == NULL)
+ continue;
+
+ /* Get the mail identity's default mail transport. */
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_SUBMISSION;
+ extension = e_source_get_extension (source, extension_name);
+
+ uid = e_source_mail_submission_get_transport_uid (
+ E_SOURCE_MAIL_SUBMISSION (extension));
+ if (uid == NULL)
+ continue;
+
+ if (g_strcmp0 (uid, smtp_uid) == 0) {
+ pop_uid = g_strdup (uid);
+ break;
+ }
+ }
+
+ g_list_free (list);
+
+ return pop_uid;
}
static void
@@ -651,134 +710,133 @@ mail_session_set_junk_filter_name (EMailSession *session,
}
static void
-mail_session_add_by_account (EMailSession *session,
- EAccount *account)
+mail_session_refresh_cb (ESource *source,
+ CamelSession *session)
{
- CamelService *service = NULL;
- CamelProvider *provider;
- CamelURL *url;
- gboolean transport_only;
- GError *error = NULL;
-
- /* check whether it's transport-only accounts */
- transport_only =
- (account->source == NULL) ||
- (account->source->url == NULL) ||
- (*account->source->url == '\0');
- if (transport_only)
- goto handle_transport;
-
- /* Load the service, but don't connect. Check its provider,
- * and if this belongs in the folder tree model, add it. */
-
- url = camel_url_new (account->source->url, NULL);
- if (url != NULL) {
- provider = camel_provider_get (url->protocol, NULL);
- camel_url_free (url);
- } else {
- provider = NULL;
- }
+ CamelService *service;
+ const gchar *uid;
- if (provider == NULL) {
- /* In case we do not have a provider here, we handle
- * the special case of having multiple mail identities
- * eg. a dummy account having just SMTP server defined */
- goto handle_transport;
- }
+ uid = e_source_get_uid (source);
+ service = camel_session_get_service (session, uid);
+ g_return_if_fail (CAMEL_IS_SERVICE (service));
- service = camel_session_add_service (
- CAMEL_SESSION (session),
- account->uid, provider->protocol,
- CAMEL_PROVIDER_STORE, &error);
+ g_debug ("*** Refreshing %s ***",
+ e_source_get_display_name (source));
- if (error != NULL) {
- g_warning (
- "Failed to add service: %s: %s",
- account->name, error->message);
- g_error_free (error);
- return;
- }
+ if (camel_session_get_online (session))
+ mail_receive_service (service);
+}
- camel_service_set_display_name (service, account->name);
+static void
+mail_session_add_from_source (EMailSession *session,
+ CamelProviderType type,
+ ESource *source)
+{
+ ESourceBackend *extension;
+ const gchar *uid;
+ const gchar *backend_name;
+ const gchar *display_name;
+ const gchar *extension_name;
+ GError *error = NULL;
-handle_transport:
+ switch (type) {
+ case CAMEL_PROVIDER_STORE:
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ break;
+ case CAMEL_PROVIDER_TRANSPORT:
+ extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
+ break;
+ default:
+ g_return_if_reached ();
+ }
- /* While we're at it, add the account's transport (if it has one)
- * to the CamelSession. The transport's UID is a kludge for now.
- * We take the EAccount's UID and tack on "-transport". */
+ uid = e_source_get_uid (source);
+ display_name = e_source_get_display_name (source);
- if (account->transport) {
- GError *transport_error = NULL;
+ extension = e_source_get_extension (source, extension_name);
+ backend_name = e_source_backend_get_backend_name (extension);
- url = camel_url_new (
- account->transport->url,
- &transport_error);
+ /* Sanity checks. */
+ g_return_if_fail (uid != NULL);
+ g_return_if_fail (backend_name != NULL);
- if (url != NULL) {
- provider = camel_provider_get (
- url->protocol, &transport_error);
- camel_url_free (url);
- } else
- provider = NULL;
+ /* Our own CamelSession.add_service() method will handle the
+ * resulting CamelService, so we don't need the return value. */
+ camel_session_add_service (
+ CAMEL_SESSION (session), uid,
+ backend_name, type, &error);
- if (provider != NULL) {
- gchar *transport_uid;
+ if (error != NULL) {
+ g_warning (
+ "Failed to add service '%s' (%s): %s",
+ display_name, uid, error->message);
+ g_error_free (error);
+ }
- transport_uid = g_strconcat (
- account->uid, "-transport", NULL);
+ /* Set up auto-refresh. */
+ extension_name = E_SOURCE_EXTENSION_REFRESH;
+ if (e_source_has_extension (source, extension_name)) {
+ guint timeout_id;
- camel_session_add_service (
- CAMEL_SESSION (session),
- transport_uid, provider->protocol,
- CAMEL_PROVIDER_TRANSPORT, &transport_error);
+ /* Transports should not have a refresh extension. */
+ g_warn_if_fail (type != CAMEL_PROVIDER_TRANSPORT);
- g_free (transport_uid);
- }
+ timeout_id = e_source_refresh_add_timeout (
+ source, NULL, (ESourceRefreshFunc)
+ mail_session_refresh_cb, session,
+ (GDestroyNotify) NULL);
- if (transport_error) {
- g_warning (
- "%s: Failed to add transport service: %s",
- G_STRFUNC, transport_error->message);
- g_error_free (transport_error);
- }
+ g_hash_table_insert (
+ session->priv->auto_refresh_table,
+ g_strdup (uid),
+ GUINT_TO_POINTER (timeout_id));
}
}
static void
-mail_session_account_added_cb (EAccountList *account_list,
- EAccount *account,
- EMailSession *session)
+mail_session_source_added_cb (ESourceRegistry *registry,
+ ESource *source,
+ EMailSession *session)
{
- mail_session_add_by_account (session, account);
+ CamelProviderType provider_type;
+ const gchar *extension_name;
+
+ provider_type = CAMEL_PROVIDER_STORE;
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+
+ if (e_source_has_extension (source, extension_name))
+ mail_session_add_from_source (session, provider_type, source);
+
+ provider_type = CAMEL_PROVIDER_TRANSPORT;
+ extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
+
+ if (e_source_has_extension (source, extension_name))
+ mail_session_add_from_source (session, provider_type, source);
}
static void
-mail_session_account_changed_cb (EAccountList *account_list,
- EAccount *account,
- EMailSession *session)
+mail_session_source_changed_cb (ESourceRegistry *registry,
+ ESource *source,
+ EMailSession *session)
{
EMFolderTreeModel *folder_tree_model;
CamelService *service;
+ const gchar *extension_name;
+ const gchar *uid;
- service = camel_session_get_service (
- CAMEL_SESSION (session), account->uid);
+ uid = e_source_get_uid (source);
- if (!CAMEL_IS_STORE (service))
+ /* We're only interested in mail account data sources. */
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ if (!e_source_has_extension (source, extension_name))
return;
- /* Update the display name of the corresponding CamelStore.
- * EMailAccountStore listens for "notify" signals from each
- * service so it will detect this and update the model.
- *
- * XXX If EAccount defined GObject properties we could just
- * bind EAccount:name to CamelService:display-name and
- * be done with it. Oh well.
- */
-
- camel_service_set_display_name (service, account->name);
+ /* There should be a CamelStore with the same UID. */
+ service = camel_session_get_service (CAMEL_SESSION (session), uid);
+ g_return_if_fail (CAMEL_IS_STORE (service));
/* Remove the store from the folder tree model and, if the
- * account is still enabled, re-add it. Easier than trying
+ * source is still enabled, re-add it. Easier than trying
* to update the model with the store in place.
*
* em_folder_tree_model_add_store() already knows which types
@@ -790,16 +848,35 @@ mail_session_account_changed_cb (EAccountList *account_list,
em_folder_tree_model_remove_store (
folder_tree_model, CAMEL_STORE (service));
- if (account->enabled)
+ if (e_source_get_enabled (source))
em_folder_tree_model_add_store (
folder_tree_model, CAMEL_STORE (service));
}
+static void
+mail_session_source_removed_cb (ESourceRegistry *registry,
+ ESource *source,
+ EMailSession *session)
+{
+ CamelSession *camel_session;
+ CamelService *service;
+ const gchar *uid;
+
+ camel_session = CAMEL_SESSION (session);
+
+ uid = e_source_get_uid (source);
+ service = camel_session_get_service (camel_session, uid);
+
+ if (CAMEL_IS_SERVICE (service))
+ camel_session_remove_service (camel_session, service);
+}
+
static gboolean
-mail_session_add_service_cb (SourceContext *context)
+mail_session_add_service_idle_cb (SourceContext *context)
{
EMailAccountStore *store;
+ /* The CamelService should be fully initialized by now. */
store = e_mail_session_get_account_store (context->session);
e_mail_account_store_add_service (store, context->service);
@@ -915,6 +992,90 @@ mail_session_add_vfolder_store (EMailSession *session)
}
static void
+mail_session_force_refresh (EMailSession *session)
+{
+ ESourceRegistry *registry;
+ GHashTableIter iter;
+ GSettings *settings;
+ gboolean unconditionally;
+ gpointer key;
+
+ /* Only refresh when the session is online. */
+ if (!camel_session_get_online (CAMEL_SESSION (session)))
+ return;
+
+ /* FIXME EMailSession should define properties for these. */
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ unconditionally =
+ g_settings_get_boolean (settings, "send-recv-on-start") &&
+ g_settings_get_boolean (settings, "send-recv-all-on-start");
+ g_object_unref (settings);
+
+ registry = e_mail_session_get_registry (session);
+ g_hash_table_iter_init (&iter, session->priv->auto_refresh_table);
+
+ while (g_hash_table_iter_next (&iter, &key, NULL)) {
+ ESource *source;
+ ESourceRefresh *extension;
+ const gchar *extension_name;
+ gboolean refresh_enabled;
+
+ /* The hash table key is the ESource UID. */
+ source = e_source_registry_lookup_by_uid (registry, key);
+
+ if (source == NULL)
+ continue;
+
+ extension_name = E_SOURCE_EXTENSION_REFRESH;
+ extension = e_source_get_extension (source, extension_name);
+ refresh_enabled = e_source_refresh_get_enabled (extension);
+
+ if (refresh_enabled || unconditionally)
+ e_source_refresh_force_timeout (source);
+ }
+}
+
+static void
+mail_session_cancel_refresh (EMailSession *session)
+{
+ ESourceRegistry *registry;
+ GHashTableIter iter;
+ gpointer key, value;
+
+ registry = e_mail_session_get_registry (session);
+ g_hash_table_iter_init (&iter, session->priv->auto_refresh_table);
+
+ while (g_hash_table_iter_next (&iter, &key, &value)) {
+ ESource *source;
+ guint timeout_id;
+
+ /* The hash table key is the ESource UID. */
+ source = e_source_registry_lookup_by_uid (registry, key);
+
+ /* The hash table value is the refresh timeout ID. */
+ timeout_id = GPOINTER_TO_UINT (value);
+
+ if (source == NULL)
+ continue;
+
+ e_source_refresh_remove_timeout (source, timeout_id);
+ }
+
+ /* All timeouts cancelled so clear the auto-refresh table. */
+ g_hash_table_remove_all (session->priv->auto_refresh_table);
+}
+
+static void
+mail_session_set_registry (EMailSession *session,
+ ESourceRegistry *registry)
+{
+ g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
+ g_return_if_fail (session->priv->registry == NULL);
+
+ session->priv->registry = g_object_ref (registry);
+}
+
+static void
mail_session_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -926,6 +1087,12 @@ mail_session_set_property (GObject *object,
E_MAIL_SESSION (object),
g_value_get_string (value));
return;
+
+ case PROP_REGISTRY:
+ mail_session_set_registry (
+ E_MAIL_SESSION (object),
+ g_value_get_object (value));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -966,6 +1133,13 @@ mail_session_get_property (GObject *object,
E_MAIL_SESSION (object)));
return;
+ case PROP_REGISTRY:
+ g_value_set_object (
+ value,
+ e_mail_session_get_registry (
+ E_MAIL_SESSION (object)));
+ return;
+
case PROP_VFOLDER_STORE:
g_value_set_object (
value,
@@ -995,15 +1169,22 @@ mail_session_dispose (GObject *object)
priv->folder_cache = NULL;
}
- if (priv->account_list != NULL) {
+ if (priv->registry != NULL) {
g_signal_handler_disconnect (
- priv->account_list,
- priv->account_added_handler_id);
+ priv->registry,
+ priv->source_added_handler_id);
g_signal_handler_disconnect (
- priv->account_list,
- priv->account_changed_handler_id);
- g_object_unref (priv->account_list);
- priv->account_list = NULL;
+ priv->registry,
+ priv->source_changed_handler_id);
+ g_signal_handler_disconnect (
+ priv->registry,
+ priv->source_removed_handler_id);
+
+ /* This requires the registry. */
+ mail_session_cancel_refresh (E_MAIL_SESSION (object));
+
+ g_object_unref (priv->registry);
+ priv->registry = NULL;
}
if (priv->local_store != NULL) {
@@ -1030,6 +1211,7 @@ mail_session_finalize (GObject *object)
priv = E_MAIL_SESSION_GET_PRIVATE (object);
+ g_hash_table_destroy (priv->auto_refresh_table);
g_hash_table_destroy (priv->junk_filters);
g_object_unref (priv->proxy);
@@ -1049,6 +1231,10 @@ mail_session_notify (GObject *object,
{
/* GObject does not implement this method; do not chain up. */
+ /* CamelSession defines this property. */
+ if (g_strcmp0 (pspec->name, "online") == 0)
+ mail_session_force_refresh (E_MAIL_SESSION (object));
+
/* XXX Delete this once Evolution moves to GSettings and
* we're able to get rid of PROP_JUNK_FILTER_NAME. */
if (g_strcmp0 (pspec->name, "junk-filter") == 0)
@@ -1061,22 +1247,20 @@ mail_session_constructed (GObject *object)
EMFolderTreeModel *folder_tree_model;
EMailSession *session;
EExtensible *extensible;
+ ESourceRegistry *registry;
GType extension_type;
GList *list, *link;
GSettings *settings;
- EAccountList *account_list;
- EIterator *iter;
- EAccount *account;
+ CamelProviderType provider_type;
+ const gchar *extension_name;
gulong handler_id;
session = E_MAIL_SESSION (object);
+ registry = e_mail_session_get_registry (session);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_mail_session_parent_class)->constructed (object);
- account_list = e_get_account_list ();
- session->priv->account_list = g_object_ref (account_list);
-
session->priv->account_store = e_mail_account_store_new (session);
/* This must be created after the account store. */
@@ -1099,44 +1283,52 @@ mail_session_constructed (GObject *object)
mail_session_add_local_store (session);
mail_session_add_vfolder_store (session);
- /* Load user-defined mail accounts. */
+ /* Add user-defined mail accounts. */
- iter = e_list_get_iterator (E_LIST (account_list));
+ provider_type = CAMEL_PROVIDER_STORE;
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
- while (e_iterator_is_valid (iter)) {
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iter);
+ list = e_source_registry_list_sources (registry, extension_name);
- mail_session_add_by_account (session, account);
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
- e_iterator_next (iter);
+ mail_session_add_from_source (session, provider_type, source);
}
- g_object_unref (iter);
+ g_list_free (list);
+
+ /* Add user-defined mail transports. */
- /* Initialize which account is default. */
+ provider_type = CAMEL_PROVIDER_TRANSPORT;
+ extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
- account = e_get_default_account ();
- if (account != NULL) {
- CamelService *service;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
- service = camel_session_get_service (
- CAMEL_SESSION (session), account->uid);
- e_mail_account_store_set_default_service (
- session->priv->account_store, service);
+ mail_session_add_from_source (session, provider_type, source);
}
- /* Listen for account list updates. */
+ g_list_free (list);
+
+ /* Listen for registry changes. */
handler_id = g_signal_connect (
- account_list, "account-added",
- G_CALLBACK (mail_session_account_added_cb), session);
- session->priv->account_added_handler_id = handler_id;
+ registry, "source-added",
+ G_CALLBACK (mail_session_source_added_cb), session);
+ session->priv->source_added_handler_id = handler_id;
handler_id = g_signal_connect (
- account_list, "account-changed",
- G_CALLBACK (mail_session_account_changed_cb), session);
- session->priv->account_changed_handler_id = handler_id;
+ registry, "source-changed",
+ G_CALLBACK (mail_session_source_changed_cb), session);
+ session->priv->source_changed_handler_id = handler_id;
+
+ handler_id = g_signal_connect (
+ registry, "source-removed",
+ G_CALLBACK (mail_session_source_removed_cb), session);
+ session->priv->source_removed_handler_id = handler_id;
extensible = E_EXTENSIBLE (object);
e_extensible_load_extensions (extensible);
@@ -1185,14 +1377,26 @@ mail_session_constructed (GObject *object)
g_list_free (list);
+ settings = g_settings_new ("org.gnome.evolution.mail");
+
/* Bind the "junk-default-plugin" GSettings
* key to our "junk-filter-name" property. */
- settings = g_settings_new ("org.gnome.evolution.mail");
g_settings_bind (
settings, "junk-default-plugin",
object, "junk-filter-name",
G_SETTINGS_BIND_DEFAULT);
+
+ /* Start the first refresh if we're supposed to. */
+ if (g_settings_get_boolean (settings, "send-recv-on-start")) {
+ if (camel_session_get_online (CAMEL_SESSION (session))) {
+ mail_session_force_refresh (session);
+
+ /* Also flush the Outbox. */
+ mail_send (session);
+ }
+ }
+
g_object_unref (settings);
}
@@ -1203,55 +1407,51 @@ mail_session_add_service (CamelSession *session,
CamelProviderType type,
GError **error)
{
+ ESourceRegistry *registry;
CamelService *service;
+ registry = e_mail_session_get_registry (E_MAIL_SESSION (session));
+
/* Chain up to parents add_service() method. */
service = CAMEL_SESSION_CLASS (e_mail_session_parent_class)->
add_service (session, uid, protocol, type, error);
- /* Initialize the CamelSettings object from CamelURL parameters.
- * This is temporary; soon we'll read settings from key files. */
+ /* Configure the CamelService from the corresponding ESource. */
if (CAMEL_IS_SERVICE (service)) {
- EAccount *account;
- CamelURL *url = NULL;
-
- account = e_get_account_by_uid (uid);
- if (account != NULL) {
- const gchar *url_string = NULL;
-
- switch (type) {
- case CAMEL_PROVIDER_STORE:
- url_string = account->source->url;
- break;
- case CAMEL_PROVIDER_TRANSPORT:
- url_string = account->transport->url;
- break;
- default:
- break;
- }
+ ESource *source;
- if (url_string != NULL) {
- url = camel_url_new (url_string, error);
- if (url == NULL) {
- g_object_unref (service);
- service = NULL;
- }
- }
- }
+ /* We'd like to emit a warning if we fail to find an
+ * ESource with a matching UID, but we don't want to
+ * emit false positives. The built-in CamelServices
+ * ("local" and "vfolder") do not have corresponding
+ * ESources, so check for those cases first. */
- if (url != NULL) {
- CamelSettings *settings;
+ if (g_strcmp0 (uid, "local") == 0)
+ return service;
- settings = camel_service_get_settings (service);
- camel_settings_load_from_url (settings, url);
- camel_url_free (url);
+ if (g_strcmp0 (uid, "vfolder") == 0)
+ return service;
- /* Migrate files for this service from its old
- * URL-based directory to a UID-based directory
- * if necessary. */
- camel_service_migrate_files (service);
- }
+ /* Now we should get an ESource. Note we still return
+ * the CamelService even if we have to emit a warning. */
+
+ source = e_source_registry_lookup_by_uid (registry, uid);
+ g_return_val_if_fail (E_IS_SOURCE (source), service);
+
+ /* This handles all the messy property bindings. */
+ e_source_camel_configure_service (source, service);
+
+ g_object_bind_property (
+ source, "display-name",
+ service, "display-name",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+
+ /* Migrate files for this service from its old
+ * URL-based directory to a UID-based directory
+ * if necessary. */
+ camel_service_migrate_files (service);
}
/* Inform the EMailAccountStore of the new CamelService
@@ -1266,13 +1466,24 @@ mail_session_add_service (CamelSession *session,
g_idle_add_full (
G_PRIORITY_DEFAULT_IDLE,
- (GSourceFunc) mail_session_add_service_cb,
+ (GSourceFunc) mail_session_add_service_idle_cb,
context, (GDestroyNotify) source_context_free);
}
return service;
}
+static void
+mail_session_remove_service (CamelSession *session,
+ CamelService *service)
+{
+ EMailAccountStore *store;
+
+ /* Passing a NULL parent window skips confirmation prompts. */
+ store = e_mail_session_get_account_store (E_MAIL_SESSION (session));
+ e_mail_account_store_remove_service (store, NULL, service);
+}
+
static gchar *
mail_session_get_password (CamelSession *session,
CamelService *service,
@@ -1281,114 +1492,69 @@ mail_session_get_password (CamelSession *session,
guint32 flags,
GError **error)
{
- EAccount *account = NULL;
- const gchar *display_name = NULL;
- const gchar *uid = NULL;
- gchar *ret = NULL;
+ ESourceRegistry *registry;
+ gchar *password = NULL;
- if (CAMEL_IS_SERVICE (service)) {
- display_name = camel_service_get_display_name (service);
- uid = camel_service_get_uid (service);
- account = e_get_account_by_uid (uid);
- }
-
- if (!strcmp(item, "popb4smtp_uid")) {
- /* not 100% mt safe, but should be ok */
- ret = g_strdup ((account != NULL) ? account->uid : uid);
- } else {
- gchar *key = mail_session_make_key (service, item);
- EAccountService *config_service = NULL;
-
- ret = e_passwords_get_password (NULL, key);
- if (ret == NULL || (flags & CAMEL_SESSION_PASSWORD_REPROMPT)) {
- gboolean remember;
-
- g_free (ret);
- ret = NULL;
-
- if (account != NULL) {
- if (CAMEL_IS_STORE (service))
- config_service = account->source;
- if (CAMEL_IS_TRANSPORT (service))
- config_service = account->transport;
- }
+ /* XXX This method is now only for fringe cases. For normal
+ * CamelService authentication, use authenticate_sync().
+ *
+ * The two known fringe cases that still need this are:
+ *
+ * 1) CamelSaslPOPB4SMTP, where the CamelService is an SMTP
+ * transport and the item name is always "popb4smtp_uid".
+ * (This is a dirty hack, Camel just needs some way to
+ * pair up a CamelService and CamelTransport. Not sure
+ * what that should look like just yet...)
+ *
+ * 2) CamelGpgContext, where the CamelService is NULL and
+ * the item name is a user ID (I think). (Seahorse, or
+ * one of its dependent libraries, ought to handle this
+ * transparently once Camel fully transitions to GIO.)
+ */
- remember = config_service ? config_service->save_passwd : FALSE;
-
- if (!config_service || (config_service &&
- !config_service->get_password_canceled)) {
- guint32 eflags;
- gchar *title;
-
- if (flags & CAMEL_SESSION_PASSPHRASE) {
- if (display_name != NULL)
- title = g_strdup_printf (
- _("Enter Passphrase for %s"),
- display_name);
- else
- title = g_strdup (
- _("Enter Passphrase"));
- } else {
- if (display_name != NULL)
- title = g_strdup_printf (
- _("Enter Password for %s"),
- display_name);
- else
- title = g_strdup (
- _("Enter Password"));
- }
- if ((flags & CAMEL_SESSION_PASSWORD_STATIC) != 0)
- eflags = E_PASSWORDS_REMEMBER_NEVER;
- else if (config_service == NULL)
- eflags = E_PASSWORDS_REMEMBER_SESSION;
- else
- eflags = E_PASSWORDS_REMEMBER_FOREVER;
+ registry = e_mail_session_get_registry (E_MAIL_SESSION (session));
- if (flags & CAMEL_SESSION_PASSWORD_REPROMPT)
- eflags |= E_PASSWORDS_REPROMPT;
+ /* Handle the CamelSaslPOPB4SMTP case. */
+ if (g_strcmp0 (item, "popb4smtp_uid") == 0)
+ return mail_session_resolve_popb4smtp (registry, service);
- if (flags & CAMEL_SESSION_PASSWORD_SECRET)
- eflags |= E_PASSWORDS_SECRET;
+ /* Otherwise this had better be the CamelGpgContext case. */
+ g_return_val_if_fail (service == NULL, NULL);
- if (flags & CAMEL_SESSION_PASSPHRASE)
- eflags |= E_PASSWORDS_PASSPHRASE;
+ password = e_passwords_get_password (NULL, item);
- /* HACK: breaks abstraction ...
- * e_account_writable() doesn't use the
- * EAccount, it also uses the same writable
- * key for source and transport. */
- if (!e_account_writable (NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD))
- eflags |= E_PASSWORDS_DISABLE_REMEMBER;
+ if (password == NULL || (flags & CAMEL_SESSION_PASSWORD_REPROMPT)) {
+ gboolean remember;
+ guint eflags = 0;
- ret = e_passwords_ask_password (
- title, NULL, key, prompt,
- eflags, &remember, NULL);
+ if (flags & CAMEL_SESSION_PASSWORD_STATIC)
+ eflags |= E_PASSWORDS_REMEMBER_NEVER;
+ else
+ eflags |= E_PASSWORDS_REMEMBER_SESSION;
- if (!ret)
- e_passwords_forget_password (NULL, key);
+ if (flags & CAMEL_SESSION_PASSWORD_REPROMPT)
+ eflags |= E_PASSWORDS_REPROMPT;
- g_free (title);
+ if (flags & CAMEL_SESSION_PASSWORD_SECRET)
+ eflags |= E_PASSWORDS_SECRET;
- if (ret && config_service) {
- config_service->save_passwd = remember;
- e_account_list_save (e_get_account_list ());
- }
+ if (flags & CAMEL_SESSION_PASSPHRASE)
+ eflags |= E_PASSWORDS_PASSPHRASE;
- if (config_service)
- config_service->get_password_canceled = ret == NULL;
- }
- }
+ password = e_passwords_ask_password (
+ "", NULL, item, prompt, eflags, &remember, NULL);
- g_free (key);
+ if (password == NULL)
+ e_passwords_forget_password (NULL, item);
}
- if (ret == NULL)
+ if (password == NULL)
g_set_error (
error, G_IO_ERROR,
G_IO_ERROR_CANCELLED,
- _("User canceled operation."));
+ _("User cancelled operation"));
- return ret;
+ return password;
}
static gboolean
@@ -1397,13 +1563,13 @@ mail_session_forget_password (CamelSession *session,
const gchar *item,
GError **error)
{
- gchar *key;
+ /* XXX The only remaining user of this method is CamelGpgContext,
+ * which does not provide a CamelService. Use 'item' as the
+ * password key. */
- key = mail_session_make_key (service, item);
+ g_return_val_if_fail (service == NULL, FALSE);
- e_passwords_forget_password (NULL, key);
-
- g_free (key);
+ e_passwords_forget_password (NULL, item);
return TRUE;
}
@@ -1485,13 +1651,16 @@ mail_session_forward_to (CamelSession *session,
const gchar *address,
GError **error)
{
- EAccount *account;
+ ESource *source;
+ ESourceRegistry *registry;
+ ESourceMailIdentity *extension;
CamelMimeMessage *forward;
CamelStream *mem;
CamelInternetAddress *addr;
CamelFolder *out_folder;
CamelMessageInfo *info;
CamelMedium *medium;
+ const gchar *extension_name;
const gchar *from_address;
const gchar *from_name;
const gchar *header_name;
@@ -1505,22 +1674,27 @@ mail_session_forward_to (CamelSession *session,
if (!*address) {
g_set_error (
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
- _("No destination address provided, forward "
+ _("No destination address provided, forwarding "
"of the message has been cancelled."));
return FALSE;
}
- account = em_utils_guess_account_with_recipients (message, folder);
- if (!account) {
+ registry = e_mail_session_get_registry (E_MAIL_SESSION (session));
+
+ source = em_utils_guess_mail_identity_with_recipients (
+ registry, message, folder);
+ if (source == NULL) {
g_set_error (
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
- _("No account found to use, forward of the "
- "message has been cancelled."));
+ _("No identity found to use, forwarding "
+ "of the message has been cancelled."));
return FALSE;
}
- from_address = account->id->address;
- from_name = account->id->name;
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+ extension = e_source_get_extension (source, extension_name);
+ from_address = e_source_mail_identity_get_address (extension);
+ from_name = e_source_mail_identity_get_name (extension);
forward = camel_mime_message_new ();
@@ -1640,19 +1814,23 @@ mail_session_authenticate_sync (CamelSession *session,
GCancellable *cancellable,
GError **error)
{
+ ESource *source;
+ ESourceRegistry *registry;
+ ESourceAuthenticator *auth;
CamelServiceAuthType *authtype = NULL;
CamelAuthenticationResult result;
- CamelProvider *provider;
- CamelSettings *settings;
- const gchar *password;
- guint32 password_flags;
+ const gchar *uid;
+ gboolean authenticated;
GError *local_error = NULL;
/* Do not chain up. Camel's default method is only an example for
* subclasses to follow. Instead we mimic most of its logic here. */
- provider = camel_service_get_provider (service);
- settings = camel_service_get_settings (service);
+ registry = e_mail_session_get_registry (E_MAIL_SESSION (session));
+
+ /* Treat a mechanism name of "none" as NULL. */
+ if (g_strcmp0 (mechanism, "none") == 0)
+ mechanism = NULL;
/* APOP is one case where a non-SASL mechanism name is passed, so
* don't bail if the CamelServiceAuthType struct comes back NULL. */
@@ -1705,58 +1883,26 @@ mail_session_authenticate_sync (CamelSession *session,
g_clear_error (&local_error);
- password_flags = CAMEL_SESSION_PASSWORD_SECRET;
-
-retry:
- password = camel_service_get_password (service);
-
- if (password == NULL) {
- CamelNetworkSettings *network_settings;
- const gchar *host;
- const gchar *user;
- gchar *prompt;
- gchar *new_passwd;
+ /* Find a matching ESource for this CamelService. */
+ uid = camel_service_get_uid (service);
+ source = e_source_registry_lookup_by_uid (registry, uid);
- network_settings = CAMEL_NETWORK_SETTINGS (settings);
- host = camel_network_settings_get_host (network_settings);
- user = camel_network_settings_get_user (network_settings);
-
- prompt = camel_session_build_password_prompt (
- provider->name, user, host);
-
- new_passwd = camel_session_get_password (
- session, service, prompt, "password",
- password_flags, &local_error);
- camel_service_set_password (service, new_passwd);
- password = camel_service_get_password (service);
- g_free (new_passwd);
-
- g_free (prompt);
-
- if (local_error != NULL) {
- g_propagate_error (error, local_error);
- return FALSE;
- }
-
- if (password == NULL) {
- g_set_error (
- error, CAMEL_SERVICE_ERROR,
- CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
- _("No password was provided"));
- return FALSE;
- }
+ if (source == NULL) {
+ g_set_error (
+ error, CAMEL_SERVICE_ERROR,
+ CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
+ _("No data source found for UID '%s'"), uid);
+ return FALSE;
}
- result = camel_service_authenticate_sync (
- service, mechanism, cancellable, error);
+ auth = e_mail_authenticator_new (service, mechanism);
- if (result == CAMEL_AUTHENTICATION_REJECTED) {
- password_flags |= CAMEL_SESSION_PASSWORD_REPROMPT;
- camel_service_set_password (service, NULL);
- goto retry;
- }
+ authenticated = e_source_authenticate_sync (
+ source, auth, cancellable, error);
+
+ g_object_unref (auth);
- return (result == CAMEL_AUTHENTICATION_ACCEPTED);
+ return authenticated;
}
static void
@@ -1777,6 +1923,7 @@ e_mail_session_class_init (EMailSessionClass *class)
session_class = CAMEL_SESSION_CLASS (class);
session_class->add_service = mail_session_add_service;
+ session_class->remove_service = mail_session_remove_service;
session_class->get_password = mail_session_get_password;
session_class->forget_password = mail_session_forget_password;
session_class->alert_user = mail_session_alert_user;
@@ -1824,6 +1971,18 @@ e_mail_session_class_init (EMailSessionClass *class)
g_object_class_install_property (
object_class,
+ PROP_REGISTRY,
+ g_param_spec_object (
+ "registry",
+ "Registry",
+ "Data source registry",
+ E_TYPE_SOURCE_REGISTRY,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
PROP_VFOLDER_STORE,
g_param_spec_object (
"vfolder-store",
@@ -1848,13 +2007,21 @@ static void
e_mail_session_init (EMailSession *session)
{
GSettings *settings;
+ GHashTable *auto_refresh_table;
GHashTable *junk_filters;
+ auto_refresh_table = g_hash_table_new_full (
+ (GHashFunc) g_str_hash,
+ (GEqualFunc) g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) NULL);
+
junk_filters = g_hash_table_new (
(GHashFunc) g_str_hash,
(GEqualFunc) g_str_equal);
session->priv = E_MAIL_SESSION_GET_PRIVATE (session);
+ session->priv->auto_refresh_table = auto_refresh_table;
session->priv->junk_filters = junk_filters;
session->priv->proxy = e_proxy_new ();
@@ -1865,9 +2032,6 @@ e_mail_session_init (EMailSession *session)
g_ptr_array_new_with_free_func (
(GDestroyNotify) g_free);
- /* Initialize the EAccount setup. */
- e_account_writable (NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD);
-
settings = g_settings_new ("org.gnome.evolution.mail");
camel_session_set_check_junk (
@@ -1885,11 +2049,13 @@ e_mail_session_init (EMailSession *session)
}
EMailSession *
-e_mail_session_new (void)
+e_mail_session_new (ESourceRegistry *registry)
{
const gchar *user_data_dir;
const gchar *user_cache_dir;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+
user_data_dir = mail_session_get_data_dir ();
user_cache_dir = mail_session_get_cache_dir ();
@@ -1897,6 +2063,7 @@ e_mail_session_new (void)
E_TYPE_MAIL_SESSION,
"user-data-dir", user_data_dir,
"user-cache-dir", user_cache_dir,
+ "registry", registry,
NULL);
}
@@ -1910,6 +2077,14 @@ e_mail_session_add_activity (EMailSession *session,
g_signal_emit (session, signals[ACTIVITY_ADDED], 0, activity);
}
+ESourceRegistry *
+e_mail_session_get_registry (EMailSession *session)
+{
+ g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+
+ return session->priv->registry;
+}
+
EMailAccountStore *
e_mail_session_get_account_store (EMailSession *session)
{
@@ -2315,6 +2490,58 @@ e_mail_session_uri_to_folder_finish (EMailSession *session,
return g_object_ref (context->folder);
}
+gboolean
+e_binding_transform_service_to_source (GBinding *binding,
+ const GValue *source_value,
+ GValue *target_value,
+ gpointer session)
+{
+ CamelService *service;
+ ESourceRegistry *registry;
+ ESource *source;
+ const gchar *uid;
+
+ g_return_val_if_fail (G_IS_BINDING (binding), FALSE);
+ g_return_val_if_fail (E_IS_MAIL_SESSION (session), FALSE);
+
+ service = g_value_get_object (source_value);
+ g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
+
+ uid = camel_service_get_uid (service);
+ registry = e_mail_session_get_registry (session);
+ source = e_source_registry_lookup_by_uid (registry, uid);
+ g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
+
+ g_value_set_object (target_value, source);
+
+ return TRUE;
+}
+
+gboolean
+e_binding_transform_source_to_service (GBinding *binding,
+ const GValue *source_value,
+ GValue *target_value,
+ gpointer session)
+{
+ CamelService *service;
+ ESource *source;
+ const gchar *uid;
+
+ g_return_val_if_fail (G_IS_BINDING (binding), FALSE);
+ g_return_val_if_fail (E_IS_MAIL_SESSION (session), FALSE);
+
+ source = g_value_get_object (source_value);
+ g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
+
+ uid = e_source_get_uid (source);
+ service = camel_session_get_service (session, uid);
+ g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
+
+ g_value_set_object (target_value, service);
+
+ return TRUE;
+}
+
/******************************** Legacy API *********************************/
void
diff --git a/mail/e-mail-session.h b/mail/e-mail-session.h
index ccba826..33a9a68 100644
--- a/mail/e-mail-session.h
+++ b/mail/e-mail-session.h
@@ -30,6 +30,7 @@
#include <mail/e-mail-enums.h>
#include <mail/e-mail-account-store.h>
#include <mail/mail-folder-cache.h>
+#include <libedataserver/e-source-registry.h>
/* Standard GObject macros */
#define E_TYPE_MAIL_SESSION \
@@ -73,9 +74,11 @@ struct _EMailSessionClass {
};
GType e_mail_session_get_type (void);
-EMailSession * e_mail_session_new (void);
+EMailSession * e_mail_session_new (ESourceRegistry *registry);
void e_mail_session_add_activity (EMailSession *session,
EActivity *activity);
+ESourceRegistry *
+ e_mail_session_get_registry (EMailSession *session);
EMailAccountStore *
e_mail_session_get_account_store
(EMailSession *session);
@@ -135,6 +138,18 @@ CamelFolder * e_mail_session_uri_to_folder_finish
GAsyncResult *result,
GError **error);
+/* Useful GBinding transform functions */
+gboolean e_binding_transform_service_to_source
+ (GBinding *binding,
+ const GValue *source_value,
+ GValue *target_value,
+ gpointer session);
+gboolean e_binding_transform_source_to_service
+ (GBinding *binding,
+ const GValue *source_value,
+ GValue *target_value,
+ gpointer session);
+
/*** Legacy API ***/
void mail_session_flush_filter_log (EMailSession *session);
diff --git a/mail/e-mail.h b/mail/e-mail.h
index 02c169c..59c34d6 100644
--- a/mail/e-mail.h
+++ b/mail/e-mail.h
@@ -20,6 +20,7 @@
#define E_MAIL_H
#include <mail/e-mail-attachment-bar.h>
+#include <mail/e-mail-authenticator.h>
#include <mail/e-mail-backend.h>
#include <mail/e-mail-browser.h>
#include <mail/e-mail-display.h>
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 0f97548..c928528 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -43,18 +43,13 @@
#include <string.h>
#include <stdarg.h>
-#include <libedataserverui/e-passwords.h>
-
#include "shell/e-shell.h"
#include "e-util/e-util.h"
#include "e-util/e-alert-dialog.h"
-#include "e-util/e-account-utils.h"
#include "e-util/e-dialog-utils.h"
-#include "e-util/e-signature-list.h"
-#include "e-util/e-signature-utils.h"
#include "e-util/e-util-private.h"
#include "widgets/misc/e-auth-combo-box.h"
-#include "widgets/misc/e-signature-editor.h"
+#include "widgets/misc/e-mail-signature-editor.h"
#include "widgets/misc/e-port-entry.h"
#include "e-mail-backend.h"
@@ -143,8 +138,11 @@ typedef struct _EMAccountEditorService {
struct _EMAccountEditorPrivate {
EMailBackend *backend;
+ EMailSession *session;
+#if 0 /* ACCOUNT_MGMT */
EAccount *modified_account;
EAccount *original_account;
+#endif /* ACCOUNT_MGMT */
gboolean new_account;
struct _EMConfig *config;
@@ -240,9 +238,9 @@ struct _EMAccountEditorPrivate {
enum {
PROP_0,
- PROP_BACKEND,
PROP_MODIFIED_ACCOUNT,
PROP_ORIGINAL_ACCOUNT,
+ PROP_SESSION,
PROP_STORE_PROVIDER,
PROP_STORE_REQUIRES_AUTH,
PROP_STORE_SETTINGS,
@@ -274,6 +272,7 @@ emae_config_target_changed_cb (EMAccountEditor *emae)
E_CONFIG_TARGET_CHANGED_STATE);
}
+#if 0 /* ACCOUNT_MGMT */
static void
emae_set_original_account (EMAccountEditor *emae,
EAccount *original_account)
@@ -304,15 +303,16 @@ emae_set_original_account (EMAccountEditor *emae,
emae->priv->original_account = original_account;
emae->priv->modified_account = modified_account;
}
+#endif /* ACCOUNT_MGMT */
static void
-emae_set_backend (EMAccountEditor *emae,
- EMailBackend *backend)
+emae_set_session (EMAccountEditor *emae,
+ EMailSession *session)
{
- g_return_if_fail (E_IS_MAIL_BACKEND (backend));
- g_return_if_fail (emae->priv->backend == NULL);
+ g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (emae->priv->session == NULL);
- emae->priv->backend = g_object_ref (backend);
+ emae->priv->session = g_object_ref (session);
}
static CamelProvider *
@@ -580,12 +580,7 @@ emae_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_BACKEND:
- emae_set_backend (
- EM_ACCOUNT_EDITOR (object),
- g_value_get_object (value));
- return;
-
+#if 0 /* ACCOUNT_MGMT */
case PROP_ORIGINAL_ACCOUNT:
emae_set_original_account (
EM_ACCOUNT_EDITOR (object),
@@ -597,6 +592,13 @@ emae_set_property (GObject *object,
EM_ACCOUNT_EDITOR (object),
g_value_get_boolean (value));
return;
+#endif /* ACCOUNT_MGMT */
+
+ case PROP_SESSION:
+ emae_set_session (
+ EM_ACCOUNT_EDITOR (object),
+ g_value_get_object (value));
+ return;
case PROP_STORE_SETTINGS:
emae_set_store_settings (
@@ -687,24 +689,26 @@ emae_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_BACKEND:
+#if 0 /* ACCOUNT_MGMT */
+ case PROP_MODIFIED_ACCOUNT:
g_value_set_object (
value,
- em_account_editor_get_backend (
+ em_account_editor_get_modified_account (
EM_ACCOUNT_EDITOR (object)));
return;
- case PROP_MODIFIED_ACCOUNT:
+ case PROP_ORIGINAL_ACCOUNT:
g_value_set_object (
value,
- em_account_editor_get_modified_account (
+ em_account_editor_get_original_account (
EM_ACCOUNT_EDITOR (object)));
return;
+#endif /* ACCOUNT_MGMT */
- case PROP_ORIGINAL_ACCOUNT:
+ case PROP_SESSION:
g_value_set_object (
value,
- em_account_editor_get_original_account (
+ em_account_editor_get_session (
EM_ACCOUNT_EDITOR (object)));
return;
@@ -831,11 +835,12 @@ emae_dispose (GObject *object)
priv = EM_ACCOUNT_EDITOR_GET_PRIVATE (object);
- if (priv->backend != NULL) {
- g_object_unref (priv->backend);
- priv->backend = NULL;
+ if (priv->session != NULL) {
+ g_object_unref (priv->session);
+ priv->session = NULL;
}
+#if 0 /* ACCOUNT_MGMT */
if (priv->modified_account != NULL) {
g_signal_handlers_disconnect_by_func (
priv->modified_account,
@@ -848,6 +853,7 @@ emae_dispose (GObject *object)
g_object_unref (priv->original_account);
priv->original_account = NULL;
}
+#endif /* ACCOUNT_MGMT */
if (priv->source.settings != NULL) {
g_signal_handlers_disconnect_by_func (
@@ -875,6 +881,7 @@ emae_finalize (GObject *object)
EMAccountEditor *emae = EM_ACCOUNT_EDITOR (object);
EMAccountEditorPrivate *priv = emae->priv;
+#if 0 /* ACCOUNT_MGMT */
if (priv->sig_added_id) {
ESignatureList *signatures;
@@ -883,6 +890,7 @@ emae_finalize (GObject *object)
g_signal_handler_disconnect (signatures, priv->sig_removed_id);
g_signal_handler_disconnect (signatures, priv->sig_changed_id);
}
+#endif /* ACCOUNT_MGMT */
g_list_free (priv->providers);
@@ -900,13 +908,12 @@ emae_constructed (GObject *object)
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (em_account_editor_parent_class)->constructed (object);
+#if 0 /* ACCOUNT_MGMT */
/* Set some defaults on the new account before we get started. */
if (emae->priv->new_account) {
- EMailBackend *backend;
EMailSession *session;
- backend = em_account_editor_get_backend (emae);
- session = e_mail_backend_get_session (backend);
+ session = em_account_editor_get_session (emae);
/* Pick local Drafts folder. */
e_account_set_string (
@@ -934,6 +941,7 @@ emae_constructed (GObject *object)
g_signal_connect_swapped (
emae->priv->modified_account, "changed",
G_CALLBACK (emae_config_target_changed_cb), emae);
+#endif /* ACCOUNT_MGMT */
}
static void
@@ -950,18 +958,7 @@ em_account_editor_class_init (EMAccountEditorClass *class)
object_class->finalize = emae_finalize;
object_class->constructed = emae_constructed;
- g_object_class_install_property (
- object_class,
- PROP_BACKEND,
- g_param_spec_object (
- "backend",
- "Mail Backend",
- NULL,
- E_TYPE_MAIL_BACKEND,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
+#if 0 /* ACCOUNT_MGMT */
g_object_class_install_property (
object_class,
PROP_MODIFIED_ACCOUNT,
@@ -984,6 +981,19 @@ em_account_editor_class_init (EMAccountEditorClass *class)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+#endif /* ACCOUNT_MGMT */
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SESSION,
+ g_param_spec_object (
+ "session",
+ "Session",
+ "Mail session",
+ E_TYPE_MAIL_SESSION,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (
object_class,
@@ -1192,17 +1202,17 @@ em_account_editor_init (EMAccountEditor *emae)
/**
* em_account_editor_new:
- * @account:
+ * @source:
* @type:
*
- * Create a new account editor. If @account is NULL then this is to
- * create a new account, else @account is copied to a working
+ * Create a new account editor. If @source is NULL then this is to
+ * create a new account, else @source is copied to a working
* structure and is for editing an existing account.
*
* Return value:
**/
EMAccountEditor *
-em_account_editor_new (EAccount *account,
+em_account_editor_new (ESource *source,
EMAccountEditorType type,
EMailBackend *backend,
const gchar *id)
@@ -1213,7 +1223,7 @@ em_account_editor_new (EAccount *account,
emae = g_object_new (
EM_TYPE_ACCOUNT_EDITOR,
- "original-account", account,
+ "original-source", source,
"backend", backend, NULL);
em_account_editor_construct (emae, type, id);
@@ -1223,17 +1233,17 @@ em_account_editor_new (EAccount *account,
/**
* em_account_editor_new_for_pages:
- * @account:
+ * @source:
* @type:
*
- * Create a new account editor. If @account is NULL then this is to
- * create a new account, else @account is copied to a working
+ * Create a new account editor. If @source is NULL then this is to
+ * create a new account, else @source is copied to a working
* structure and is for editing an existing account.
*
* Return value:
**/
EMAccountEditor *
-em_account_editor_new_for_pages (EAccount *account,
+em_account_editor_new_for_pages (ESource *source,
EMAccountEditorType type,
EMailBackend *backend,
const gchar *id,
@@ -1245,7 +1255,7 @@ em_account_editor_new_for_pages (EAccount *account,
emae = g_object_new (
EM_TYPE_ACCOUNT_EDITOR,
- "original-account", account,
+ "original-source", source,
"backend", backend, NULL);
emae->pages = pages;
@@ -1254,28 +1264,32 @@ em_account_editor_new_for_pages (EAccount *account,
return emae;
}
-EMailBackend *
-em_account_editor_get_backend (EMAccountEditor *emae)
+EMailSession *
+em_account_editor_get_session (EMAccountEditor *emae)
{
g_return_val_if_fail (EM_IS_ACCOUNT_EDITOR (emae), NULL);
- return emae->priv->backend;
+ return emae->priv->session;
}
-EAccount *
+ESource *
em_account_editor_get_modified_account (EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
g_return_val_if_fail (EM_IS_ACCOUNT_EDITOR (emae), NULL);
return emae->priv->modified_account;
+#endif /* ACCOUNT_MGMT */
}
-EAccount *
+ESource *
em_account_editor_get_original_account (EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
g_return_val_if_fail (EM_IS_ACCOUNT_EDITOR (emae), NULL);
return emae->priv->original_account;
+#endif /* ACCOUNT_MGMT */
}
/* ********************************************************************** */
@@ -1299,6 +1313,7 @@ static CamelURL *
emae_account_url (EMAccountEditor *emae,
gint urlid)
{
+#if 0 /* ACCOUNT_MGMT */
EAccount *account;
CamelURL *url = NULL;
const gchar *uri;
@@ -1315,6 +1330,9 @@ emae_account_url (EMAccountEditor *emae,
}
return url;
+#endif /* ACCOUNT_MGMT */
+
+ return NULL;
}
/* ********************************************************************** */
@@ -1323,6 +1341,7 @@ static void
default_folders_clicked (GtkButton *button,
gpointer user_data)
{
+#if 0 /* ACCOUNT_MGMT */
EMAccountEditor *emae = user_data;
EMFolderSelectionButton *folder_button;
EMailBackend *backend;
@@ -1350,6 +1369,7 @@ default_folders_clicked (GtkButton *button,
gtk_toggle_button_set_active (emae->priv->trash_folder_check, FALSE);
gtk_toggle_button_set_active (emae->priv->junk_folder_check, FALSE);
+#endif /* ACCOUNT_MGMT */
}
/* The camel provider auto-detect interface should be deprecated.
@@ -1367,6 +1387,7 @@ emae_auto_detect_free (gpointer key,
static void
emae_auto_detect (EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
EMAccountEditorPrivate *priv = emae->priv;
EMAccountEditorService *service = &priv->source;
CamelProvider *provider;
@@ -1418,6 +1439,7 @@ emae_auto_detect (EMAccountEditor *emae)
g_hash_table_foreach (auto_detected, emae_auto_detect_free, NULL);
g_hash_table_destroy (auto_detected);
+#endif /* ACCOUNT_MGMT */
}
static gint
@@ -1436,6 +1458,7 @@ provider_compare (const CamelProvider *p1,
}
}
+#if 0 /* ACCOUNT_MGMT */
static void
emae_signature_added (ESignatureList *signatures,
ESignature *sig,
@@ -1623,11 +1646,13 @@ emae_setup_signatures (EMAccountEditor *emae,
return (GtkWidget *) dropdown;
}
+#endif /* ACCOUNT_MGMT */
static void
emae_receipt_policy_changed (GtkComboBox *dropdown,
EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
EAccount *account;
gint id = gtk_combo_box_get_active (dropdown);
GtkTreeModel *model;
@@ -1643,12 +1668,14 @@ emae_receipt_policy_changed (GtkComboBox *dropdown,
e_account_set_int (account, E_ACCOUNT_RECEIPT_POLICY, policy);
}
}
+#endif /* ACCOUNT_MGMT */
}
static GtkWidget *
emae_setup_receipt_policy (EMAccountEditor *emae,
GtkBuilder *builder)
{
+#if 0 /* ACCOUNT_MGMT */
EAccount *account;
GtkComboBox *dropdown = (GtkComboBox *)e_builder_get_widget (builder, "receipt_policy_dropdown");
GtkListStore *store;
@@ -1693,12 +1720,16 @@ emae_setup_receipt_policy (EMAccountEditor *emae,
g_signal_connect (dropdown, "changed", G_CALLBACK(emae_receipt_policy_changed), emae);
return (GtkWidget *) dropdown;
+#endif /* ACCOUNT_MGMT */
+
+ return NULL;
}
static void
emae_account_entry_changed (GtkEntry *entry,
EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
EAccount *account;
gchar *text;
gpointer data;
@@ -1712,6 +1743,7 @@ emae_account_entry_changed (GtkEntry *entry,
e_account_set_string (account, GPOINTER_TO_INT (data), text);
g_free (text);
+#endif /* ACCOUNT_MGMT */
}
static GtkEntry *
@@ -1720,6 +1752,7 @@ emae_account_entry (EMAccountEditor *emae,
gint item,
GtkBuilder *builder)
{
+#if 0 /* ACCOUNT_MGMT */
EAccount *account;
GtkEntry *entry;
const gchar *text;
@@ -1733,12 +1766,16 @@ emae_account_entry (EMAccountEditor *emae,
g_signal_connect (entry, "changed", G_CALLBACK(emae_account_entry_changed), emae);
return entry;
+#endif /* ACCOUNT_MGMT */
+
+ return NULL;
}
static void
emae_account_toggle_changed (GtkToggleButton *toggle,
EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
EAccount *account;
gboolean active;
gpointer data;
@@ -1748,6 +1785,7 @@ emae_account_toggle_changed (GtkToggleButton *toggle,
active = gtk_toggle_button_get_active (toggle);
e_account_set_bool (account, GPOINTER_TO_INT (data), active);
+#endif /* ACCOUNT_MGMT */
}
static void
@@ -1755,6 +1793,7 @@ emae_account_toggle_widget (EMAccountEditor *emae,
GtkToggleButton *toggle,
gint item)
{
+#if 0 /* ACCOUNT_MGMT */
EAccount *account;
gboolean active;
@@ -1770,6 +1809,7 @@ emae_account_toggle_widget (EMAccountEditor *emae,
g_signal_connect (
toggle, "toggled",
G_CALLBACK (emae_account_toggle_changed), emae);
+#endif /* ACCOUNT_MGMT */
}
static GtkToggleButton *
@@ -1790,6 +1830,7 @@ static void
emae_account_spinint_changed (GtkSpinButton *spin,
EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
EAccount *account;
gpointer data;
gint value;
@@ -1799,6 +1840,7 @@ emae_account_spinint_changed (GtkSpinButton *spin,
value = gtk_spin_button_get_value (spin);
e_account_set_int (account, GPOINTER_TO_INT (data), value);
+#endif /* ACCOUNT_MGMT */
}
static void
@@ -1806,6 +1848,7 @@ emae_account_spinint_widget (EMAccountEditor *emae,
GtkSpinButton *spin,
gint item)
{
+#if 0 /* ACCOUNT_MGMT */
EAccount *account;
gint v_int;
@@ -1821,8 +1864,10 @@ emae_account_spinint_widget (EMAccountEditor *emae,
g_signal_connect (
spin, "value-changed",
G_CALLBACK (emae_account_spinint_changed), emae);
+#endif /* ACCOUNT_MGMT */
}
+#if 0
static void
emae_account_folder_changed (EMFolderSelectionButton *folder,
EMAccountEditor *emae)
@@ -1873,6 +1918,7 @@ emae_account_folder (EMAccountEditor *emae,
return folder;
}
+#endif
#if defined (HAVE_NSS) && defined (ENABLE_SMIME)
static void
@@ -1978,6 +2024,13 @@ smime_encrypt_key_clear (GtkWidget *w,
}
#endif
+#if 1 /* ACCOUNT_MGMT - Remove this. */
+#define E_ACCOUNT_SOURCE_URL 0
+#define E_ACCOUNT_SOURCE_SAVE_PASSWD 0
+#define E_ACCOUNT_TRANSPORT_URL 0
+#define E_ACCOUNT_TRANSPORT_SAVE_PASSWD 0
+#endif
+
/* This is used to map each of the two services in a typical account to
* the widgets that represent each service. i.e. the receiving (source)
* service, and the sending (transport) service. It is used throughout
@@ -2344,7 +2397,11 @@ emae_service_provider_changed (EMAccountEditorService *service)
em_config_target_update_settings (
config, target,
+#if 0 /* ACCOUNT_MGMT */
service->emae->priv->modified_account->id->address,
+#else
+ NULL,
+#endif /* ACCOUNT_MGMT */
service->emae->priv->source.protocol,
service->emae->priv->source.settings,
service->emae->priv->transport.protocol,
@@ -2463,7 +2520,6 @@ emae_check_authtype_done (CamelService *camel_service,
GAsyncResult *result,
EMAccountEditorService *service)
{
- EMailBackend *backend;
EMailSession *session;
GtkWidget *editor;
GList *available_authtypes;
@@ -2499,8 +2555,7 @@ emae_check_authtype_done (CamelService *camel_service,
if (editor != NULL)
gtk_widget_set_sensitive (editor, TRUE);
- backend = em_account_editor_get_backend (service->emae);
- session = e_mail_backend_get_session (backend);
+ session = em_account_editor_get_session (service->emae);
/* drop the temporary CamelService */
camel_session_remove_service (
@@ -2521,8 +2576,8 @@ static void
emae_check_authtype (GtkWidget *w,
EMAccountEditorService *service)
{
+#if 0 /* ACCOUNT_MGMT */
CamelService *camel_service;
- EMailBackend *backend;
EMailSession *session;
GtkWidget *editor;
gpointer parent;
@@ -2531,8 +2586,7 @@ emae_check_authtype (GtkWidget *w,
editor = E_CONFIG (service->emae->config)->window;
- backend = em_account_editor_get_backend (service->emae);
- session = e_mail_backend_get_session (backend);
+ session = em_account_editor_get_session (service->emae);
uid = g_strdup_printf ("emae-check-authtype-%p", service);
@@ -2587,6 +2641,7 @@ emae_check_authtype (GtkWidget *w,
if (editor != NULL)
gtk_widget_set_sensitive (editor, FALSE);
+#endif /* ACCOUNT_MGMT */
}
static void
@@ -2890,6 +2945,7 @@ emae_create_basic_assistant_page (EMAccountEditor *emae,
}
/* do not re-order these, the order is used by various code to look up emae->priv->identity_entries[] */
+#if 0 /* ACCOUNT_MGMT */
static struct {
const gchar *name;
gint item;
@@ -2900,6 +2956,7 @@ static struct {
{ "identity_reply_to", E_ACCOUNT_ID_REPLY_TO },
{ "identity_organization", E_ACCOUNT_ID_ORGANIZATION },
};
+#endif /* ACCOUNT_MGMT */
static void
emae_queue_widgets (EMAccountEditor *emae,
@@ -2925,6 +2982,7 @@ emae_identity_page (EConfig *ec,
gint position,
gpointer data)
{
+#if 0 /* ACCOUNT_MGMT */
EMAccountEditor *emae = data;
EMAccountEditorPrivate *priv = emae->priv;
EAccount *account;
@@ -3004,6 +3062,9 @@ emae_identity_page (EConfig *ec,
g_object_unref (builder);
return w;
+#endif /* ACCOUNT_MGMT */
+
+ return NULL;
}
static GtkWidget *
@@ -3410,11 +3471,15 @@ emae_receive_options_item (EConfig *ec,
box = gtk_hbox_new (FALSE, 4);
w = gtk_check_button_new_with_mnemonic (_("Check for _new messages every"));
+#if 0 /* ACCOUNT_MGMT */
emae_account_toggle_widget (emae, (GtkToggleButton *) w, E_ACCOUNT_SOURCE_AUTO_CHECK);
+#endif /* ACCOUNT_MGMT */
gtk_box_pack_start ((GtkBox *) box, w, FALSE, FALSE, 0);
spin = gtk_spin_button_new_with_range (1.0, 1440.0, 1.0);
+#if 0 /* ACCOUNT_MGMT */
emae_account_spinint_widget (emae, (GtkSpinButton *) spin, E_ACCOUNT_SOURCE_AUTO_CHECK_TIME);
+#endif /* ACCOUNT_MGMT */
gtk_box_pack_start ((GtkBox *) box, spin, FALSE, TRUE, 0);
w = gtk_label_new_with_mnemonic (_("minu_tes"));
@@ -3436,6 +3501,7 @@ emae_receive_options_extra_item (EConfig *ec,
gint position,
gpointer data)
{
+#if 0 /* ACCOUNT_MGMT */
EMAccountEditor *emae = data;
EMAccountEditorService *service;
struct _receive_options_item *item = (struct _receive_options_item *) eitem;
@@ -3604,6 +3670,9 @@ section:
gtk_widget_show (widget);
return widget;
+#endif /* ACCOUNT_MGMT */
+
+ return NULL; /* ACCOUNT_MGMT */
}
static GtkWidget *
@@ -3679,6 +3748,7 @@ emae_real_url_toggled (GtkToggleButton *check,
em_folder_selection_button_set_folder_uri (button, "");
}
+#if 0 /* ACCOUNT_MGMT */
static void
set_real_folder_path (GtkButton *folder_button,
CamelSettings *settings,
@@ -3760,6 +3830,7 @@ update_real_folder_cb (GtkButton *folder_button,
g_object_set (G_OBJECT (settings), prop_name, path, NULL);
g_free (path);
}
+#endif /* ACCOUNT_MGMT */
static GtkWidget *
emae_defaults_page (EConfig *ec,
@@ -3769,6 +3840,7 @@ emae_defaults_page (EConfig *ec,
gint position,
gpointer data)
{
+#if 0 /* ACCOUNT_MGMT */
EMAccountEditor *emae = data;
EMAccountEditorPrivate *priv = emae->priv;
EMFolderSelectionButton *button;
@@ -3776,7 +3848,6 @@ emae_defaults_page (EConfig *ec,
CamelProvider *provider;
CamelSettings *settings;
CamelStore *store = NULL;
- EMailBackend *backend;
EMailSession *session;
EAccount *account;
GtkWidget *widget;
@@ -3790,9 +3861,7 @@ emae_defaults_page (EConfig *ec,
return NULL;
account = em_account_editor_get_modified_account (emae);
- backend = em_account_editor_get_backend (emae);
-
- session = e_mail_backend_get_session (backend);
+ session = em_account_editor_get_session (emae);
if (account != NULL) {
CamelService *service;
@@ -3988,12 +4057,16 @@ emae_defaults_page (EConfig *ec,
g_object_unref (builder);
return widget;
+#endif /* ACCOUNT_MGMT */
+
+ return NULL;
}
static void
emae_account_hash_algo_combo_changed_cb (GtkComboBox *combobox,
EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
EAccount *account;
gpointer data;
const gchar *text = NULL;
@@ -4015,6 +4088,7 @@ emae_account_hash_algo_combo_changed_cb (GtkComboBox *combobox,
}
e_account_set_string (account, GPOINTER_TO_INT (data), text);
+#endif /* ACCOUNT_MGMT */
}
static GtkComboBox *
@@ -4023,6 +4097,7 @@ emae_account_hash_algo_combo (EMAccountEditor *emae,
gint item,
GtkBuilder *builder)
{
+#if 0 /* ACCOUNT_MGMT */
EAccount *account;
GtkComboBox *combobox;
const gchar *text;
@@ -4050,6 +4125,9 @@ emae_account_hash_algo_combo (EMAccountEditor *emae,
g_signal_connect (combobox, "changed", G_CALLBACK (emae_account_hash_algo_combo_changed_cb), emae);
return combobox;
+#endif /* ACCOUNT_MGMT */
+
+ return NULL;
}
static GtkWidget *
@@ -4073,6 +4151,7 @@ emae_security_page (EConfig *ec,
builder = gtk_builder_new ();
e_load_ui_builder_definition (builder, "mail-config.ui");
+#if 0 /* ACCOUNT_MGMT */
/* Security */
emae_account_entry (emae, "pgp_key", E_ACCOUNT_PGP_KEY, builder);
emae_account_hash_algo_combo (emae, "pgp_hash_algo", E_ACCOUNT_PGP_HASH_ALGORITHM, builder);
@@ -4080,26 +4159,33 @@ emae_security_page (EConfig *ec,
emae_account_toggle (emae, "pgp_always_sign", E_ACCOUNT_PGP_ALWAYS_SIGN, builder);
emae_account_toggle (emae, "pgp_no_imip_sign", E_ACCOUNT_PGP_NO_IMIP_SIGN, builder);
emae_account_toggle (emae, "pgp_always_trust", E_ACCOUNT_PGP_ALWAYS_TRUST, builder);
+#endif /* ACCOUNT_MGMT */
#if defined (HAVE_NSS) && defined (ENABLE_SMIME)
/* TODO: this should handle its entry separately? */
+#if 0 /* ACCOUNT_MGMT */
priv->smime_sign_key = emae_account_entry (emae, "smime_sign_key", E_ACCOUNT_SMIME_SIGN_KEY, builder);
+#endif /* ACCOUNT_MGMT */
priv->smime_sign_key_select = (GtkButton *)e_builder_get_widget (builder, "smime_sign_key_select");
priv->smime_sign_key_clear = (GtkButton *)e_builder_get_widget (builder, "smime_sign_key_clear");
g_signal_connect (priv->smime_sign_key_select, "clicked", G_CALLBACK(smime_sign_key_select), emae);
g_signal_connect (priv->smime_sign_key_clear, "clicked", G_CALLBACK(smime_sign_key_clear), emae);
+#if 0 /* ACCOUNT_MGMT */
emae_account_hash_algo_combo (emae, "smime_hash_algo", E_ACCOUNT_SMIME_HASH_ALGORITHM, builder);
priv->smime_sign_default = emae_account_toggle (emae, "smime_sign_default", E_ACCOUNT_SMIME_SIGN_DEFAULT, builder);
priv->smime_encrypt_key = emae_account_entry (emae, "smime_encrypt_key", E_ACCOUNT_SMIME_ENCRYPT_KEY, builder);
+#endif /* ACCOUNT_MGMT */
priv->smime_encrypt_key_select = (GtkButton *)e_builder_get_widget (builder, "smime_encrypt_key_select");
priv->smime_encrypt_key_clear = (GtkButton *)e_builder_get_widget (builder, "smime_encrypt_key_clear");
g_signal_connect (priv->smime_encrypt_key_select, "clicked", G_CALLBACK(smime_encrypt_key_select), emae);
g_signal_connect (priv->smime_encrypt_key_clear, "clicked", G_CALLBACK(smime_encrypt_key_clear), emae);
+#if 0 /* ACCOUNT_MGMT */
priv->smime_encrypt_default = emae_account_toggle (emae, "smime_encrypt_default", E_ACCOUNT_SMIME_ENCRYPT_DEFAULT, builder);
priv->smime_encrypt_to_self = emae_account_toggle (emae, "smime_encrypt_to_self", E_ACCOUNT_SMIME_ENCRYPT_TO_SELF, builder);
+#endif /* ACCOUNT_MGMT */
smime_changed (emae);
#else
{
@@ -4483,6 +4569,7 @@ emae_check_complete (EConfig *ec,
const gchar *pageid,
gpointer data)
{
+#if 0 /* ACCOUNT_MGMT */
EMAccountEditor *emae = data;
EAccount *account;
EAccount *original_account;
@@ -4844,6 +4931,9 @@ emae_check_complete (EConfig *ec,
}
return ok;
+#endif /* ACCOUNT_MGMT */
+
+ return FALSE;
}
gboolean
@@ -4853,6 +4943,7 @@ em_account_editor_check (EMAccountEditor *emae,
return emae_check_complete ((EConfig *) emae->config, page, emae);
}
+#if 0 /* ACCOUNT_MGMT */
static void
forget_password_if_needed (EAccount *original_account,
EAccount *modified_account,
@@ -4891,6 +4982,7 @@ forget_password_if_needed (EAccount *original_account,
camel_url_free (url);
}
}
+#endif /* ACCOUNT_MGMT */
#define CALENDAR_CALDAV_URI "caldav://%s www google com/calendar/dav/%s/events"
#define GMAIL_CALENDAR_LOCATION "://www.google.com/calendar/feeds/"
@@ -4923,6 +5015,7 @@ sanitize_user_mail (const gchar *user)
static void
setup_google_addressbook (EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
GConfClient *gconf;
ESourceList *slist;
ESourceGroup *sgrp;
@@ -4971,11 +5064,13 @@ setup_google_addressbook (EMAccountEditor *emae)
g_object_unref (slist);
g_object_unref (sgrp);
g_object_unref (gconf);
+#endif /* ACCOUNT_MGMT */
}
static void
setup_google_calendar (EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
GConfClient *gconf;
ESourceList *slist;
ESourceGroup *sgrp;
@@ -5040,11 +5135,13 @@ setup_google_calendar (EMAccountEditor *emae)
g_object_unref (sgrp);
g_object_unref (calendar);
g_object_unref (gconf);
+#endif /* ACCOUNT_MGMT */
}
static void
setup_yahoo_calendar (EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
GConfClient *gconf;
ESourceList *slist;
ESourceGroup *sgrp;
@@ -5111,12 +5208,14 @@ setup_yahoo_calendar (EMAccountEditor *emae)
g_object_unref (sgrp);
g_object_unref (calendar);
g_object_unref (gconf);
+#endif /* ACCOUNT_MGMT */
}
static void
emae_commit (EConfig *ec,
EMAccountEditor *emae)
{
+#if 0 /* ACCOUNT_MGMT */
EAccountList *accounts = e_get_account_list ();
EAccount *account;
EAccount *modified_account;
@@ -5223,6 +5322,7 @@ emae_commit (EConfig *ec,
}
e_account_list_save (accounts);
+#endif /* ACCOUNT_MGMT */
}
void
@@ -5236,6 +5336,7 @@ em_account_editor_construct (EMAccountEditor *emae,
EMAccountEditorType type,
const gchar *id)
{
+#if 0 /* ACCOUNT_MGMT */
EMAccountEditorPrivate *priv = emae->priv;
gint i, index;
GSList *l;
@@ -5339,5 +5440,5 @@ em_account_editor_construct (EMAccountEditor *emae,
emae->priv->transport.protocol,
emae->priv->transport.settings);
e_config_set_target ((EConfig *) ec, (EConfigTarget *) target);
+#endif /* ACCOUNT_MGMT */
}
-
diff --git a/mail/em-account-editor.h b/mail/em-account-editor.h
index 18d4b91..e644cf3 100644
--- a/mail/em-account-editor.h
+++ b/mail/em-account-editor.h
@@ -98,20 +98,20 @@ struct _EMAccountEditorClass {
GType em_account_editor_get_type (void);
EMAccountEditor *
- em_account_editor_new (EAccount *account,
+ em_account_editor_new (ESource *source,
EMAccountEditorType type,
EMailBackend *backend,
const gchar *id);
EMAccountEditor *
- em_account_editor_new_for_pages (EAccount *account,
+ em_account_editor_new_for_pages (ESource *source,
EMAccountEditorType type,
EMailBackend *backend,
const gchar *id,
GtkWidget **pages);
-EMailBackend * em_account_editor_get_backend (EMAccountEditor *emae);
-EAccount * em_account_editor_get_modified_account
+EMailSession * em_account_editor_get_session (EMAccountEditor *emae);
+ESource * em_account_editor_get_modified_source
(EMAccountEditor *emae);
-EAccount * em_account_editor_get_original_account
+ESource * em_account_editor_get_original_source
(EMAccountEditor *emae);
void em_account_editor_commit (EMAccountEditor *emae);
gboolean em_account_editor_check (EMAccountEditor *emae,
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 850a5e5..07f15cd 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -31,13 +31,17 @@
#include <glib/gi18n.h>
#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-source-mail-account.h>
+#include <libedataserver/e-source-mail-composition.h>
+#include <libedataserver/e-source-mail-identity.h>
+#include <libedataserver/e-source-mail-submission.h>
+#include <libedataserver/e-source-mdn.h>
#include "mail-mt.h"
#include "mail-ops.h"
#include "mail-tools.h"
#include "mail-send-recv.h"
-#include "e-util/e-account-utils.h"
#include "e-util/e-alert-dialog.h"
#include "e-util/e-alert-sink.h"
#include "e-util/e-util.h"
@@ -362,23 +366,27 @@ finished:
}
static gboolean
-composer_presend_check_account (EMsgComposer *composer,
- EMailSession *session)
+composer_presend_check_identity (EMsgComposer *composer,
+ EMailSession *session)
{
EComposerHeaderTable *table;
- EAccount *account;
- gboolean check_passed;
+ ESourceRegistry *registry;
+ ESource *source;
+ const gchar *uid;
table = e_msg_composer_get_header_table (composer);
- account = e_composer_header_table_get_account (table);
- check_passed = (account != NULL && account->enabled);
+ registry = e_composer_header_table_get_registry (table);
+ uid = e_composer_header_table_get_identity_uid (table);
+ source = e_source_registry_lookup_by_uid (registry, uid);
- if (!check_passed)
+ if (!em_utils_mail_identity_is_enabled (registry, source)) {
e_alert_submit (
E_ALERT_SINK (composer),
"mail:send-no-account-enabled", NULL);
+ return FALSE;
+ }
- return check_passed;
+ return TRUE;
}
static gboolean
@@ -794,9 +802,11 @@ em_utils_composer_save_to_drafts_cb (EMsgComposer *composer,
{
AsyncContext *context;
EComposerHeaderTable *table;
+ ESourceRegistry *registry;
+ ESource *source;
const gchar *drafts_folder_uri = NULL;
const gchar *local_drafts_folder_uri;
- EAccount *account;
+ const gchar *identity_uid;
context = g_slice_new0 (AsyncContext);
context->message = g_object_ref (message);
@@ -804,18 +814,29 @@ em_utils_composer_save_to_drafts_cb (EMsgComposer *composer,
context->composer = g_object_ref (composer);
context->activity = g_object_ref (activity);
- local_drafts_folder_uri =
- e_mail_session_get_local_folder_uri (
- session, E_MAIL_LOCAL_FOLDER_DRAFTS);
-
table = e_msg_composer_get_header_table (composer);
- account = e_composer_header_table_get_account (table);
- if (account != NULL && account->enabled)
- drafts_folder_uri = account->drafts_folder_uri;
+ registry = e_composer_header_table_get_registry (table);
+ identity_uid = e_composer_header_table_get_identity_uid (table);
+ source = e_source_registry_lookup_by_uid (registry, identity_uid);
- if (g_strcmp0 (drafts_folder_uri, local_drafts_folder_uri) == 0)
- drafts_folder_uri = NULL;
+ /* Get the selected identity's preferred Drafts folder. */
+ if (source != NULL) {
+ ESourceMailComposition *extension;
+ const gchar *extension_name;
+ const gchar *uri;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_COMPOSITION;
+ extension = e_source_get_extension (source, extension_name);
+ uri = e_source_mail_composition_get_drafts_folder (extension);
+
+ if (uri != NULL && *uri != '\0')
+ drafts_folder_uri = uri;
+ }
+
+ local_drafts_folder_uri =
+ e_mail_session_get_local_folder_uri (
+ session, E_MAIL_LOCAL_FOLDER_DRAFTS);
if (drafts_folder_uri == NULL) {
composer_save_to_drafts_append_mail (context, NULL);
@@ -934,12 +955,15 @@ create_new_composer (EShell *shell,
CamelFolder *folder)
{
EMsgComposer *composer;
+ ESourceRegistry *registry;
EComposerHeaderTable *table;
- EAccount *account = NULL;
+ ESource *source = NULL;
+ const gchar *identity = NULL;
composer = e_msg_composer_new (shell);
table = e_msg_composer_get_header_table (composer);
+ registry = e_composer_header_table_get_registry (table);
if (folder != NULL) {
CamelStore *store;
@@ -949,7 +973,7 @@ create_new_composer (EShell *shell,
store = camel_folder_get_parent_store (folder);
uid = camel_service_get_uid (CAMEL_SERVICE (store));
- account = e_get_account_by_uid (uid);
+ source = e_source_registry_lookup_by_uid (registry, uid);
folder_uri = e_mail_folder_uri_from_folder (folder);
@@ -960,8 +984,17 @@ create_new_composer (EShell *shell,
g_free (folder_uri);
}
- e_composer_header_table_set_account (table, account);
+ if (source != NULL) {
+ ESourceMailAccount *extension;
+ const gchar *extension_name;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ extension = e_source_get_extension (source, extension_name);
+ identity = e_source_mail_account_get_identity_uid (extension);
+ }
+
e_composer_header_table_set_subject (table, subject);
+ e_composer_header_table_set_identity_uid (table, identity);
return composer;
}
@@ -1007,8 +1040,8 @@ em_utils_compose_new_message_with_mailto (EShell *shell,
CamelFolder *folder)
{
EMsgComposer *composer;
+ ESourceRegistry *registry;
EComposerHeaderTable *table;
- CamelService *service = NULL;
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
@@ -1021,25 +1054,37 @@ em_utils_compose_new_message_with_mailto (EShell *shell,
composer = e_msg_composer_new (shell);
table = e_msg_composer_get_header_table (composer);
+ registry = e_composer_header_table_get_registry (table);
+
+ composer_set_no_change (composer);
+
+ gtk_window_present (GTK_WINDOW (composer));
+
+ /* If a CamelFolder was given, we need to backtrack and find
+ * the corresponding ESource with a Mail Identity extension. */
if (folder != NULL) {
+ ESource *source;
CamelStore *store;
+ ESourceMailAccount *extension;
+ const gchar *extension_name;
+ const gchar *uid;
store = camel_folder_get_parent_store (folder);
- service = CAMEL_SERVICE (store);
- }
+ uid = camel_service_get_uid (CAMEL_SERVICE (store));
+ source = e_source_registry_lookup_by_uid (registry, uid);
+ g_return_val_if_fail (source != NULL, composer);
- if (service != NULL) {
- const gchar *display_name;
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ if (e_source_has_extension (source, extension_name))
+ goto exit;
- display_name = camel_service_get_display_name (service);
- e_composer_header_table_set_account_name (table, display_name);
+ extension = e_source_get_extension (source, extension_name);
+ uid = e_source_mail_account_get_identity_uid (extension);
+ e_composer_header_table_set_identity_uid (table, uid);
}
- composer_set_no_change (composer);
-
- gtk_window_present (GTK_WINDOW (composer));
-
+exit:
return composer;
}
@@ -1260,6 +1305,7 @@ em_utils_edit_message (EShell *shell,
const gchar *message_uid)
{
EMsgComposer *composer;
+ ESourceRegistry *registry;
gboolean folder_is_drafts;
gboolean folder_is_outbox;
gboolean folder_is_templates;
@@ -1268,9 +1314,10 @@ em_utils_edit_message (EShell *shell,
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
- folder_is_drafts = em_utils_folder_is_drafts (folder);
- folder_is_outbox = em_utils_folder_is_outbox (folder);
- folder_is_templates = em_utils_folder_is_templates (folder);
+ registry = e_shell_get_registry (shell);
+ folder_is_drafts = em_utils_folder_is_drafts (registry, folder);
+ folder_is_outbox = em_utils_folder_is_outbox (registry, folder);
+ folder_is_templates = em_utils_folder_is_templates (registry, folder);
/* Template specific code follows. */
if (folder_is_templates) {
@@ -1819,8 +1866,10 @@ static EMsgComposer *
redirect_get_composer (EShell *shell,
CamelMimeMessage *message)
{
+ ESourceRegistry *registry;
CamelMedium *medium;
- EAccount *account;
+ ESource *source;
+ const gchar *identity_uid = NULL;
medium = CAMEL_MEDIUM (message);
@@ -1836,10 +1885,15 @@ redirect_get_composer (EShell *shell,
while (camel_medium_get_header (medium, "Resent-Bcc"))
camel_medium_remove_header (medium, "Resent-Bcc");
- account = em_utils_guess_account_with_recipients (message, NULL);
+ registry = e_shell_get_registry (shell);
+
+ source = em_utils_guess_mail_identity_with_recipients (
+ registry, message, NULL);
+ if (source != NULL)
+ identity_uid = e_source_get_uid (source);
return e_msg_composer_new_redirect (
- shell, message, account ? account->name : NULL, NULL);
+ shell, message, identity_uid, NULL);
}
/**
@@ -1906,7 +1960,7 @@ em_utils_camel_address_to_destination (CamelInternetAddress *iaddr)
static EMsgComposer *
reply_get_composer (EShell *shell,
CamelMimeMessage *message,
- EAccount *account,
+ const gchar *identity_uid,
CamelInternetAddress *to,
CamelInternetAddress *cc,
CamelFolder *folder,
@@ -1947,9 +2001,9 @@ reply_get_composer (EShell *shell,
}
table = e_msg_composer_get_header_table (composer);
- e_composer_header_table_set_account (table, account);
e_composer_header_table_set_subject (table, subject);
e_composer_header_table_set_destinations_to (table, tov);
+ e_composer_header_table_set_identity_uid (table, identity_uid);
/* Add destinations instead of setting, so we don't remove
* automatic CC addresses that have already been added. */
@@ -2244,7 +2298,8 @@ concat_unique_addrs (CamelInternetAddress *dest,
}
void
-em_utils_get_reply_all (CamelMimeMessage *message,
+em_utils_get_reply_all (ESourceRegistry *registry,
+ CamelMimeMessage *message,
CamelInternetAddress *to,
CamelInternetAddress *cc,
CamelNNTPAddress *postto)
@@ -2257,6 +2312,7 @@ em_utils_get_reply_all (CamelMimeMessage *message,
const gchar *posthdr = NULL;
GHashTable *rcpt_hash;
+ g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
g_return_if_fail (CAMEL_IS_INTERNET_ADDRESS (to));
g_return_if_fail (CAMEL_IS_INTERNET_ADDRESS (cc));
@@ -2273,7 +2329,7 @@ em_utils_get_reply_all (CamelMimeMessage *message,
if (postto != NULL && posthdr != NULL)
camel_address_decode (CAMEL_ADDRESS (postto), posthdr);
- rcpt_hash = em_utils_generate_account_hash ();
+ rcpt_hash = em_utils_generate_account_hash (registry);
reply_to = get_reply_to (message);
to_addrs = camel_mime_message_get_recipients (
@@ -2656,10 +2712,12 @@ em_utils_reply_to_message (EShell *shell,
EMFormat *source_formatter,
CamelInternetAddress *address)
{
+ ESourceRegistry *registry;
CamelInternetAddress *to, *cc;
CamelNNTPAddress *postto = NULL;
EMsgComposer *composer;
- EAccount *account;
+ ESource *source;
+ const gchar *identity_uid = NULL;
guint32 flags;
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
@@ -2668,7 +2726,11 @@ em_utils_reply_to_message (EShell *shell,
to = camel_internet_address_new ();
cc = camel_internet_address_new ();
- account = em_utils_guess_account_with_recipients (message, folder);
+ registry = e_shell_get_registry (shell);
+ source = em_utils_guess_mail_identity_with_recipients (
+ registry, message, folder);
+ if (source != NULL)
+ identity_uid = e_source_get_uid (source);
flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_SEEN;
switch (type) {
@@ -2700,12 +2762,12 @@ em_utils_reply_to_message (EShell *shell,
if (folder)
postto = camel_nntp_address_new ();
- em_utils_get_reply_all (message, to, cc, postto);
+ em_utils_get_reply_all (registry, message, to, cc, postto);
break;
}
composer = reply_get_composer (
- shell, message, account, to, cc, folder, postto);
+ shell, message, identity_uid, to, cc, folder, postto);
e_msg_composer_add_message_attachments (composer, message, TRUE);
if (postto)
@@ -2817,7 +2879,7 @@ em_configure_new_composer (EMsgComposer *composer,
g_signal_connect (
composer, "presend",
- G_CALLBACK (composer_presend_check_account), session);
+ G_CALLBACK (composer_presend_check_identity), session);
g_signal_connect (
composer, "presend",
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index 093001d..599249f 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -65,7 +65,8 @@ gboolean em_utils_is_munged_list_message (CamelMimeMessage *message);
void em_utils_get_reply_sender (CamelMimeMessage *message,
CamelInternetAddress *to,
CamelNNTPAddress *postto);
-void em_utils_get_reply_all (CamelMimeMessage *message,
+void em_utils_get_reply_all (ESourceRegistry *registry,
+ CamelMimeMessage *message,
CamelInternetAddress *to,
CamelInternetAddress *cc,
CamelNNTPAddress *postto);
diff --git a/mail/em-filter-source-element.c b/mail/em-filter-source-element.c
index a8e51e2..0f9a625 100644
--- a/mail/em-filter-source-element.c
+++ b/mail/em-filter-source-element.c
@@ -32,23 +32,18 @@
#include <gtk/gtk.h>
#include <camel/camel.h>
-#include <e-util/e-account-utils.h>
+#include <libedataserver/e-source-mail-account.h>
+#include <libedataserver/e-source-mail-identity.h>
+
+#include <shell/e-shell.h>
#include <filter/e-filter-part.h>
#define EM_FILTER_SOURCE_ELEMENT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), EM_TYPE_FILTER_SOURCE_ELEMENT, EMFilterSourceElementPrivate))
-typedef struct _SourceInfo {
- gchar *account_name;
- gchar *name;
- gchar *address;
- gchar *uid;
-} SourceInfo;
-
struct _EMFilterSourceElementPrivate {
EMailSession *session;
- GList *sources;
gchar *active_id;
};
@@ -63,16 +58,6 @@ enum {
};
static void
-source_info_free (SourceInfo *info)
-{
- g_free (info->account_name);
- g_free (info->name);
- g_free (info->address);
- g_free (info->uid);
- g_free (info);
-}
-
-static void
filter_source_element_source_changed (GtkComboBox *combo_box,
EMFilterSourceElement *fs)
{
@@ -85,52 +70,6 @@ filter_source_element_source_changed (GtkComboBox *combo_box,
}
static void
-filter_source_element_add_source (EMFilterSourceElement *fs,
- const gchar *account_name,
- const gchar *name,
- const gchar *addr,
- const gchar *uid)
-{
- SourceInfo *info;
-
- g_return_if_fail (EM_IS_FILTER_SOURCE_ELEMENT (fs));
-
- info = g_new0 (SourceInfo, 1);
- info->account_name = g_strdup (account_name);
- info->name = g_strdup (name);
- info->address = g_strdup (addr);
- info->uid = g_strdup (uid);
-
- fs->priv->sources = g_list_append (fs->priv->sources, info);
-}
-
-static void
-filter_source_element_get_sources (EMFilterSourceElement *fs)
-{
- EAccountList *accounts;
- const EAccount *account;
- EIterator *it;
-
- /* should this get the global object from mail? */
- accounts = e_get_account_list ();
-
- for (it = e_list_get_iterator ((EList *) accounts);
- e_iterator_is_valid (it);
- e_iterator_next (it)) {
- account = (const EAccount *) e_iterator_get (it);
-
- if (account->source == NULL)
- continue;
-
- filter_source_element_add_source (
- fs, account->name, account->id->name,
- account->id->address, account->uid);
- }
-
- g_object_unref (it);
-}
-
-static void
filter_source_element_set_session (EMFilterSourceElement *element,
EMailSession *session)
{
@@ -198,8 +137,6 @@ filter_source_element_finalize (GObject *object)
priv = EM_FILTER_SOURCE_ELEMENT_GET_PRIVATE (object);
- g_list_foreach (priv->sources, (GFunc) source_info_free, NULL);
- g_list_free (priv->sources);
g_free (priv->active_id);
/* Chain up to parent's finalize() method. */
@@ -305,7 +242,6 @@ filter_source_element_clone (EFilterElement *fe)
EMFilterSourceElement *fs = (EMFilterSourceElement *) fe;
EMFilterSourceElement *cpy;
EMailSession *session;
- GList *i;
session = em_filter_source_element_get_session (fs);
cpy = (EMFilterSourceElement *) em_filter_source_element_new (session);
@@ -313,13 +249,6 @@ filter_source_element_clone (EFilterElement *fe)
cpy->priv->active_id = g_strdup (fs->priv->active_id);
- for (i = fs->priv->sources; i != NULL; i = g_list_next (i)) {
- SourceInfo *info = (SourceInfo *) i->data;
- filter_source_element_add_source (
- cpy, info->account_name, info->name,
- info->address, info->uid);
- }
-
return (EFilterElement *) cpy;
}
@@ -327,29 +256,39 @@ static GtkWidget *
filter_source_element_get_widget (EFilterElement *fe)
{
EMFilterSourceElement *fs = (EMFilterSourceElement *) fe;
+ EMailSession *session;
+ ESourceRegistry *registry;
+ GList *list, *link;
GtkWidget *widget;
GtkComboBox *combo_box;
- GList *i;
-
- if (fs->priv->sources == NULL)
- filter_source_element_get_sources (fs);
+ const gchar *extension_name;
widget = gtk_combo_box_text_new ();
combo_box = GTK_COMBO_BOX (widget);
- for (i = fs->priv->sources; i != NULL; i = g_list_next (i)) {
- SourceInfo *info = (SourceInfo *) i->data;
+ session = em_filter_source_element_get_session (fs);
+ registry = e_mail_session_get_registry (session);
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESourceMailIdentity *extension;
const gchar *display_name;
const gchar *address;
const gchar *name;
const gchar *uid;
gchar *label;
- uid = info->uid;
- display_name = info->account_name;
+ uid = e_source_get_uid (source);
+ display_name = e_source_get_display_name (source);
- name = info->name;
- address = info->address;
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+ extension = e_source_get_extension (source, extension_name);
+
+ name = e_source_mail_identity_get_name (extension);
+ address = e_source_mail_identity_get_address (extension);
if (g_strcmp0 (display_name, address) == 0)
label = g_strdup_printf (
@@ -365,6 +304,8 @@ filter_source_element_get_widget (EFilterElement *fe)
g_free (label);
}
+ g_list_free (link);
+
if (fs->priv->active_id != NULL) {
gtk_combo_box_set_active_id (combo_box, fs->priv->active_id);
} else {
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index c346435..e6fe94b 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -36,8 +36,12 @@
#include <glib/gi18n.h>
+#include <libedataserver/e-source-mail-account.h>
+#include <libedataserver/e-source-mail-composition.h>
+#include <libedataserver/e-source-mail-identity.h>
+#include <libedataserver/e-source-mail-submission.h>
+
#include "e-util/e-util.h"
-#include "e-util/e-account-utils.h"
#include "mail-tools.h"
#include "mail-mt.h"
@@ -622,8 +626,9 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
GtkTreeRowReference *uri_row, *path_row;
GtkTreeStore *tree_store;
MailFolderCache *folder_cache;
+ ESourceRegistry *registry;
EMailSession *session;
- EAccount *account;
+ ESource *source;
guint unread;
GtkTreePath *path;
GtkTreeIter sub;
@@ -649,10 +654,11 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
session = em_folder_tree_model_get_session (model);
folder_cache = e_mail_session_get_folder_cache (session);
+ registry = e_mail_session_get_registry (session);
uid = camel_service_get_uid (CAMEL_SERVICE (si->store));
+ source = e_source_registry_lookup_by_uid (registry, uid);
store_is_local = (g_strcmp0 (uid, E_MAIL_SESSION_LOCAL_UID) == 0);
- account = e_get_account_by_uid (uid);
if (!fully_loaded)
load = (fi->child == NULL) && !(fi->flags &
@@ -679,8 +685,8 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
unread = fi->unread;
if (mail_folder_cache_get_folder_from_uri (
folder_cache, uri, &folder) && folder) {
- folder_is_drafts = em_utils_folder_is_drafts (folder);
- folder_is_outbox = em_utils_folder_is_outbox (folder);
+ folder_is_drafts = em_utils_folder_is_drafts (registry, folder);
+ folder_is_outbox = em_utils_folder_is_outbox (registry, folder);
if (folder_is_drafts || folder_is_outbox) {
gint total;
@@ -723,17 +729,43 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
}
}
- if (account != NULL && (flags & CAMEL_FOLDER_TYPE_MASK) == 0) {
- if (!folder_is_drafts && account->drafts_folder_uri != NULL) {
+ if (source != NULL && (flags & CAMEL_FOLDER_TYPE_MASK) == 0) {
+ ESource *identity;
+ ESourceExtension *extension;
+ const gchar *extension_name;
+ const gchar *drafts_folder_uri;
+ const gchar *sent_folder_uri;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ extension = e_source_get_extension (source, extension_name);
+
+ identity = e_source_mail_account_get_identity (
+ E_SOURCE_MAIL_ACCOUNT (extension));
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_COMPOSITION;
+ extension = e_source_get_extension (identity, extension_name);
+
+ drafts_folder_uri =
+ e_source_mail_composition_get_drafts_folder (
+ E_SOURCE_MAIL_COMPOSITION (extension));
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_SUBMISSION;
+ extension = e_source_get_extension (identity, extension_name);
+
+ sent_folder_uri =
+ e_source_mail_submission_get_sent_folder (
+ E_SOURCE_MAIL_SUBMISSION (extension));
+
+ if (!folder_is_drafts && drafts_folder_uri != NULL) {
folder_is_drafts = e_mail_folder_uri_equal (
- CAMEL_SESSION (session), uri,
- account->drafts_folder_uri);
+ CAMEL_SESSION (session),
+ uri, drafts_folder_uri);
}
- if (account->sent_folder_uri != NULL) {
+ if (sent_folder_uri != NULL) {
if (e_mail_folder_uri_equal (
- CAMEL_SESSION (session), uri,
- account->sent_folder_uri)) {
+ CAMEL_SESSION (session),
+ uri, sent_folder_uri)) {
add_flags = CAMEL_FOLDER_TYPE_SENT;
}
}
diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c
index 15f7a3b..6bf9032 100644
--- a/mail/em-subscription-editor.c
+++ b/mail/em-subscription-editor.c
@@ -30,7 +30,6 @@
#include "mail-mt.h"
#include <e-util/e-util.h>
-#include <e-util/e-account-utils.h>
#include <e-util/e-util-private.h>
#include "em-folder-utils.h"
@@ -1538,16 +1537,19 @@ subscription_editor_constructed (GObject *object)
/* Pick an initial store based on the default mail account, if
* one wasn't already given in em_subscription_editor_new(). */
if (editor->priv->initial_store == NULL) {
- EAccount *account;
+ ESource *source;
+ ESourceRegistry *registry;
CamelService *service;
EMailSession *session;
- account = e_get_default_account ();
-
session = em_subscription_editor_get_session (editor);
+ registry = e_mail_session_get_registry (session);
+
+ source = e_source_registry_get_default_mail_account (registry);
service = camel_session_get_service (
- CAMEL_SESSION (session), account->uid);
+ CAMEL_SESSION (session),
+ e_source_get_uid (source));
if (CAMEL_IS_SUBSCRIBABLE (service))
editor->priv->initial_store = g_object_ref (service);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index ac8a436..5c5b9bd 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -55,13 +55,18 @@
#include "mail-tools.h"
#include "e-mail-tag-editor.h"
+#include <libedataserver/e-source-address-book.h>
+#include <libedataserver/e-source-autocomplete.h>
+#include <libedataserver/e-source-mail-account.h>
+#include <libedataserver/e-source-mail-composition.h>
+#include <libedataserver/e-source-mail-identity.h>
+#include <libedataserver/e-source-mail-submission.h>
#include <libedataserver/e-data-server-util.h>
#include <libedataserver/e-flag.h>
#include <libedataserver/e-proxy.h>
#include "e-util/e-util.h"
#include "e-util/e-util-private.h"
#include "e-util/e-mktemp.h"
-#include "e-util/e-account-utils.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-alert-dialog.h"
#include "shell/e-shell.h"
@@ -1109,6 +1114,7 @@ em_utils_selection_get_urilist (GtkSelectionData *selection_data,
/**
* em_utils_folder_is_templates:
+ * @registry: an #ESourceRegistry
* @folder: a #CamelFolder
*
* Decides if @folder is a Templates folder.
@@ -1117,15 +1123,16 @@ em_utils_selection_get_urilist (GtkSelectionData *selection_data,
**/
gboolean
-em_utils_folder_is_templates (CamelFolder *folder)
+em_utils_folder_is_templates (ESourceRegistry *registry,
+ CamelFolder *folder)
{
CamelFolder *local_templates_folder;
CamelSession *session;
CamelStore *store;
- EAccountList *account_list;
- EIterator *iterator;
+ GList *list, *iter;
gchar *folder_uri;
gboolean is_templates = FALSE;
+ const gchar *extension_name;
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
@@ -1141,24 +1148,32 @@ em_utils_folder_is_templates (CamelFolder *folder)
folder_uri = e_mail_folder_uri_from_folder (folder);
- account_list = e_get_account_list ();
- iterator = e_list_get_iterator (E_LIST (account_list));
+ store = camel_folder_get_parent_store (folder);
+ session = camel_service_get_session (CAMEL_SERVICE (store));
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_COMPOSITION;
+ list = e_source_registry_list_sources (registry, extension_name);
- while (!is_templates && e_iterator_is_valid (iterator)) {
- EAccount *account;
+ for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+ ESource *source = E_SOURCE (iter->data);
+ ESourceExtension *extension;
+ const gchar *templates_folder_uri;
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iterator);
+ extension = e_source_get_extension (source, extension_name);
- if (account->templates_folder_uri != NULL)
+ templates_folder_uri =
+ e_source_mail_composition_get_templates_folder (
+ E_SOURCE_MAIL_COMPOSITION (extension));
+
+ if (templates_folder_uri != NULL)
is_templates = e_mail_folder_uri_equal (
- session, folder_uri,
- account->templates_folder_uri);
+ session, folder_uri, templates_folder_uri);
- e_iterator_next (iterator);
+ if (is_templates)
+ break;
}
- g_object_unref (iterator);
+ g_list_free (list);
g_free (folder_uri);
return is_templates;
@@ -1166,6 +1181,7 @@ em_utils_folder_is_templates (CamelFolder *folder)
/**
* em_utils_folder_is_drafts:
+ * @registry: an #ESourceRegistry
* @folder: a #CamelFolder
*
* Decides if @folder is a Drafts folder.
@@ -1173,15 +1189,16 @@ em_utils_folder_is_templates (CamelFolder *folder)
* Returns %TRUE if this is a Drafts folder or %FALSE otherwise.
**/
gboolean
-em_utils_folder_is_drafts (CamelFolder *folder)
+em_utils_folder_is_drafts (ESourceRegistry *registry,
+ CamelFolder *folder)
{
CamelFolder *local_drafts_folder;
CamelSession *session;
CamelStore *store;
- EAccountList *account_list;
- EIterator *iterator;
+ GList *list, *iter;
gchar *folder_uri;
gboolean is_drafts = FALSE;
+ const gchar *extension_name;
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
@@ -1197,24 +1214,32 @@ em_utils_folder_is_drafts (CamelFolder *folder)
folder_uri = e_mail_folder_uri_from_folder (folder);
- account_list = e_get_account_list ();
- iterator = e_list_get_iterator (E_LIST (account_list));
+ store = camel_folder_get_parent_store (folder);
+ session = camel_service_get_session (CAMEL_SERVICE (store));
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_COMPOSITION;
+ list = e_source_registry_list_sources (registry, extension_name);
- while (!is_drafts && e_iterator_is_valid (iterator)) {
- EAccount *account;
+ for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+ ESource *source = E_SOURCE (iter->data);
+ ESourceExtension *extension;
+ const gchar *drafts_folder_uri;
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iterator);
+ extension = e_source_get_extension (source, extension_name);
- if (account->drafts_folder_uri != NULL)
+ drafts_folder_uri =
+ e_source_mail_composition_get_drafts_folder (
+ E_SOURCE_MAIL_COMPOSITION (extension));
+
+ if (drafts_folder_uri != NULL)
is_drafts = e_mail_folder_uri_equal (
- session, folder_uri,
- account->drafts_folder_uri);
+ session, folder_uri, drafts_folder_uri);
- e_iterator_next (iterator);
+ if (is_drafts)
+ break;
}
- g_object_unref (iterator);
+ g_list_free (list);
g_free (folder_uri);
return is_drafts;
@@ -1222,6 +1247,7 @@ em_utils_folder_is_drafts (CamelFolder *folder)
/**
* em_utils_folder_is_sent:
+ * @registry: an #ESourceRegistry
* @folder: a #CamelFolder
*
* Decides if @folder is a Sent folder.
@@ -1229,15 +1255,16 @@ em_utils_folder_is_drafts (CamelFolder *folder)
* Returns %TRUE if this is a Sent folder or %FALSE otherwise.
**/
gboolean
-em_utils_folder_is_sent (CamelFolder *folder)
+em_utils_folder_is_sent (ESourceRegistry *registry,
+ CamelFolder *folder)
{
CamelFolder *local_sent_folder;
CamelSession *session;
CamelStore *store;
- EAccountList *account_list;
- EIterator *iterator;
+ GList *list, *iter;
gchar *folder_uri;
gboolean is_sent = FALSE;
+ const gchar *extension_name;
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
@@ -1253,24 +1280,32 @@ em_utils_folder_is_sent (CamelFolder *folder)
folder_uri = e_mail_folder_uri_from_folder (folder);
- account_list = e_get_account_list ();
- iterator = e_list_get_iterator (E_LIST (account_list));
+ store = camel_folder_get_parent_store (folder);
+ session = camel_service_get_session (CAMEL_SERVICE (store));
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_SUBMISSION;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+ ESource *source = E_SOURCE (iter->data);
+ ESourceExtension *extension;
+ const gchar *sent_folder_uri;
- while (!is_sent && e_iterator_is_valid (iterator)) {
- EAccount *account;
+ extension = e_source_get_extension (source, extension_name);
- /* XXX EIterator misuses const. */
- account = (EAccount *) e_iterator_get (iterator);
+ sent_folder_uri =
+ e_source_mail_submission_get_sent_folder (
+ E_SOURCE_MAIL_SUBMISSION (extension));
- if (account->sent_folder_uri != NULL)
+ if (sent_folder_uri != NULL)
is_sent = e_mail_folder_uri_equal (
- session, folder_uri,
- account->sent_folder_uri);
+ session, folder_uri, sent_folder_uri);
- e_iterator_next (iterator);
+ if (is_sent)
+ break;
}
- g_object_unref (iterator);
+ g_list_free (list);
g_free (folder_uri);
return is_sent;
@@ -1278,6 +1313,7 @@ em_utils_folder_is_sent (CamelFolder *folder)
/**
* em_utils_folder_is_outbox:
+ * @registry: an #ESourceRegistry
* @folder: a #CamelFolder
*
* Decides if @folder is an Outbox folder.
@@ -1285,7 +1321,8 @@ em_utils_folder_is_sent (CamelFolder *folder)
* Returns %TRUE if this is an Outbox folder or %FALSE otherwise.
**/
gboolean
-em_utils_folder_is_outbox (CamelFolder *folder)
+em_utils_folder_is_outbox (ESourceRegistry *registry,
+ CamelFolder *folder)
{
CamelStore *store;
CamelSession *session;
@@ -1410,10 +1447,13 @@ void
em_utils_empty_trash (GtkWidget *parent,
EMailSession *session)
{
+ ESourceRegistry *registry;
GList *list, *link;
g_return_if_fail (E_IS_MAIL_SESSION (session));
+ registry = e_mail_session_get_registry (session);
+
if (!em_utils_prompt_user ((GtkWindow *) parent,
"prompt-on-empty-trash",
"mail:ask-empty-trash", NULL))
@@ -1422,9 +1462,9 @@ em_utils_empty_trash (GtkWidget *parent,
list = camel_session_list_services (CAMEL_SESSION (session));
for (link = list; link != NULL; link = g_list_next (link)) {
- EAccount *account;
CamelProvider *provider;
CamelService *service;
+ ESource *source;
const gchar *uid;
service = CAMEL_SERVICE (link->data);
@@ -1437,14 +1477,10 @@ em_utils_empty_trash (GtkWidget *parent,
if ((provider->flags & CAMEL_PROVIDER_IS_STORAGE) == 0)
continue;
- account = e_get_account_by_uid (uid);
+ source = e_source_registry_lookup_by_uid (registry, uid);
- /* The local store has no corresponding
- * EAccount, so skip the enabled check. */
- if (account != NULL) {
- if (!account->enabled)
- continue;
- }
+ if (source != NULL && !e_source_get_enabled (source))
+ continue;
mail_empty_trash (CAMEL_STORE (service));
}
@@ -1454,19 +1490,6 @@ em_utils_empty_trash (GtkWidget *parent,
/* ********************************************************************** */
-/* runs sync, in main thread */
-static gpointer
-emu_addr_setup (gpointer user_data)
-{
- GError *err = NULL;
- ESourceList **psource_list = user_data;
-
- if (!e_book_client_get_sources (psource_list, &err))
- g_error_free (err);
-
- return NULL;
-}
-
static void
emu_addr_cancel_stop (gpointer data)
{
@@ -1582,8 +1605,6 @@ static GHashTable *emu_books_hash = NULL;
* broken books, which failed to open for some reason */
static GHashTable *emu_broken_books_hash = NULL;
-static ESourceList *emu_books_source_list = NULL;
-
static gboolean
search_address_in_addressbooks (const gchar *address,
gboolean local_only,
@@ -1591,24 +1612,25 @@ search_address_in_addressbooks (const gchar *address,
gpointer user_data),
gpointer user_data)
{
+ EShell *shell;
+ ESourceRegistry *registry;
+ GList *list, *link;
+ GList *addr_sources = NULL;
gboolean found = FALSE, stop = FALSE, found_any = FALSE;
gchar *lowercase_addr;
gpointer ptr;
EBookQuery *book_query;
gchar *query;
- GSList *s, *g, *addr_sources = NULL;
GHook *hook_cancellable;
GCancellable *cancellable;
+ const gchar *extension_name;
if (!address || !*address)
return FALSE;
G_LOCK (contact_cache);
- if (!emu_books_source_list) {
- mail_call_main (
- MAIL_CALL_p_p, (MailMainFunc)
- emu_addr_setup, &emu_books_source_list);
+ if (emu_books_hash == NULL) {
emu_books_hash = g_hash_table_new_full (
g_str_hash, g_str_equal, g_free, g_object_unref);
emu_broken_books_hash = g_hash_table_new_full (
@@ -1617,11 +1639,6 @@ search_address_in_addressbooks (const gchar *address,
g_str_hash, g_str_equal, g_free, NULL);
}
- if (!emu_books_source_list) {
- G_UNLOCK (contact_cache);
- return FALSE;
- }
-
lowercase_addr = g_utf8_strdown (address, -1);
ptr = g_hash_table_lookup (contact_cache, lowercase_addr);
if (ptr != NULL && (check_contact == NULL || ptr == NOT_FOUND_BOOK)) {
@@ -1634,33 +1651,50 @@ search_address_in_addressbooks (const gchar *address,
query = e_book_query_to_string (book_query);
e_book_query_unref (book_query);
- for (g = e_source_list_peek_groups (emu_books_source_list);
- g; g = g_slist_next (g)) {
- ESourceGroup *group = g->data;
+ /* FIXME: Pass the ESourceRegistry in. */
+ shell = e_shell_get_default ();
+ registry = e_shell_get_registry (shell);
+ extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESourceExtension *extension;
+ const gchar *backend_name;
+ gboolean source_is_local;
+ gboolean autocomplete;
- if (!group)
- continue;
+ extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
+ extension = e_source_get_extension (source, extension_name);
+
+ backend_name = e_source_backend_get_backend_name (
+ E_SOURCE_BACKEND (extension));
+
+ source_is_local = (g_strcmp0 (backend_name, "local") == 0);
- if (local_only && !(e_source_group_peek_base_uri (group) &&
- g_str_has_prefix (
- e_source_group_peek_base_uri (group), "local:")))
+ if (local_only && !source_is_local)
continue;
- for (s = e_source_group_peek_sources (group); s; s = g_slist_next (s)) {
- ESource *source = s->data;
- const gchar *completion = e_source_get_property (source, "completion");
+ extension_name = E_SOURCE_EXTENSION_AUTOCOMPLETE;
+ extension = e_source_get_extension (source, extension_name);
- if (completion && g_ascii_strcasecmp (completion, "true") == 0) {
- addr_sources = g_slist_prepend (addr_sources, g_object_ref (source));
- }
- }
+ autocomplete = e_source_autocomplete_get_include_me (
+ E_SOURCE_AUTOCOMPLETE (extension));
+
+ if (!autocomplete)
+ continue;
+
+ addr_sources = g_list_prepend (
+ addr_sources, g_object_ref (source));
}
+ g_list_free (list);
+
cancellable = g_cancellable_new ();
hook_cancellable = mail_cancel_hook_add (emu_addr_cancel_cancellable, cancellable);
- for (s = addr_sources; !stop && !found && s; s = g_slist_next (s)) {
- ESource *source = s->data;
+ for (link = addr_sources; !stop && !found && link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
GSList *contacts;
EBookClient *book_client = NULL;
GHook *hook_stop;
@@ -1668,6 +1702,11 @@ search_address_in_addressbooks (const gchar *address,
const gchar *display_name;
const gchar *uid;
GError *err = NULL;
+ const gchar *display_name;
+ const gchar *uid;
+
+ uid = e_source_get_uid (source);
+ display_name = e_source_get_display_name (source);
uid = e_source_peek_uid (source);
display_name = e_source_peek_name (source);
@@ -1788,7 +1827,7 @@ search_address_in_addressbooks (const gchar *address,
mail_cancel_hook_remove (hook_cancellable);
g_object_unref (cancellable);
- g_slist_free_full (addr_sources, (GDestroyNotify) g_object_unref);
+ g_list_free_full (addr_sources, (GDestroyNotify) g_object_unref);
g_free (query);
@@ -2005,11 +2044,6 @@ emu_free_mail_cache (void)
emu_broken_books_hash = NULL;
}
- if (emu_books_source_list) {
- g_object_unref (emu_books_source_list);
- emu_books_source_list = NULL;
- }
-
if (contact_cache) {
g_hash_table_destroy (contact_cache);
contact_cache = NULL;
@@ -2026,29 +2060,6 @@ emu_free_mail_cache (void)
G_UNLOCK (photos_cache);
}
-void
-em_utils_clear_get_password_canceled_accounts_flag (void)
-{
- EAccountList *account_list;
- EIterator *iterator;
-
- account_list = e_get_account_list ();
-
- for (iterator = e_list_get_iterator (E_LIST (account_list));
- e_iterator_is_valid (iterator);
- e_iterator_next (iterator)) {
- EAccount *account = (EAccount *) e_iterator_get (iterator);
-
- if (account && account->source)
- account->source->get_password_canceled = FALSE;
-
- if (account && account->transport)
- account->transport->get_password_canceled = FALSE;
- }
-
- g_object_unref (iterator);
-}
-
gchar *
em_utils_url_unescape_amp (const gchar *url)
{
@@ -2080,128 +2091,255 @@ em_utils_url_unescape_amp (const gchar *url)
return buff;
}
-static EAccount *
-guess_account_from_folder (CamelFolder *folder)
+static ESource *
+guess_mail_account_from_folder (ESourceRegistry *registry,
+ CamelFolder *folder)
{
+ ESource *source;
CamelStore *store;
const gchar *uid;
+ /* Lookup an ESource by CamelStore UID. */
store = camel_folder_get_parent_store (folder);
uid = camel_service_get_uid (CAMEL_SERVICE (store));
+ source = e_source_registry_lookup_by_uid (registry, uid);
+
+ /* If we found an ESource, make sure it's a mail account. */
+ if (source != NULL) {
+ const gchar *extension_name;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ if (!e_source_has_extension (source, extension_name))
+ source = NULL;
+ }
- return e_get_account_by_uid (uid);
+ return source;
}
-static EAccount *
-guess_account_from_message (CamelMimeMessage *message)
+static ESource *
+guess_mail_account_from_message (ESourceRegistry *registry,
+ CamelMimeMessage *message)
{
+ ESource *source = NULL;
const gchar *uid;
+ /* Lookup an ESource by 'X-Evolution-Source' header. */
uid = camel_mime_message_get_source (message);
+ if (uid != NULL)
+ source = e_source_registry_lookup_by_uid (registry, uid);
- return (uid != NULL) ? e_get_account_by_uid (uid) : NULL;
+ /* If we found an ESource, make sure it's a mail account. */
+ if (source != NULL) {
+ const gchar *extension_name;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ if (!e_source_has_extension (source, extension_name))
+ source = NULL;
+ }
+
+ return source;
}
GHashTable *
-em_utils_generate_account_hash (void)
+em_utils_generate_account_hash (ESourceRegistry *registry)
{
GHashTable *account_hash;
- EAccount *account, *def;
- EAccountList *account_list;
- EIterator *iterator;
-
- account_list = e_get_account_list ();
- account_hash = g_hash_table_new (camel_strcase_hash, camel_strcase_equal);
-
- def = e_get_default_account ();
-
- iterator = e_list_get_iterator (E_LIST (account_list));
-
- while (e_iterator_is_valid (iterator)) {
- account = (EAccount *) e_iterator_get (iterator);
-
- if (account->id->address) {
- EAccount *acnt;
-
- /* Accounts with identical email addresses that are
- * enabled take precedence over the accounts that
- * aren't. If all accounts with matching email
- * addresses are disabled, then the first one in
- * the list takes precedence. The default account
- * always takes precedence no matter what. */
- acnt = g_hash_table_lookup (
- account_hash, account->id->address);
- if (acnt && acnt != def && !acnt->enabled && account->enabled) {
- g_hash_table_remove (
- account_hash, acnt->id->address);
- acnt = NULL;
- }
+ ESource *default_source;
+ GList *list, *link;
+ const gchar *extension_name;
+
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+
+ account_hash = g_hash_table_new_full (
+ (GHashFunc) camel_strcase_hash,
+ (GEqualFunc) camel_strcase_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_object_unref);
+
+ default_source = e_source_registry_get_default_mail_account (registry);
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESource *cached_source;
+ ESource *identity_source;
+ ESourceExtension *extension;
+ const gchar *address;
+ gboolean insert_source;
+ gboolean cached_is_default;
+ gboolean cached_is_enabled;
+ gboolean source_is_default;
+ gboolean source_is_enabled;
+
+ source_is_default = e_source_equal (source, default_source);
+ source_is_enabled = e_source_get_enabled (source);
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ extension = e_source_get_extension (source, extension_name);
+
+ identity_source = e_source_mail_account_get_identity (
+ E_SOURCE_MAIL_ACCOUNT (extension));
+
+ if (identity_source == NULL)
+ continue;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+ extension = e_source_get_extension (
+ identity_source, extension_name);
+
+ address = e_source_mail_identity_get_address (
+ E_SOURCE_MAIL_IDENTITY (extension));
- if (!acnt)
- g_hash_table_insert (
- account_hash, (gchar *)
- account->id->address,
- (gpointer) account);
+ if (address == NULL)
+ continue;
+
+ cached_source = g_hash_table_lookup (account_hash, address);
+
+ if (cached_source != NULL) {
+ cached_is_default = e_source_equal (
+ cached_source, default_source);
+ cached_is_enabled =
+ e_source_get_enabled (cached_source);
+ } else {
+ cached_is_default = FALSE;
+ cached_is_enabled = FALSE;
}
- e_iterator_next (iterator);
+ /* Accounts with identical email addresses that are enabled
+ * take precedence over disabled accounts. If all accounts
+ * with matching email addresses are disabled, the first
+ * one in the list takes precedence. The default account
+ * always takes precedence no matter what. */
+ insert_source =
+ source_is_default ||
+ cached_source == NULL ||
+ (source_is_enabled &&
+ !cached_is_enabled &&
+ !cached_is_default);
+
+ if (insert_source)
+ g_hash_table_insert (
+ account_hash,
+ g_strdup (address),
+ g_object_ref (source));
}
- g_object_unref (iterator);
-
- /* The default account has to be there if none
- * of the enabled accounts are present. */
- if (g_hash_table_size (account_hash) == 0 && def && def->id->address)
- g_hash_table_insert (
- account_hash, (gchar *)
- def->id->address,
- (gpointer) def);
+ g_list_free (list);
return account_hash;
}
-EAccount *
-em_utils_guess_account (CamelMimeMessage *message,
- CamelFolder *folder)
+ESource *
+em_utils_guess_mail_account (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder)
{
- EAccount *account = NULL;
+ ESource *source = NULL;
+ const gchar *newsgroups;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
if (folder != NULL)
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
/* check for newsgroup header */
- if (folder != NULL
- && camel_medium_get_header (CAMEL_MEDIUM (message), "Newsgroups"))
- account = guess_account_from_folder (folder);
+ newsgroups = camel_medium_get_header (
+ CAMEL_MEDIUM (message), "Newsgroups");
+ if (folder != NULL && newsgroups != NULL)
+ source = guess_mail_account_from_folder (registry, folder);
/* check for source folder */
- if (account == NULL && folder != NULL)
- account = guess_account_from_folder (folder);
+ if (source == NULL && folder != NULL)
+ source = guess_mail_account_from_folder (registry, folder);
/* then message source */
- if (account == NULL)
- account = guess_account_from_message (message);
+ if (source == NULL)
+ source = guess_mail_account_from_message (registry, message);
- return account;
+ return source;
}
-EAccount *
-em_utils_guess_account_with_recipients (CamelMimeMessage *message,
- CamelFolder *folder)
+ESource *
+em_utils_guess_mail_identity (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder)
+{
+ ESource *source;
+ ESourceExtension *extension;
+ const gchar *extension_name;
+
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+ g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
+
+ if (folder != NULL)
+ g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
+
+ source = em_utils_guess_mail_account (registry, message, folder);
+
+ if (source == NULL)
+ return NULL;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ extension = e_source_get_extension (source, extension_name);
+
+ return e_source_mail_account_get_identity (
+ E_SOURCE_MAIL_ACCOUNT (extension));
+}
+
+static gboolean
+mail_account_in_recipients (ESourceRegistry *registry,
+ ESource *source,
+ GHashTable *recipients)
{
- EAccount *account = NULL;
- EAccountList *account_list;
+ ESourceExtension *extension;
+ const gchar *extension_name;
+ const gchar *address;
+
+ /* Disregard disabled mail accounts. */
+ if (!e_source_get_enabled (source))
+ return FALSE;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ extension = e_source_get_extension (source, extension_name);
+
+ source = e_source_mail_account_get_identity (
+ E_SOURCE_MAIL_ACCOUNT (extension));
+
+ if (source == NULL)
+ return FALSE;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+ extension = e_source_get_extension (source, extension_name);
+
+ address = e_source_mail_identity_get_address (
+ E_SOURCE_MAIL_IDENTITY (extension));
+
+ if (address == NULL)
+ return FALSE;
+
+ return (g_hash_table_lookup (recipients, address) != NULL);
+}
+
+ESource *
+em_utils_guess_mail_account_with_recipients (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder)
+{
+ ESource *source = NULL;
GHashTable *recipients;
- EIterator *iterator;
CamelInternetAddress *addr;
+ GList *list, *iter;
+ const gchar *extension_name;
const gchar *type;
const gchar *key;
/* This policy is subject to debate and tweaking,
* but please also document the rational here. */
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
/* Build a set of email addresses in which to test for membership.
@@ -2231,53 +2369,128 @@ em_utils_guess_account_with_recipients (CamelMimeMessage *message,
}
/* First Preference: We were given a folder that maps to an
- * enabled account, and that account's email address appears
+ * enabled mail account, and that account's address appears
* in the list of To: or Cc: recipients. */
if (folder != NULL)
- account = guess_account_from_folder (folder);
-
- if (account == NULL || !account->enabled)
- goto second_preference;
+ source = guess_mail_account_from_folder (registry, folder);
- if ((key = account->id->address) == NULL)
+ if (source == NULL)
goto second_preference;
- if (g_hash_table_lookup (recipients, key) != NULL)
+ if (mail_account_in_recipients (registry, source, recipients))
goto exit;
second_preference:
- /* Second Preference: Choose any enabled account whose email
+ /* Second Preference: Choose any enabled mail account whose
* address appears in the list to To: or Cc: recipients. */
- account_list = e_get_account_list ();
- iterator = e_list_get_iterator (E_LIST (account_list));
+ source = NULL;
- while (e_iterator_is_valid (iterator)) {
- account = (EAccount *) e_iterator_get (iterator);
- e_iterator_next (iterator);
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ list = e_source_registry_list_sources (registry, extension_name);
- if (account == NULL || !account->enabled)
- continue;
+ for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+ ESource *temp = E_SOURCE (iter->data);
- if ((key = account->id->address) == NULL)
- continue;
-
- if (g_hash_table_lookup (recipients, key) != NULL) {
- g_object_unref (iterator);
- goto exit;
+ if (mail_account_in_recipients (registry, temp, recipients)) {
+ source = temp;
+ break;
}
}
- g_object_unref (iterator);
- /* Last Preference: Defer to em_utils_guess_account(). */
- account = em_utils_guess_account (message, folder);
+ g_list_free (list);
+
+ if (source != NULL)
+ goto exit;
+
+ /* Last Preference: Defer to em_utils_guess_mail_account(). */
+ source = em_utils_guess_mail_account (registry, message, folder);
exit:
g_hash_table_destroy (recipients);
- return account;
+ return source;
+}
+
+ESource *
+em_utils_guess_mail_identity_with_recipients (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder)
+{
+ ESource *source;
+ ESourceExtension *extension;
+ const gchar *extension_name;
+
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+ g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
+
+ source = em_utils_guess_mail_account_with_recipients (
+ registry, message, folder);
+
+ if (source == NULL)
+ return NULL;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ extension = e_source_get_extension (source, extension_name);
+
+ return e_source_mail_account_get_identity (
+ E_SOURCE_MAIL_ACCOUNT (extension));
+}
+
+gboolean
+em_utils_mail_identity_is_enabled (ESourceRegistry *registry,
+ ESource *mail_identity_source)
+{
+ GList *list, *link;
+ const gchar *extension_name;
+ gboolean found_account = FALSE;
+ gboolean found_enabled_account = FALSE;
+
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
+
+ if (mail_identity_source == NULL)
+ return FALSE;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
+ if (!e_source_has_extension (mail_identity_source, extension_name))
+ return FALSE;
+
+ /* If any enabled account references the given identity, then
+ * the identity is enabled. If no accounts reference the given
+ * identity, then the identity is assumed to be enabled. So in
+ * other words, an identity is disabled if and only if it is
+ * referenced exclusively by disabled accounts. */
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ list = e_source_registry_list_sources (registry, extension_name);
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESourceMailAccount *extension;
+ gboolean enabled;
+
+ extension = e_source_get_extension (source, extension_name);
+
+ enabled = e_source_get_enabled (source);
+ source = e_source_mail_account_get_identity (extension);
+
+ if (source == NULL)
+ continue;
+
+ if (e_source_equal (source, mail_identity_source)) {
+ found_account = TRUE;
+ found_enabled_account |= enabled;
+ }
+
+ if (found_enabled_account)
+ break;
+ }
+
+ g_list_free (list);
+
+ return found_enabled_account || !found_account;
}
void
diff --git a/mail/em-utils.h b/mail/em-utils.h
index f3879ae..3cf650a 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -27,7 +27,6 @@
#include <sys/types.h>
#include <camel/camel.h>
#include <libedataserver/e-proxy.h>
-#include <libedataserver/e-account.h>
#include <mail/e-mail-reader.h>
#include <mail/e-mail-session.h>
@@ -64,10 +63,14 @@ void em_utils_selection_get_uidlist (GtkSelectionData *data, EMailSession *sessi
void em_utils_selection_set_urilist (GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids);
void em_utils_selection_get_urilist (GtkSelectionData *data, CamelFolder *folder);
-gboolean em_utils_folder_is_drafts (CamelFolder *folder);
-gboolean em_utils_folder_is_templates (CamelFolder *folder);
-gboolean em_utils_folder_is_sent (CamelFolder *folder);
-gboolean em_utils_folder_is_outbox (CamelFolder *folder);
+gboolean em_utils_folder_is_drafts (ESourceRegistry *registry,
+ CamelFolder *folder);
+gboolean em_utils_folder_is_templates (ESourceRegistry *registry,
+ CamelFolder *folder);
+gboolean em_utils_folder_is_sent (ESourceRegistry *registry,
+ CamelFolder *folder);
+gboolean em_utils_folder_is_outbox (ESourceRegistry *registry,
+ CamelFolder *folder);
EProxy * em_utils_get_proxy (void);
@@ -81,18 +84,27 @@ void em_utils_empty_trash (GtkWidget *parent,
gboolean em_utils_in_addressbook (CamelInternetAddress *addr, gboolean local_only);
CamelMimePart *em_utils_contact_photo (CamelInternetAddress *addr, gboolean local);
-/* clears flag 'get_password_canceled' at every known accounts, so if needed, get_password will show dialog */
-void em_utils_clear_get_password_canceled_accounts_flag (void);
-
/* Unescapes & back to a real & in URIs */
gchar *em_utils_url_unescape_amp (const gchar *url);
-GHashTable * em_utils_generate_account_hash (void);
-EAccount * em_utils_guess_account (CamelMimeMessage *message,
+GHashTable * em_utils_generate_account_hash (ESourceRegistry *registry);
+ESource * em_utils_guess_mail_account (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder);
+ESource * em_utils_guess_mail_account_with_recipients
+ (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder);
+ESource * em_utils_guess_mail_identity (ESourceRegistry *registry,
+ CamelMimeMessage *message,
CamelFolder *folder);
-EAccount * em_utils_guess_account_with_recipients
- (CamelMimeMessage *message,
+ESource * em_utils_guess_mail_identity_with_recipients
+ (ESourceRegistry *registry,
+ CamelMimeMessage *message,
CamelFolder *folder);
+gboolean em_utils_mail_identity_is_enabled
+ (ESourceRegistry *registry,
+ ESource *mail_identity_source);
void emu_remove_from_mail_cache (const GSList *addresses);
void emu_remove_from_mail_cache_1 (const gchar *address);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index fc003ac..9becb10 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -32,8 +32,6 @@
#include <libedataserver/e-data-server-util.h>
#include <e-util/e-util.h>
-#include "e-util/e-account-utils.h"
-#include "e-util/e-signature-utils.h"
#include "e-mail-folder-utils.h"
#include "mail-config.h"
@@ -138,24 +136,6 @@ settings_int_value_changed (GSettings *settings,
*save_location = g_settings_get_int (settings, key);
}
-void
-mail_config_write (void)
-{
- EAccountList *account_list;
- ESignatureList *signature_list;
-
- if (!config)
- return;
-
- account_list = e_get_account_list ();
- signature_list = e_get_signature_list ();
-
- e_account_list_save (account_list);
- e_signature_list_save (signature_list);
-
- g_settings_sync ();
-}
-
gint
mail_config_get_address_count (void)
{
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 2903809..c66630d 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -29,7 +29,6 @@ G_BEGIN_DECLS
/* Configuration */
void mail_config_init (EMailSession *session);
-void mail_config_write (void);
/* General Accessor functions */
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index e95a812..1db8c2f 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -845,56 +845,6 @@ for display purposes only. </property>
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="GtkVBox" id="signature-preview-section">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="signature-preview-header">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Preview</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="signature-preview-alignment">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkScrolledWindow" id="signature-preview-scrolled-window">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
<packing>
<property name="position">1</property>
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index eb046c5..243966d 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -343,11 +343,16 @@ update_1folder (MailFolderCache *cache,
const gchar *msg_subject,
CamelFolderInfo *info)
{
+ EMailSession *session;
+ ESourceRegistry *registry;
struct _folder_update *up;
CamelFolder *folder;
gint unread = -1;
gint deleted;
+ session = mail_folder_cache_get_session (cache);
+ registry = e_mail_session_get_registry (session);
+
folder = mfi->folder;
if (folder) {
gboolean folder_is_sent;
@@ -356,9 +361,9 @@ update_1folder (MailFolderCache *cache,
gboolean folder_is_vtrash;
gboolean special_case;
- folder_is_sent = em_utils_folder_is_sent (folder);
- folder_is_drafts = em_utils_folder_is_drafts (folder);
- folder_is_outbox = em_utils_folder_is_outbox (folder);
+ folder_is_sent = em_utils_folder_is_sent (registry, folder);
+ folder_is_drafts = em_utils_folder_is_drafts (registry, folder);
+ folder_is_outbox = em_utils_folder_is_outbox (registry, folder);
folder_is_vtrash = CAMEL_IS_VTRASH_FOLDER (folder);
special_case =
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 27b48c2..1408174 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -35,7 +35,10 @@
#include <glib/gi18n.h>
#include <libedataserver/e-data-server-util.h>
-#include "e-util/e-account-utils.h"
+#include <libedataserver/e-source-mail-account.h>
+#include <libedataserver/e-source-mail-submission.h>
+
+#include <shell/e-shell.h>
#include "em-filter-rule.h"
#include "em-utils.h"
@@ -73,7 +76,6 @@ struct _fetch_mail_msg {
CamelStore *store;
GCancellable *cancellable; /* we have our own cancellation
* struct, the other should be empty */
- gint keep; /* keep on server? */
void (*done)(gpointer data);
gpointer data;
@@ -211,12 +213,19 @@ fetch_mail_exec (struct _fetch_mail_msg *m,
GError **error)
{
struct _filter_mail_msg *fm = (struct _filter_mail_msg *) m;
+ GObjectClass *class;
CamelFolder *folder = NULL;
CamelService *service;
CamelSession *session;
+ CamelSettings *settings;
+ CamelUIDCache *cache = NULL;
CamelURL *url;
+ gboolean keep = FALSE;
+ gboolean delete_fetched;
gboolean is_local_delivery;
+ const gchar *data_dir;
const gchar *uid;
+ gchar *cachename;
gint i;
service = CAMEL_SERVICE (m->store);
@@ -228,6 +237,19 @@ 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_get_settings (service);
+ data_dir = camel_service_get_user_data_dir (service);
+
+ /* XXX This is a POP3-specific setting. */
+ class = G_OBJECT_GET_CLASS (settings);
+ if (g_object_class_find_property (class, "keep-on-server") != NULL)
+ g_object_get (settings, "keep-on-server", &keep, NULL);
+
+ /* Just for readability. */
+ delete_fetched = !keep;
+
url = camel_service_new_camel_url (service);
is_local_delivery = em_utils_is_local_delivery_mbox_file (url);
@@ -254,8 +276,6 @@ fetch_mail_exec (struct _fetch_mail_msg *m,
g_free (path);
g_free (url_string);
} else {
- uid = camel_service_get_uid (service);
-
folder = fm->source_folder =
e_mail_session_get_inbox_sync (
fm->session, uid, cancellable, error);
@@ -263,78 +283,72 @@ fetch_mail_exec (struct _fetch_mail_msg *m,
camel_url_free (url);
- if (folder != NULL) {
- /* This handles 'keep on server' stuff, if we have any new
- * uid's to copy across, we need to copy them to a new array
- * 'cause of the way fetch_mail_free works. */
- CamelUIDCache *cache = NULL;
- CamelStore *parent_store;
- CamelService *service;
- const gchar *data_dir;
- gchar *cachename;
-
- parent_store = camel_folder_get_parent_store (folder);
+ if (folder == NULL)
+ goto exit;
- service = CAMEL_SERVICE (parent_store);
- data_dir = camel_service_get_user_data_dir (service);
+ /* This handles 'keep on server' stuff, if we have any new
+ * uid's to copy across, we need to copy them to a new array
+ * 'cause of the way fetch_mail_free works. */
- cachename = g_build_filename (data_dir, "uid-cache", NULL);
- cache = camel_uid_cache_new (cachename);
- g_free (cachename);
+ cachename = g_build_filename (data_dir, "uid-cache", NULL);
+ cache = camel_uid_cache_new (cachename);
+ g_free (cachename);
- if (cache) {
- GPtrArray *folder_uids, *cache_uids, *uids;
+ if (cache) {
+ GPtrArray *folder_uids, *cache_uids, *uids;
- folder_uids = camel_folder_get_uids (folder);
- cache_uids = camel_uid_cache_get_new_uids (cache, folder_uids);
- if (cache_uids) {
- /* need to copy this, sigh */
- fm->source_uids = uids = g_ptr_array_new ();
- g_ptr_array_set_size (uids, cache_uids->len);
- for (i = 0; i < cache_uids->len; i++)
- uids->pdata[i] = g_strdup (cache_uids->pdata[i]);
- camel_uid_cache_free_uids (cache_uids);
+ folder_uids = camel_folder_get_uids (folder);
+ cache_uids = camel_uid_cache_get_new_uids (cache, folder_uids);
+ if (cache_uids) {
+ /* need to copy this, sigh */
+ fm->source_uids = uids = g_ptr_array_new ();
+ g_ptr_array_set_size (uids, cache_uids->len);
+ for (i = 0; i < cache_uids->len; i++)
+ uids->pdata[i] = g_strdup (cache_uids->pdata[i]);
+ camel_uid_cache_free_uids (cache_uids);
- fm->cache = cache;
- em_filter_folder_element_exec (fm, cancellable, error);
+ fm->cache = cache;
- /* need to uncancel so writes/etc. don't fail */
- if (g_cancellable_is_cancelled (m->cancellable))
- g_cancellable_reset (m->cancellable);
+ /* FIXME Should return a success/failure flag. */
+ em_filter_folder_element_exec (fm, cancellable, error);
- /* save the cache of uids that we've just downloaded */
- camel_uid_cache_save (cache);
- }
+ /* need to uncancel so writes/etc. don't fail */
+ if (g_cancellable_is_cancelled (m->cancellable))
+ g_cancellable_reset (m->cancellable);
- if (fm->delete && (!error || !*error)) {
- /* not keep on server - just delete all
- * the actual messages on the server */
- for (i = 0; i < folder_uids->len; i++) {
- camel_folder_delete_message (
- folder, folder_uids->pdata[i]);
- }
- }
+ /* save the cache of uids that we've just downloaded */
+ camel_uid_cache_save (cache);
+ }
- if ((fm->delete || cache_uids) && (!error || !*error)) {
- /* expunge messages (downloaded so far) */
- /* FIXME Not passing a GCancellable or GError here. */
- camel_folder_synchronize_sync (
- folder, fm->delete, NULL, NULL);
+ if (delete_fetched && (!error || !*error)) {
+ /* not keep on server - just delete all
+ * the actual messages on the server */
+ for (i = 0; i < folder_uids->len; i++) {
+ camel_folder_delete_message (
+ folder, folder_uids->pdata[i]);
}
+ }
- camel_uid_cache_destroy (cache);
- camel_folder_free_uids (folder, folder_uids);
- } else {
- em_filter_folder_element_exec (fm, cancellable, error);
+ if ((delete_fetched || cache_uids) && (!error || !*error)) {
+ /* expunge messages (downloaded so far) */
+ /* FIXME Not passing a GCancellable or GError here. */
+ camel_folder_synchronize_sync (
+ folder, delete_fetched, NULL, NULL);
}
- /* we unref the source folder here since we
- * may now block in finalize (we try to
- * disconnect cleanly) */
- g_object_unref (fm->source_folder);
- fm->source_folder = NULL;
+ camel_uid_cache_destroy (cache);
+ camel_folder_free_uids (folder, folder_uids);
+ } else {
+ /* FIXME Should return a success/failure flag. */
+ em_filter_folder_element_exec (fm, cancellable, error);
}
+ /* we unref the source folder here since we
+ * may now block in finalize (we try to
+ * disconnect cleanly) */
+ g_object_unref (fm->source_folder);
+ fm->source_folder = NULL;
+
exit:
/* we unref this here as it may have more work to do (syncing
* folders and whatnot) before we are really done */
@@ -381,7 +395,6 @@ static MailMsgInfo fetch_mail_info = {
/* ouch, a 'do everything' interface ... */
void
mail_fetch_mail (CamelStore *store,
- gint keep,
const gchar *type,
GCancellable *cancellable,
CamelFilterGetFolderFunc get_folder,
@@ -403,7 +416,6 @@ mail_fetch_mail (CamelStore *store,
fm = (struct _filter_mail_msg *) m;
fm->session = g_object_ref (session);
m->store = g_object_ref (store);
- fm->delete = !keep;
fm->cache = NULL;
if (cancellable)
m->cancellable = g_object_ref (cancellable);
@@ -457,6 +469,44 @@ static void report_status (struct _send_queue_msg *m,
const gchar *desc,
...);
+static gboolean
+get_submission_details_from_identity (EMailSession *session,
+ const gchar *identity_uid,
+ gchar **out_transport_uid,
+ gchar **out_sent_folder_uri)
+{
+ ESource *source;
+ ESourceRegistry *registry;
+ ESourceExtension *extension;
+ const gchar *extension_name;
+ const gchar *sent_folder_uri;
+ const gchar *transport_uid;
+
+ registry = e_mail_session_get_registry (session);
+ extension_name = E_SOURCE_EXTENSION_MAIL_SUBMISSION;
+ source = e_source_registry_lookup_by_uid (registry, identity_uid);
+
+ if (source == NULL)
+ return FALSE;
+
+ if (!e_source_has_extension (source, extension_name))
+ return FALSE;
+
+ extension = e_source_get_extension (source, extension_name);
+
+ sent_folder_uri = e_source_mail_submission_get_sent_folder (
+ E_SOURCE_MAIL_SUBMISSION (extension));
+
+ transport_uid = e_source_mail_submission_get_transport_uid (
+ E_SOURCE_MAIL_SUBMISSION (extension));
+
+ *out_transport_uid = g_strdup (transport_uid);
+
+ *out_sent_folder_uri = g_strdup (sent_folder_uri);
+
+ return TRUE;
+}
+
/* send 1 message to a specific transport */
static void
mail_send_message (struct _send_queue_msg *m,
@@ -467,11 +517,11 @@ mail_send_message (struct _send_queue_msg *m,
GCancellable *cancellable,
GError **error)
{
- EAccount *account = NULL;
+ CamelService *service;
const CamelInternetAddress *iaddr;
CamelAddress *from, *recipients;
CamelMessageInfo *info = NULL;
- CamelProvider *provider;
+ CamelProvider *provider = NULL;
gchar *transport_uid = NULL;
gchar *sent_folder_uri = NULL;
const gchar *resent_from, *tmp;
@@ -492,48 +542,31 @@ mail_send_message (struct _send_queue_msg *m,
err = g_string_new ("");
xev = mail_tool_remove_xevolution_headers (message);
- tmp = camel_header_raw_find (&xev, "X-Evolution-Account", NULL);
+ tmp = camel_header_raw_find (&xev, "X-Evolution-Identity", NULL);
if (tmp != NULL) {
- gchar *name;
-
- name = g_strstrip (g_strdup (tmp));
- if ((account = e_get_account_by_uid (name))
- /* 'old' x-evolution-account stored the name, how silly */
- || (account = e_get_account_by_name (name))) {
- if (account->transport) {
- CamelService *service;
- gchar *transport_uid;
-
- transport_uid = g_strconcat (
- account->uid, "-transport", NULL);
- service = camel_session_get_service (
- CAMEL_SESSION (m->session),
- transport_uid);
- g_free (transport_uid);
-
- if (CAMEL_IS_TRANSPORT (service))
- transport = CAMEL_TRANSPORT (service);
- }
+ gchar *identity_uid;
- sent_folder_uri = g_strdup (account->sent_folder_uri);
- }
- g_free (name);
+ identity_uid = g_strstrip (g_strdup (tmp));
+ get_submission_details_from_identity (
+ m->session, identity_uid,
+ &transport_uid, &sent_folder_uri);
+ g_free (identity_uid);
}
- if (!account) {
- /* default back to these headers */
- tmp = camel_header_raw_find(&xev, "X-Evolution-Transport", NULL);
- if (tmp)
- transport_uid = g_strstrip (g_strdup (tmp));
+ tmp = camel_header_raw_find (&xev, "X-Evolution-Transport", NULL);
+ if (transport_uid == NULL && tmp != NULL)
+ transport_uid = g_strstrip (g_strdup (tmp));
- tmp = camel_header_raw_find(&xev, "X-Evolution-Fcc", NULL);
- if (tmp)
- sent_folder_uri = g_strstrip (g_strdup (tmp));
- }
+ tmp = camel_header_raw_find (&xev, "X-Evolution-Fcc", NULL);
+ if (sent_folder_uri == NULL && tmp != NULL)
+ sent_folder_uri = g_strstrip (g_strdup (tmp));
- if (transport != NULL) {
- const gchar *uid;
+ service = camel_session_get_service (
+ CAMEL_SESSION (m->session), transport_uid);
+ if (service != NULL)
+ provider = camel_service_get_provider (service);
+ if (CAMEL_IS_TRANSPORT (service)) {
/* Let the dialog know the right account it is using. */
uid = camel_service_get_uid (CAMEL_SERVICE (transport));
report_status (m, CAMEL_FILTER_STATUS_ACTION, 0, uid);
@@ -560,12 +593,12 @@ mail_send_message (struct _send_queue_msg *m,
if (camel_address_length (recipients) > 0) {
if (!em_utils_connect_service_sync (
- CAMEL_SERVICE (transport), cancellable, error))
+ service, cancellable, error))
goto exit;
if (!camel_transport_send_to_sync (
- transport, message, from,
- recipients, cancellable, error))
+ CAMEL_TRANSPORT (service), message,
+ from, recipients, cancellable, error))
goto exit;
}
@@ -616,8 +649,6 @@ mail_send_message (struct _send_queue_msg *m,
}
}
- provider = camel_service_get_provider (CAMEL_SERVICE (transport));
-
if (provider == NULL
|| !(provider->flags & CAMEL_PROVIDER_DISABLE_SENT_FOLDER)) {
GError *local_error = NULL;
@@ -1303,9 +1334,10 @@ expunge_pop3_stores (CamelFolder *expunging,
CamelStore *parent_store;
CamelService *service;
CamelSession *session;
+ ESourceRegistry *registry;
GPtrArray *uids;
- EAccount *account;
- EIterator *iter;
+ GList *list, *link;
+ const gchar *extension_name;
gboolean success = TRUE;
guint ii;
@@ -1313,6 +1345,7 @@ expunge_pop3_stores (CamelFolder *expunging,
service = CAMEL_SERVICE (parent_store);
session = camel_service_get_session (service);
+ registry = e_mail_session_get_registry (E_MAIL_SESSION (session));
uids = camel_folder_get_uids (expunging);
@@ -1373,77 +1406,89 @@ expunge_pop3_stores (CamelFolder *expunging,
return TRUE;
}
- for (iter = e_list_get_iterator ((EList *) e_get_account_list ());
- e_iterator_is_valid (iter); e_iterator_next (iter)) {
- account = (EAccount *) e_iterator_get (iter);
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ list = e_source_registry_list_sources (registry, extension_name);
- if (account->enabled &&
- account->source && account->source->url &&
- g_str_has_prefix (account->source->url, "pop://")) {
- CamelFolder *folder;
- CamelService *service;
- CamelSettings *settings;
- gboolean any_found = FALSE, delete_expunged = FALSE, keep_on_server = FALSE;
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ ESource *source = E_SOURCE (link->data);
+ ESourceBackend *extension;
+ CamelFolder *folder;
+ CamelService *service;
+ CamelSettings *settings;
+ const gchar *backend_name;
+ const gchar *source_uid;
+ gboolean any_found = FALSE;
+ gboolean delete_expunged = FALSE;
+ gboolean keep_on_server = FALSE;
+ gboolean enabled;
- service = camel_session_get_service (
- session, account->uid);
+ source_uid = e_source_get_uid (source);
+ enabled = e_source_get_enabled (source);
- if (!CAMEL_IS_STORE (service))
- continue;
+ extension = e_source_get_extension (source, extension_name);
+ backend_name = e_source_backend_get_backend_name (extension);
- settings = camel_service_get_settings (service);
- if (!settings)
- continue;
+ if (!enabled || g_strcmp0 (backend_name, "pop") != 0)
+ continue;
- g_object_get (
- settings,
- "delete-expunged", &delete_expunged,
- "keep-on-server", &keep_on_server,
- NULL);
+ service = camel_session_get_service (
+ CAMEL_SESSION (session), source_uid);
- if (!keep_on_server || !delete_expunged)
- continue;
+ settings = camel_service_get_settings (service);
- folder = e_mail_session_get_inbox_sync (
- E_MAIL_SESSION (session),
- account->uid, cancellable, error);
+ g_object_get (
+ settings,
+ "delete-expunged", &delete_expunged,
+ "keep-on-server", &keep_on_server,
+ NULL);
- /* Abort the loop on error. */
- if (folder == NULL) {
- success = FALSE;
- break;
- }
+ if (!keep_on_server || !delete_expunged)
+ continue;
- uids = camel_folder_get_uids (folder);
- if (uids) {
- for (ii = 0; ii < uids->len; ii++) {
- /* ensure the ID is from this account,
- * as it's generated by evolution */
- const gchar *source_uid;
-
- source_uid = g_hash_table_lookup (
- expunging_uids, uids->pdata[ii]);
- if (folder_is_from_source_uid (folder, source_uid)) {
- any_found = TRUE;
- camel_folder_delete_message (folder, uids->pdata[ii]);
- }
- }
- camel_folder_free_uids (folder, uids);
- }
+ folder = camel_store_get_inbox_folder_sync (
+ CAMEL_STORE (service), cancellable, error);
- if (any_found)
- success = camel_folder_synchronize_sync (folder, TRUE, cancellable, error);
+ /* Abort the loop on error. */
+ if (folder == NULL) {
+ success = FALSE;
+ break;
+ }
+ uids = camel_folder_get_uids (folder);
+
+ if (uids == NULL) {
g_object_unref (folder);
+ continue;
+ }
- /* Abort the loop on error. */
- if (!success)
- break;
+ for (ii = 0; ii < uids->len; ii++) {
+ /* ensure the ID is from this account,
+ * as it's generated by evolution */
+ const gchar *source_uid;
+
+ source_uid = g_hash_table_lookup (
+ expunging_uids, uids->pdata[ii]);
+ if (folder_is_from_source_uid (folder, source_uid)) {
+ any_found = TRUE;
+ camel_folder_delete_message (
+ folder, uids->pdata[ii]);
+ }
}
+
+ camel_folder_free_uids (folder, uids);
+
+ if (any_found)
+ success = camel_folder_synchronize_sync (
+ folder, TRUE, cancellable, error);
+
+ g_object_unref (folder);
+
+ /* Abort the loop on error. */
+ if (!success)
+ break;
}
- if (iter)
- g_object_unref (iter);
+ g_list_free (list);
g_hash_table_destroy (expunging_uids);
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index b8eb184..99983b4 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -73,7 +73,6 @@ void mail_send_queue (EMailSession *session,
gpointer data);
void mail_fetch_mail (CamelStore *store,
- gint keep,
const gchar *type,
GCancellable *cancellable,
CamelFilterGetFolderFunc get_folder,
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index f38cdb3..2b9feac 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -29,11 +29,11 @@
#include <glib/gi18n.h>
-#include "libedataserver/e-account-list.h"
+#include <libedataserver/e-source-mail-account.h>
+#include <libedataserver/e-source-mail-submission.h>
-#include "shell/e-shell.h"
-#include "e-util/e-account-utils.h"
-#include "e-util/e-util.h"
+#include <e-util/e-util.h>
+#include <shell/e-shell.h>
#include "e-mail-folder-utils.h"
#include "e-mail-session.h"
@@ -470,7 +470,7 @@ static struct _send_data *
build_dialog (GtkWindow *parent,
EMailSession *session,
CamelFolder *outbox,
- EAccount *outgoing_account,
+ CamelService *transport,
gboolean allow_send)
{
GtkDialog *gd;
@@ -487,7 +487,6 @@ build_dialog (GtkWindow *parent,
GtkWidget *progress_bar;
GtkWidget *cancel_button;
EMailAccountStore *account_store;
- CamelService *transport = NULL;
struct _send_info *info;
gchar *pretty_url;
EMEventTargetSendReceive *target;
@@ -495,17 +494,6 @@ build_dialog (GtkWindow *parent,
account_store = e_mail_session_get_account_store (session);
- /* Convert the outgoing account to a CamelTransport. */
- if (outgoing_account != NULL) {
- gchar *transport_uid;
-
- transport_uid = g_strdup_printf (
- "%s-transport", outgoing_account->uid);
- transport = camel_session_get_service (
- CAMEL_SESSION (session), transport_uid);
- g_free (transport_uid);
- }
-
send_recv_dialog = gtk_dialog_new ();
gd = GTK_DIALOG (send_recv_dialog);
@@ -1111,14 +1099,59 @@ receive_update_got_store (CamelStore *store,
}
}
+static CamelService *
+get_default_transport (EMailSession *session)
+{
+ ESource *source;
+ ESourceRegistry *registry;
+ const gchar *extension_name;
+
+ registry = e_mail_session_get_registry (session);
+ source = e_source_registry_get_default_mail_account (registry);
+
+ if (source == NULL)
+ return NULL;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ if (e_source_has_extension (source, extension_name)) {
+ ESourceMailAccount *extension;
+ const gchar *uid;
+
+ extension = e_source_get_extension (source, extension_name);
+ uid = e_source_mail_account_get_identity_uid (extension);
+ source = e_source_registry_lookup_by_uid (registry, uid);
+ } else
+ source = NULL;
+
+ if (source == NULL)
+ return NULL;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_SUBMISSION;
+ if (e_source_has_extension (source, extension_name)) {
+ ESourceMailSubmission *extension;
+ const gchar *uid;
+
+ extension = e_source_get_extension (source, extension_name);
+ uid = e_source_mail_submission_get_transport_uid (extension);
+ source = e_source_registry_lookup_by_uid (registry, uid);
+ } else
+ source = NULL;
+
+ if (source == NULL)
+ return NULL;
+
+ return camel_session_get_service (
+ CAMEL_SESSION (session), e_source_get_uid (source));
+}
+
static GtkWidget *
send_receive (GtkWindow *parent,
EMailSession *session,
gboolean allow_send)
{
CamelFolder *local_outbox;
+ CamelService *transport;
struct _send_data *data;
- EAccount *account;
GList *scan;
if (send_recv_dialog != NULL) {
@@ -1131,16 +1164,14 @@ send_receive (GtkWindow *parent,
if (!camel_session_get_online (CAMEL_SESSION (session)))
return send_recv_dialog;
- account = e_get_default_account ();
- if (!account || !account->transport->url)
- return send_recv_dialog;
+ transport = get_default_transport (session);
local_outbox =
e_mail_session_get_local_folder (
session, E_MAIL_LOCAL_FOLDER_OUTBOX);
data = build_dialog (
- parent, session, local_outbox, account, allow_send);
+ parent, session, local_outbox, transport, allow_send);
for (scan = data->infos; scan != NULL; scan = scan->next) {
struct _send_info *info = scan->data;
@@ -1152,7 +1183,6 @@ send_receive (GtkWindow *parent,
case SEND_RECEIVE:
mail_fetch_mail (
CAMEL_STORE (info->service),
- info->keep_on_server,
E_FILTER_SOURCE_INCOMING,
info->cancellable,
receive_get_folder, info,
@@ -1196,201 +1226,6 @@ mail_receive (GtkWindow *parent,
return send_receive (parent, session, FALSE);
}
-struct _auto_data {
- EAccount *account;
- EMailSession *session;
- gint period; /* in seconds */
- gint timeout_id;
-};
-
-static GHashTable *auto_active;
-
-static gboolean
-auto_timeout (gpointer data)
-{
- CamelService *service;
- CamelSession *session;
- struct _auto_data *info = data;
-
- session = CAMEL_SESSION (info->session);
-
- service = camel_session_get_service (
- session, info->account->uid);
- g_return_val_if_fail (CAMEL_IS_SERVICE (service), TRUE);
-
- if (camel_session_get_online (session))
- mail_receive_service (service);
-
- return TRUE;
-}
-
-static void
-auto_account_removed (EAccountList *eal,
- EAccount *ea,
- gpointer dummy)
-{
- struct _auto_data *info = g_object_get_data((GObject *)ea, "mail-autoreceive");
-
- g_return_if_fail (info != NULL);
-
- if (info->timeout_id) {
- g_source_remove (info->timeout_id);
- info->timeout_id = 0;
- }
-}
-
-static void
-auto_account_finalized (struct _auto_data *info)
-{
- if (info->session != NULL)
- g_object_unref (info->session);
- if (info->timeout_id)
- g_source_remove (info->timeout_id);
- g_free (info);
-}
-
-static void
-auto_account_commit (struct _auto_data *info)
-{
- gint period, check;
-
- check = info->account->enabled
- && e_account_get_bool (info->account, E_ACCOUNT_SOURCE_AUTO_CHECK)
- && e_account_get_string (info->account, E_ACCOUNT_SOURCE_URL);
- period = e_account_get_int (info->account, E_ACCOUNT_SOURCE_AUTO_CHECK_TIME) * 60;
- period = MAX (60, period);
-
- if (info->timeout_id
- && (!check
- || period != info->period)) {
- g_source_remove (info->timeout_id);
- info->timeout_id = 0;
- }
- info->period = period;
- if (check && info->timeout_id == 0)
- info->timeout_id = g_timeout_add_seconds (info->period, auto_timeout, info);
-}
-
-static void
-auto_account_added (EAccountList *eal,
- EAccount *ea,
- EMailSession *session)
-{
- struct _auto_data *info;
-
- info = g_malloc0 (sizeof (*info));
- info->account = ea;
- info->session = g_object_ref (session);
- g_object_set_data_full (
- G_OBJECT (ea), "mail-autoreceive", info,
- (GDestroyNotify) auto_account_finalized);
- auto_account_commit (info);
-}
-
-static void
-auto_account_changed (EAccountList *eal,
- EAccount *ea,
- gpointer dummy)
-{
- struct _auto_data *info;
-
- info = g_object_get_data (G_OBJECT (ea), "mail-autoreceive");
-
- if (info != NULL)
- auto_account_commit (info);
-}
-
-static void
-auto_online (EShell *shell)
-{
- EIterator *iter;
- EAccountList *accounts;
- EShellSettings *shell_settings;
- struct _auto_data *info;
- gboolean can_update_all;
-
- if (!e_shell_get_online (shell))
- return;
-
- shell_settings = e_shell_get_shell_settings (shell);
-
- can_update_all =
- e_shell_settings_get_boolean (
- shell_settings, "mail-check-on-start") &&
- e_shell_settings_get_boolean (
- shell_settings, "mail-check-all-on-start");
-
- accounts = e_get_account_list ();
- for (iter = e_list_get_iterator ((EList *) accounts);
- e_iterator_is_valid (iter);
- e_iterator_next (iter)) {
- EAccount *account = (EAccount *) e_iterator_get (iter);
-
- if (!account || !account->enabled)
- continue;
-
- info = g_object_get_data (
- G_OBJECT (account), "mail-autoreceive");
- if (info && (info->timeout_id || can_update_all))
- auto_timeout (info);
- }
-
- if (iter)
- g_object_unref (iter);
-}
-
-/* call to setup initial, and after changes are made to the config */
-/* FIXME: Need a cleanup funciton for when object is deactivated */
-void
-mail_autoreceive_init (EMailSession *session)
-{
- EShell *shell;
- EShellSettings *shell_settings;
- EAccountList *accounts;
- EIterator *iter;
-
- g_return_if_fail (E_IS_MAIL_SESSION (session));
-
- if (auto_active)
- return;
-
- accounts = e_get_account_list ();
- auto_active = g_hash_table_new (g_str_hash, g_str_equal);
-
- g_signal_connect (
- accounts, "account-added",
- G_CALLBACK (auto_account_added), session);
- g_signal_connect (
- accounts, "account-removed",
- G_CALLBACK (auto_account_removed), NULL);
- g_signal_connect (
- accounts, "account-changed",
- G_CALLBACK (auto_account_changed), NULL);
-
- for (iter = e_list_get_iterator ((EList *) accounts);
- e_iterator_is_valid (iter);
- e_iterator_next (iter))
- auto_account_added (
- accounts, (EAccount *)
- e_iterator_get (iter), session);
-
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
-
- if (e_shell_settings_get_boolean (
- shell_settings, "mail-check-on-start")) {
- auto_online (shell);
-
- /* also flush outbox on start */
- if (e_shell_get_online (shell))
- mail_send (session);
- }
-
- g_signal_connect (
- shell, "notify::online",
- G_CALLBACK (auto_online), NULL);
-}
-
/* We setup the download info's in a hashtable, if we later
* need to build the gui, we insert them in to add them. */
void
@@ -1444,7 +1279,6 @@ mail_receive_service (CamelService *service)
case SEND_RECEIVE:
mail_fetch_mail (
CAMEL_STORE (service),
- info->keep_on_server,
E_FILTER_SOURCE_INCOMING,
info->cancellable,
receive_get_folder, info,
@@ -1480,17 +1314,14 @@ mail_send (EMailSession *session)
{
CamelFolder *local_outbox;
CamelService *service;
- EAccount *account;
struct _send_info *info;
struct _send_data *data;
send_info_t type = SEND_INVALID;
- gchar *transport_uid;
g_return_if_fail (E_IS_MAIL_SESSION (session));
- account = e_get_default_transport ();
- if (account == NULL || account->transport->url == NULL)
- return;
+ service = get_default_transport (session);
+ g_return_if_fail (CAMEL_IS_TRANSPORT (service));
data = setup_send_data (session);
info = g_hash_table_lookup (data->active, SEND_URI_KEY);
@@ -1500,24 +1331,12 @@ mail_send (EMailSession *session)
return;
}
- transport_uid = g_strconcat (account->uid, "-transport", NULL);
-
- service = camel_session_get_service (
- CAMEL_SESSION (session), transport_uid);
-
- if (!CAMEL_IS_TRANSPORT (service)) {
- g_free (transport_uid);
- return;
- }
-
d(printf("starting non-interactive send of '%s'\n", transport->url));
type = get_receive_type (service);
- if (type == SEND_INVALID) {
- g_free (transport_uid);
+ if (type == SEND_INVALID)
return;
- }
info = g_malloc0 (sizeof (*info));
info->type = SEND_SEND;
@@ -1541,10 +1360,6 @@ mail_send (EMailSession *session)
e_mail_session_get_local_folder (
session, E_MAIL_LOCAL_FOLDER_OUTBOX);
- g_free (transport_uid);
-
- g_return_if_fail (CAMEL_IS_TRANSPORT (service));
-
mail_send_queue (
session, local_outbox,
CAMEL_TRANSPORT (service),
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index 118acc1..9fa1b92 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -300,24 +300,6 @@ all proxy information will be deleted permanently.</_secondary>
<button _label="_Disable" response="GTK_RESPONSE_YES"/>
</error>
- <error id="no-save-signature" type="error">
- <_primary>Could not save signature file.</_primary>
- <secondary xml:space="preserve">{0}.</secondary>
- </error>
-
- <error id="signature-notscript" type="error">
- <_primary>Cannot set signature script "{0}".</_primary>
- <_secondary xml:space="preserve">The script file must exist and be executable.</_secondary>
- </error>
-
- <error id="ask-signature-changed" type="question" default="GTK_RESPONSE_YES">
- <_primary>Do you wish to save your changes?</_primary>
- <_secondary xml:space="preserve">This signature has been changed, but has not been saved.</_secondary>
- <button _label="_Discard changes" response="GTK_RESPONSE_NO"/>
- <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
- <button stock="gtk-save" response="GTK_RESPONSE_YES"/>
- </error>
-
<error id="vfolder-notexist" type="error">
<_primary>Cannot edit Search Folder "{0}" as it does not exist.</_primary>
<_secondary xml:space="preserve">This folder may have been added implicitly,
@@ -426,16 +408,6 @@ An mbox account will be created to preserve the old mbox folders. You can delete
<button _label="N_ever" response="GTK_RESPONSE_CANCEL"/>
</error>
- <error id="signature-already-exists" type="error" modal="true">
- <_primary>Signature Already Exists</_primary>
- <_secondary>A signature already exists with the name "{0}". Please specify a different name. </_secondary>
- </error>
-
- <error id="blank-signature" type="error" modal="true">
- <_primary>Blank Signature</_primary>
- <_secondary>Please provide an unique name to identify this signature.</_secondary>
- </error>
-
<error id="send-no-account-enabled" type="warning">
<_primary>This message cannot be sent because the account you chose to send with is not enabled</_primary>
<_secondary xml:space="preserve">Please enable the account or send using another account.</_secondary>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]