aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@gnome-db.org>2011-10-05 19:57:30 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-10-05 19:57:30 +0800
commit4ec46cc05fcb94d181fb9c2412984a1446647c85 (patch)
treed16ce30e77dd539c03509237dd4c723d46aea97a /mail
parent5ea7e23aef0c239af2600c95419ba0bda0f08b3c (diff)
parent19163c2b71e6128fc9b32287b99b1f4422324c2d (diff)
downloadgsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.gz
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.bz2
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.lz
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.xz
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.zst
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.zip
Merge from master
Diffstat (limited to 'mail')
-rw-r--r--mail/Makefile.am12
-rw-r--r--mail/e-mail-backend.c21
-rw-r--r--mail/e-mail-folder-utils.c48
-rw-r--r--mail/e-mail-folder-utils.h3
-rw-r--r--mail/e-mail-junk-filter.h2
-rw-r--r--mail/e-mail-migrate.c12
-rw-r--r--mail/e-mail-reader-utils.c5
-rw-r--r--mail/e-mail-reader.c87
-rw-r--r--mail/e-mail-session-utils.c8
-rw-r--r--mail/e-mail-session.c130
-rw-r--r--mail/e-mail-sidebar.c2
-rw-r--r--mail/e-mail-store.c80
-rw-r--r--mail/e-mail-store.h14
-rw-r--r--mail/em-account-editor.c6
-rw-r--r--mail/em-composer-utils.c62
-rw-r--r--mail/em-composer-utils.h9
-rw-r--r--mail/em-folder-selection-button.c10
-rw-r--r--mail/em-folder-tree-model.c216
-rw-r--r--mail/em-folder-tree-model.h5
-rw-r--r--mail/em-folder-tree.c6
-rw-r--r--mail/em-folder-utils.c8
-rw-r--r--mail/em-format-html.c52
-rw-r--r--mail/em-subscription-editor.c61
-rw-r--r--mail/em-subscription-editor.h7
-rw-r--r--mail/em-utils.c90
-rw-r--r--mail/em-utils.h3
-rw-r--r--mail/em-vfolder-rule.c66
-rw-r--r--mail/importers/Makefile.am10
-rw-r--r--mail/mail-config.ui68
-rw-r--r--mail/mail-dialogs.ui2
-rw-r--r--mail/mail-folder-cache.c4
-rw-r--r--mail/mail-ops.c38
-rw-r--r--mail/mail-ops.h2
-rw-r--r--mail/mail-send-recv.c96
-rw-r--r--mail/mail-send-recv.h8
-rw-r--r--mail/mail-vfolder.c2
-rw-r--r--mail/mail.error.xml5
-rw-r--r--mail/message-list.c4
38 files changed, 761 insertions, 503 deletions
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 97a2fe39a4..1ddbec649c 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -25,16 +25,17 @@ libevolution_mail_la_CPPFLAGS = \
-I$(top_srcdir)/shell \
-I$(top_srcdir)/smime/lib \
-I$(top_srcdir)/smime/gui \
+ $(EVOLUTION_DATA_SERVER_CFLAGS) \
$(GNOME_PLATFORM_CFLAGS) \
- $(EVOLUTION_MAIL_CFLAGS) \
$(CERT_UI_CFLAGS) \
$(CANBERRA_CFLAGS) \
$(CLUTTER_CFLAGS) \
+ $(GTKHTML_CFLAGS) \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_ICONDIR=\""$(icondir)"\" \
- -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
+ -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
-DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
-DEVOLUTION_BUTTONSDIR=\""$(buttonsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
@@ -209,14 +210,13 @@ libevolution_mail_la_LIBADD = \
$(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \
$(top_builddir)/em-format/libemformat.la \
$(top_builddir)/filter/libfilter.la \
- $(EVOLUTION_MAIL_LIBS) \
+ $(EVOLUTION_DATA_SERVER_LIBS) \
+ $(GNOME_PLATFORM_LIBS) \
$(CERT_UI_LIBS) \
$(CANBERRA_LIBS) \
$(CLUTTER_LIBS) \
$(GTKHTML_LIBS) \
- $(E_WIDGETS_LIBS) \
- $(SMIME_LIBS) \
- $(GNOME_PLATFORM_LIBS)
+ $(SMIME_LIBS)
libevolution_mail_la_LDFLAGS = $(NO_UNDEFINED)
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index ff37b7a93a..56f2dc67b3 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -171,7 +171,7 @@ mail_backend_prepare_for_offline_cb (EShell *shell,
}
e_mail_store_foreach (
- session, (GFunc) mail_store_prepare_for_offline_cb, activity);
+ backend, (GFunc) mail_store_prepare_for_offline_cb, activity);
}
/* Helper for mail_backend_prepare_for_online_cb() */
@@ -197,7 +197,7 @@ mail_backend_prepare_for_online_cb (EShell *shell,
camel_session_set_online (CAMEL_SESSION (session), TRUE);
e_mail_store_foreach (
- session, (GFunc) mail_store_prepare_for_online_cb, activity);
+ backend, (GFunc) mail_store_prepare_for_online_cb, activity);
}
/* Helper for mail_backend_prepare_for_quit_cb() */
@@ -298,13 +298,13 @@ mail_backend_prepare_for_quit_cb (EShell *shell,
if (delete_junk)
e_mail_store_foreach (
- session, (GFunc) mail_backend_delete_junk, backend);
+ backend, (GFunc) mail_backend_delete_junk, backend);
sync_data.activity = activity;
sync_data.empty_trash = empty_trash;
e_mail_store_foreach (
- session, (GFunc) mail_backend_final_sync, &sync_data);
+ backend, (GFunc) mail_backend_final_sync, &sync_data);
/* Now we poll until all activities are actually cancelled or finished.
* Reffing the activity delays quitting; the reference count
@@ -572,14 +572,15 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache,
folder_type = (flags & CAMEL_FOLDER_TYPE_MASK);
target->is_inbox = (folder_type == CAMEL_FOLDER_TYPE_INBOX);
- model = em_folder_tree_model_get_default (mail_backend);
+ model = em_folder_tree_model_get_default ();
target->display_name = em_folder_tree_model_get_folder_name (
model, store, folder_name);
if (target->new > 0)
e_shell_event (e_shell_backend_get_shell (E_SHELL_BACKEND (mail_backend)), "mail-icon", (gpointer) "mail-unread");
- /** @Event: folder.changed
+ /**
+ * @Event: folder.changed
* @Title: Folder changed
* @Target: EMEventTargetFolder
*
@@ -773,8 +774,12 @@ mail_backend_constructed (GObject *object)
e_account_combo_box_set_session (CAMEL_SESSION (priv->session));
/* FIXME EMailBackend should own the default EMFolderTreeModel. */
- folder_tree_model = em_folder_tree_model_get_default (E_MAIL_BACKEND (shell_backend));
- em_folder_tree_model_set_session (folder_tree_model, priv->session);
+ folder_tree_model = em_folder_tree_model_get_default ();
+
+ /* FIXME This is creating a circular reference. Perhaps the
+ * should only hold a weak pointer to EMailBackend? */
+ em_folder_tree_model_set_backend (
+ folder_tree_model, E_MAIL_BACKEND (object));
g_signal_connect (
shell, "prepare-for-offline",
diff --git a/mail/e-mail-folder-utils.c b/mail/e-mail-folder-utils.c
index 7c84957f6a..77a9708e5f 100644
--- a/mail/e-mail-folder-utils.c
+++ b/mail/e-mail-folder-utils.c
@@ -1630,3 +1630,51 @@ e_mail_folder_uri_from_folder (CamelFolder *folder)
return e_mail_folder_uri_build (store, folder_name);
}
+
+/**
+ * e_mail_folder_uri_to_markup:
+ * @session: a #CamelSession
+ * @folder_uri: a folder URI
+ * @error: return location for a #GError, or %NULL
+ *
+ * Converts @folder_uri to a markup string suitable for displaying to users.
+ * The string consists of the #CamelStore display name (in bold), followed
+ * by the folder path. If the URI is malformed or no corresponding store
+ * exists, the function sets @error and returns %NULL. Free the returned
+ * string with g_free().
+ *
+ * Returns: a newly-allocated markup string, or %NULL
+ **/
+gchar *
+e_mail_folder_uri_to_markup (CamelSession *session,
+ const gchar *folder_uri,
+ GError **error)
+{
+ CamelStore *store = NULL;
+ const gchar *display_name;
+ gchar *folder_name = NULL;
+ gchar *markup;
+ gboolean success;
+
+ g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
+ g_return_val_if_fail (folder_uri != NULL, NULL);
+
+ success = e_mail_folder_uri_parse (
+ session, folder_uri, &store, &folder_name, error);
+
+ if (!success)
+ return NULL;
+
+ g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
+ g_return_val_if_fail (folder_name != NULL, NULL);
+
+ display_name = camel_service_get_display_name (CAMEL_SERVICE (store));
+
+ markup = g_markup_printf_escaped (
+ "<b>%s</b> : %s", display_name, folder_name);
+
+ g_object_unref (store);
+ g_free (folder_name);
+
+ return markup;
+}
diff --git a/mail/e-mail-folder-utils.h b/mail/e-mail-folder-utils.h
index c82d806d7a..9e8dd0f050 100644
--- a/mail/e-mail-folder-utils.h
+++ b/mail/e-mail-folder-utils.h
@@ -155,6 +155,9 @@ gboolean e_mail_folder_uri_equal (CamelSession *session,
const gchar *folder_uri_a,
const gchar *folder_uri_b);
gchar * e_mail_folder_uri_from_folder (CamelFolder *folder);
+gchar * e_mail_folder_uri_to_markup (CamelSession *session,
+ const gchar *folder_uri,
+ GError **error);
G_END_DECLS
diff --git a/mail/e-mail-junk-filter.h b/mail/e-mail-junk-filter.h
index 34d95e56c7..74a7840c2d 100644
--- a/mail/e-mail-junk-filter.h
+++ b/mail/e-mail-junk-filter.h
@@ -20,7 +20,7 @@
#define E_MAIL_JUNK_FILTER_H
#include <gtk/gtk.h>
-#include <e-util/e-extension.h>
+#include <libebackend/e-extension.h>
/* Standard GObject macros */
#define E_TYPE_MAIL_JUNK_FILTER \
diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c
index 07b2a8bb2c..10afa58e04 100644
--- a/mail/e-mail-migrate.c
+++ b/mail/e-mail-migrate.c
@@ -701,7 +701,6 @@ migrate_to_db (EShellBackend *shell_backend)
EMMigrateSession *session;
EAccountList *accounts;
EMailBackend *mail_backend;
- EMailSession *mail_session;
EIterator *iter;
gint i = 0, len;
CamelStore *store = NULL;
@@ -713,11 +712,10 @@ migrate_to_db (EShellBackend *shell_backend)
return;
mail_backend = E_MAIL_BACKEND (shell_backend);
- mail_session = e_mail_backend_get_session (mail_backend);
data_dir = e_shell_backend_get_data_dir (shell_backend);
/* Initialize the mail stores early so we can add a new one. */
- e_mail_store_init (mail_session, data_dir);
+ e_mail_store_init (mail_backend, data_dir);
iter = e_list_get_iterator ((EList *) accounts);
len = e_list_length ((EList *) accounts);
@@ -772,7 +770,7 @@ migrate_to_db (EShellBackend *shell_backend)
&& strncmp (service->url, "mbox:", 5) != 0) {
store = e_mail_store_add_by_account (
- mail_session, account);
+ mail_backend, account);
info = camel_store_get_folder_info_sync (
store, NULL,
@@ -1020,7 +1018,6 @@ create_mbox_account (EShellBackend *shell_backend,
EMMigrateSession *session)
{
EMailBackend *mail_backend;
- EMailSession *mail_session;
CamelStore *store;
CamelURL *url;
EAccountList *accounts;
@@ -1029,11 +1026,10 @@ create_mbox_account (EShellBackend *shell_backend,
gchar *name, *id, *temp, *uri, *folder_uri;
mail_backend = E_MAIL_BACKEND (shell_backend);
- mail_session = e_mail_backend_get_session (mail_backend);
data_dir = e_shell_backend_get_data_dir (shell_backend);
/* Initialize the mail stores early so we can add a new one. */
- e_mail_store_init (mail_session, data_dir);
+ e_mail_store_init (mail_backend, data_dir);
account = e_account_new ();
account->enabled = TRUE;
@@ -1067,7 +1063,7 @@ create_mbox_account (EShellBackend *shell_backend,
}
e_account_list_add (accounts, account);
- store = e_mail_store_add_by_account (mail_session, account);
+ store = e_mail_store_add_by_account (mail_backend, account);
folder_uri = e_mail_folder_uri_build (store, "Sent");
e_account_set_string (
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 4cc9465c7d..725a0c6d7c 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -287,7 +287,6 @@ e_mail_reader_mark_as_read (EMailReader *reader,
const gchar *uid)
{
EMailBackend *backend;
- EMailSession *session;
EMFormatHTML *formatter;
CamelFolder *folder;
guint32 mask, set;
@@ -300,15 +299,13 @@ e_mail_reader_mark_as_read (EMailReader *reader,
backend = e_mail_reader_get_backend (reader);
formatter = e_mail_reader_get_formatter (reader);
- session = e_mail_backend_get_session (backend);
-
flags = camel_folder_get_message_flags (folder, uid);
if (!(flags & CAMEL_MESSAGE_SEEN)) {
CamelMimeMessage *message;
message = EM_FORMAT (formatter)->message;
- em_utils_handle_receipt (session, folder, uid, message);
+ em_utils_handle_receipt (backend, folder, uid, message);
}
mask = CAMEL_MESSAGE_SEEN;
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index a8e3899ace..76502314ab 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -300,7 +300,7 @@ action_mail_copy_cb (GtkAction *action,
window = e_mail_reader_get_window (reader);
uids = e_mail_reader_get_selected_uids (reader);
- model = em_folder_tree_model_get_default (backend);
+ model = em_folder_tree_model_get_default ();
dialog = em_folder_selector_new (
window, backend, model,
@@ -479,8 +479,8 @@ action_mail_flag_for_followup_cb (GtkAction *action,
em_utils_flag_for_followup (reader, folder, uids);
}
-static void
-check_close_browser_reader (EMailReader *reader)
+static gboolean
+get_close_browser_reader (EMailReader *reader)
{
GConfClient *client;
const gchar *key;
@@ -489,7 +489,7 @@ check_close_browser_reader (EMailReader *reader)
/* only allow closing of a mail browser and nothing else */
if (!E_IS_MAIL_BROWSER (reader))
- return;
+ return FALSE;
client = gconf_client_get_default ();
@@ -529,11 +529,16 @@ check_close_browser_reader (EMailReader *reader)
}
g_free (value);
+ g_object_unref (client);
- if (close_it)
- gtk_widget_destroy (GTK_WIDGET (reader));
+ return close_it;
+}
- g_object_unref (client);
+static void
+check_close_browser_reader (EMailReader *reader)
+{
+ if (get_close_browser_reader (reader))
+ gtk_widget_destroy (GTK_WIDGET (reader));
}
static void
@@ -543,11 +548,13 @@ action_mail_forward_cb (GtkAction *action,
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
+ gboolean close_reader;
folder = e_mail_reader_get_folder (reader);
window = e_mail_reader_get_window (reader);
uids = e_mail_reader_get_selected_uids (reader);
g_return_if_fail (uids != NULL);
+ close_reader = get_close_browser_reader (reader);
/* XXX Either e_mail_reader_get_selected_uids()
* or MessageList should do this itself. */
@@ -556,11 +563,10 @@ action_mail_forward_cb (GtkAction *action,
if (em_utils_ask_open_many (window, uids->len))
em_utils_forward_messages (
reader, folder, uids,
- e_mail_reader_get_forward_style (reader));
+ e_mail_reader_get_forward_style (reader),
+ close_reader ? GTK_WIDGET (reader) : NULL);
g_ptr_array_unref (uids);
-
- check_close_browser_reader (reader);
}
static void
@@ -570,11 +576,13 @@ action_mail_forward_attached_cb (GtkAction *action,
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
+ gboolean close_reader;
folder = e_mail_reader_get_folder (reader);
window = e_mail_reader_get_window (reader);
uids = e_mail_reader_get_selected_uids (reader);
g_return_if_fail (uids != NULL);
+ close_reader = get_close_browser_reader (reader);
/* XXX Either e_mail_reader_get_selected_uids()
* or MessageList should do this itself. */
@@ -583,11 +591,10 @@ action_mail_forward_attached_cb (GtkAction *action,
if (em_utils_ask_open_many (window, uids->len))
em_utils_forward_messages (
reader, folder, uids,
- E_MAIL_FORWARD_STYLE_ATTACHED);
+ E_MAIL_FORWARD_STYLE_ATTACHED,
+ close_reader ? GTK_WIDGET (reader) : NULL);
g_ptr_array_unref (uids);
-
- check_close_browser_reader (reader);
}
static void
@@ -597,11 +604,13 @@ action_mail_forward_inline_cb (GtkAction *action,
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
+ gboolean close_reader;
folder = e_mail_reader_get_folder (reader);
window = e_mail_reader_get_window (reader);
uids = e_mail_reader_get_selected_uids (reader);
g_return_if_fail (uids != NULL);
+ close_reader = get_close_browser_reader (reader);
/* XXX Either e_mail_reader_get_selected_uids()
* or MessageList should do this itself. */
@@ -610,11 +619,10 @@ action_mail_forward_inline_cb (GtkAction *action,
if (em_utils_ask_open_many (window, uids->len))
em_utils_forward_messages (
reader, folder, uids,
- E_MAIL_FORWARD_STYLE_INLINE);
+ E_MAIL_FORWARD_STYLE_INLINE,
+ close_reader ? GTK_WIDGET (reader) : NULL);
g_ptr_array_unref (uids);
-
- check_close_browser_reader (reader);
}
static void
@@ -624,11 +632,16 @@ action_mail_forward_quoted_cb (GtkAction *action,
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
+<<<<<<< HEAD
+=======
+ gboolean close_reader;
+>>>>>>> master
folder = e_mail_reader_get_folder (reader);
window = e_mail_reader_get_window (reader);
uids = e_mail_reader_get_selected_uids (reader);
g_return_if_fail (uids != NULL);
+ close_reader = get_close_browser_reader (reader);
/* XXX Either e_mail_reader_get_selected_uids()
* or MessageList should do this itself. */
@@ -637,11 +650,16 @@ action_mail_forward_quoted_cb (GtkAction *action,
if (em_utils_ask_open_many (window, uids->len))
em_utils_forward_messages (
reader, folder, uids,
+<<<<<<< HEAD
E_MAIL_FORWARD_STYLE_QUOTED);
g_ptr_array_unref (uids);
+=======
+ E_MAIL_FORWARD_STYLE_QUOTED,
+ close_reader ? GTK_WIDGET (reader) : NULL);
+>>>>>>> master
- check_close_browser_reader (reader);
+ g_ptr_array_unref (uids);
}
static void
@@ -732,7 +750,11 @@ action_mail_mark_unread_cb (GtkAction *action,
/* Notify the tree model that the user has marked messages as
* unread so it doesn't mistake the event as new mail arriving. */
+<<<<<<< HEAD
model = em_folder_tree_model_get_default (e_mail_reader_get_backend (reader));
+=======
+ model = em_folder_tree_model_get_default ();
+>>>>>>> master
folder = e_mail_reader_get_folder (reader);
em_folder_tree_model_user_marked_unread (model, folder, n_marked);
}
@@ -752,10 +774,17 @@ action_mail_message_edit_cb (GtkAction *action,
/* XXX Either e_mail_reader_get_selected_uids()
* or MessageList should do this itself. */
g_ptr_array_set_free_func (uids, (GDestroyNotify) g_free);
+<<<<<<< HEAD
+
+ replace = em_utils_folder_is_drafts (folder);
+ em_utils_edit_messages (reader, folder, uids, replace);
+
+=======
replace = em_utils_folder_is_drafts (folder);
em_utils_edit_messages (reader, folder, uids, replace);
+>>>>>>> master
g_ptr_array_unref (uids);
}
@@ -806,7 +835,11 @@ action_mail_move_cb (GtkAction *action,
uids = e_mail_reader_get_selected_uids (reader);
window = e_mail_reader_get_window (reader);
+<<<<<<< HEAD
model = em_folder_tree_model_get_default (backend);
+=======
+ model = em_folder_tree_model_get_default ();
+>>>>>>> master
dialog = em_folder_selector_new (
window, backend, model,
@@ -1126,11 +1159,19 @@ action_mail_reply_all_check (CamelFolder *folder,
gint recip_count = 0;
EMailReplyType type = E_MAIL_REPLY_TO_ALL;
GError *error = NULL;
+<<<<<<< HEAD
+
+ alert_sink = e_activity_get_alert_sink (closure->activity);
+
+ message = camel_folder_get_message_finish (folder, result, &error);
+
+=======
alert_sink = e_activity_get_alert_sink (closure->activity);
message = camel_folder_get_message_finish (folder, result, &error);
+>>>>>>> master
if (e_activity_handle_cancellation (closure->activity, error)) {
g_warn_if_fail (message == NULL);
mail_reader_closure_free (closure);
@@ -1311,6 +1352,17 @@ action_mail_reply_sender_check (CamelFolder *folder,
GError *error = NULL;
alert_sink = e_activity_get_alert_sink (closure->activity);
+<<<<<<< HEAD
+
+ message = camel_folder_get_message_finish (folder, result, &error);
+
+ if (e_activity_handle_cancellation (closure->activity, error)) {
+ g_warn_if_fail (message == NULL);
+ mail_reader_closure_free (closure);
+ g_error_free (error);
+ return;
+
+=======
message = camel_folder_get_message_finish (folder, result, &error);
@@ -1320,6 +1372,7 @@ action_mail_reply_sender_check (CamelFolder *folder,
g_error_free (error);
return;
+>>>>>>> master
} else if (error != NULL) {
g_warn_if_fail (message == NULL);
e_alert_submit (
diff --git a/mail/e-mail-session-utils.c b/mail/e-mail-session-utils.c
index 55221249c4..217e7e2e8e 100644
--- a/mail/e-mail-session-utils.c
+++ b/mail/e-mail-session-utils.c
@@ -695,14 +695,14 @@ e_mail_session_send_to (EMailSession *session,
sent_folder_uri = g_strdup (account->sent_folder_uri);
}
- string = camel_header_raw_find (&xev, "X-Evolution-Transport", NULL);
- if (transport_uid == NULL && string != NULL)
- transport_uid = g_strstrip (g_strdup (string));
-
string = camel_header_raw_find (&xev, "X-Evolution-Fcc", NULL);
if (sent_folder_uri == NULL && string != NULL)
sent_folder_uri = g_strstrip (g_strdup (string));
+ string = camel_header_raw_find (&xev, "X-Evolution-Transport", NULL);
+ if (transport_uid == NULL && string != NULL)
+ transport_uid = g_strstrip (g_strdup (string));
+
post_to_uris = g_ptr_array_new ();
for (header = xev; header != NULL; header = header->next) {
gchar *folder_uri;
diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c
index 7ed8720e75..109e49826d 100644
--- a/mail/e-mail-session.c
+++ b/mail/e-mail-session.c
@@ -44,8 +44,10 @@
#include <canberra-gtk.h>
#endif
-#include <libedataserverui/e-passwords.h>
#include <libedataserver/e-flag.h>
+#include <libedataserver/e-proxy.h>
+#include <libebackend/e-extensible.h>
+#include <libedataserverui/e-passwords.h>
#include "e-util/e-util.h"
#include "e-util/e-account-utils.h"
@@ -73,7 +75,6 @@
((obj), E_TYPE_MAIL_SESSION, EMailSessionPrivate))
static guint session_check_junk_notify_id;
-static guint session_gconf_proxy_id;
typedef struct _AsyncContext AsyncContext;
@@ -82,6 +83,7 @@ struct _EMailSessionPrivate {
FILE *filter_logfile;
GHashTable *junk_filters;
+ EProxy *proxy;
};
struct _AsyncContext {
@@ -398,10 +400,17 @@ static guint preparing_flush = 0;
static gboolean
forward_to_flush_outbox_cb (EMailSession *session)
{
+ EShell *shell;
+ EShellBackend *shell_backend;
+
g_return_val_if_fail (preparing_flush != 0, FALSE);
+ shell = e_shell_get_default ();
+ shell_backend = e_shell_get_backend_by_name (shell, "mail");
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (shell_backend), FALSE);
+
preparing_flush = 0;
- mail_send (session);
+ mail_send (E_MAIL_BACKEND (shell_backend));
return FALSE;
}
@@ -433,73 +442,6 @@ ms_forward_to_cb (CamelFolder *folder,
g_object_unref (client);
}
-/* Support for SOCKS proxy ***************************************************/
-
-static GSettings *proxy_settings = NULL, *proxy_socks_settings = NULL;
-
-static void
-set_socks_proxy_from_gsettings (CamelSession *session)
-{
- gchar *mode, *host;
- gint port;
-
- g_return_if_fail (proxy_settings != NULL);
- g_return_if_fail (proxy_socks_settings != NULL);
-
- mode = g_settings_get_string (proxy_settings, "mode");
- if (g_strcmp0 (mode, "manual") == 0) {
- host = g_settings_get_string (proxy_socks_settings, "host");
- port = g_settings_get_int (proxy_socks_settings, "port");
- camel_session_set_socks_proxy (session, host, port);
- g_free (host);
- }
- g_free (mode);
-}
-
-static void
-proxy_gsettings_changed_cb (GSettings *settings,
- const gchar *key,
- CamelSession *session)
-{
- set_socks_proxy_from_gsettings (session);
-}
-
-static void
-set_socks_proxy_gsettings_watch (CamelSession *session)
-{
- g_return_if_fail (proxy_settings != NULL);
- g_return_if_fail (proxy_socks_settings != NULL);
-
- g_signal_connect (
- proxy_settings, "changed::mode",
- G_CALLBACK (proxy_gsettings_changed_cb), session);
-
- g_signal_connect (
- proxy_socks_settings, "changed",
- G_CALLBACK (proxy_gsettings_changed_cb), session);
-}
-
-static void
-init_socks_proxy (CamelSession *session)
-{
- g_return_if_fail (CAMEL_IS_SESSION (session));
-
- if (!proxy_settings) {
- proxy_settings = g_settings_new ("org.gnome.system.proxy");
- proxy_socks_settings = g_settings_get_child (proxy_settings, "socks");
- g_object_weak_ref (G_OBJECT (proxy_settings), (GWeakNotify) g_nullify_pointer, &proxy_settings);
- g_object_weak_ref (G_OBJECT (proxy_socks_settings), (GWeakNotify) g_nullify_pointer, &proxy_socks_settings);
- } else {
- g_object_ref (proxy_settings);
- g_object_ref (proxy_socks_settings);
- }
-
- set_socks_proxy_gsettings_watch (session);
- set_socks_proxy_from_gsettings (session);
-}
-
-/*****************************************************************************/
-
static void
async_context_free (AsyncContext *context)
{
@@ -521,7 +463,7 @@ mail_session_make_key (CamelService *service,
if (service != NULL)
key = camel_url_to_string (
camel_service_get_camel_url (service),
- CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS);
+ CAMEL_URL_HIDE_PARAMS);
else
key = g_strdup (item);
@@ -677,6 +619,7 @@ mail_session_finalize (GObject *object)
priv = E_MAIL_SESSION_GET_PRIVATE (object);
g_hash_table_destroy (priv->junk_filters);
+ g_object_unref (priv->proxy);
client = gconf_client_get_default ();
@@ -685,11 +628,6 @@ mail_session_finalize (GObject *object)
session_check_junk_notify_id = 0;
}
- if (session_gconf_proxy_id != 0) {
- gconf_client_notify_remove (client, session_gconf_proxy_id);
- session_gconf_proxy_id = 0;
- }
-
g_object_unref (client);
g_free (mail_data_dir);
@@ -1134,6 +1072,42 @@ mail_session_forward_to (CamelSession *session,
}
static void
+mail_session_get_socks_proxy (CamelSession *session,
+ const gchar *for_host,
+ gchar **host_ret,
+ gint *port_ret)
+{
+ EMailSession *mail_session;
+ gchar *uri;
+
+ g_return_if_fail (session != NULL);
+ g_return_if_fail (for_host != NULL);
+ g_return_if_fail (host_ret != NULL);
+ g_return_if_fail (port_ret != NULL);
+
+ mail_session = E_MAIL_SESSION (session);
+ g_return_if_fail (mail_session != NULL);
+ g_return_if_fail (mail_session->priv != NULL);
+
+ *host_ret = NULL;
+ *port_ret = 0;
+
+ uri = g_strconcat ("socks://", for_host, NULL);
+
+ if (e_proxy_require_proxy_for_uri (mail_session->priv->proxy, uri)) {
+ SoupURI *suri;
+
+ suri = e_proxy_peek_uri_for (mail_session->priv->proxy, uri);
+ if (suri) {
+ *host_ret = g_strdup (suri->host);
+ *port_ret = suri->port;
+ }
+ }
+
+ g_free (uri);
+}
+
+static void
e_mail_session_class_init (EMailSessionClass *class)
{
GObjectClass *object_class;
@@ -1157,6 +1131,7 @@ e_mail_session_class_init (EMailSessionClass *class)
session_class->get_filter_driver = mail_session_get_filter_driver;
session_class->lookup_addressbook = mail_session_lookup_addressbook;
session_class->forward_to = mail_session_forward_to;
+ session_class->get_socks_proxy = mail_session_get_socks_proxy;
g_object_class_install_property (
object_class,
@@ -1193,6 +1168,7 @@ e_mail_session_init (EMailSession *session)
session->priv->folder_cache = mail_folder_cache_new ();
session->priv->junk_filters = g_hash_table_new (
(GHashFunc) g_str_hash, (GEqualFunc) g_str_equal);
+ session->priv->proxy = e_proxy_new ();
/* Initialize the EAccount setup. */
e_account_writable (NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD);
@@ -1212,7 +1188,7 @@ e_mail_session_init (EMailSession *session)
mail_config_reload_junk_headers (session);
- init_socks_proxy (CAMEL_SESSION (session));
+ e_proxy_setup_proxy (session->priv->proxy);
g_object_unref (client);
}
diff --git a/mail/e-mail-sidebar.c b/mail/e-mail-sidebar.c
index 6a971ea51f..35048f8293 100644
--- a/mail/e-mail-sidebar.c
+++ b/mail/e-mail-sidebar.c
@@ -471,7 +471,7 @@ e_mail_sidebar_new (EMailBackend *backend,
g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
g_return_val_if_fail (E_IS_ALERT_SINK (alert_sink), NULL);
- model = em_folder_tree_model_get_default (backend);
+ model = em_folder_tree_model_get_default ();
return g_object_new (
E_TYPE_MAIL_SIDEBAR,
diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c
index 7b7774399d..f93856a8f4 100644
--- a/mail/e-mail-store.c
+++ b/mail/e-mail-store.c
@@ -182,10 +182,11 @@ special_mail_store_is_enabled (CamelStore *store)
}
static void
-mail_store_add (EMailSession *session,
+mail_store_add (EMailBackend *backend,
CamelStore *store,
AddStoreCallback callback)
{
+ EMailSession *session;
EMFolderTreeModel *default_model;
MailFolderCache *folder_cache;
StoreInfo *store_info;
@@ -194,7 +195,8 @@ mail_store_add (EMailSession *session,
g_return_if_fail (store != NULL);
g_return_if_fail (CAMEL_IS_STORE (store));
- default_model = em_folder_tree_model_get_default (NULL);
+ session = e_mail_backend_get_session (backend);
+ default_model = em_folder_tree_model_get_default ();
folder_cache = e_mail_session_get_folder_cache (session);
store_info = store_info_new (store);
@@ -228,23 +230,26 @@ mail_store_add_local_done_cb (MailFolderCache *folder_cache,
}
static void
-mail_store_load_accounts (EMailSession *session,
+mail_store_load_accounts (EMailBackend *backend,
const gchar *data_dir)
{
CamelStore *local_store;
+ EMailSession *session;
EAccountList *account_list;
EIterator *iter;
- /* Set up the local store. */
+ session = e_mail_backend_get_session (backend);
+
+ /* Add the local store. */
e_mail_local_init (session, data_dir);
local_store = e_mail_local_get_store ();
mail_store_add (
- session, local_store, (AddStoreCallback)
+ backend, local_store, (AddStoreCallback)
mail_store_add_local_done_cb);
- /* Set up remote stores. */
+ /* Add mail accounts.. */
account_list = e_get_account_list ();
@@ -257,19 +262,19 @@ mail_store_load_accounts (EMailSession *session,
if (!account->enabled)
continue;
- e_mail_store_add_by_account (session, account);
+ e_mail_store_add_by_account (backend, account);
}
g_object_unref (iter);
}
void
-e_mail_store_init (EMailSession *session,
+e_mail_store_init (EMailBackend *backend,
const gchar *data_dir)
{
static gboolean initialized = FALSE;
- g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
/* This function is idempotent because mail
* migration code may need to call it early. */
@@ -283,34 +288,37 @@ e_mail_store_init (EMailSession *session,
(GDestroyNotify) NULL,
(GDestroyNotify) store_table_free);
- mail_store_load_accounts (session, data_dir);
+ mail_store_load_accounts (backend, data_dir);
initialized = TRUE;
}
void
-e_mail_store_add (EMailSession *session,
+e_mail_store_add (EMailBackend *backend,
CamelStore *store)
{
- g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
g_return_if_fail (CAMEL_IS_STORE (store));
- mail_store_add (session, store, NULL);
+ mail_store_add (backend, store, NULL);
}
CamelStore *
-e_mail_store_add_by_account (EMailSession *session,
+e_mail_store_add_by_account (EMailBackend *backend,
EAccount *account)
{
+ EMailSession *session;
CamelService *service = NULL;
CamelProvider *provider;
CamelURL *url;
- gboolean skip, transport_only;
+ gboolean skip = FALSE, transport_only;
GError *error = NULL;
- g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
g_return_val_if_fail (E_IS_ACCOUNT (account), NULL);
+ session = e_mail_backend_get_session (backend);
+
/* check whether it's transport-only accounts */
transport_only = !account->source || !account->source->url || !*account->source->url;
if (transport_only)
@@ -376,7 +384,7 @@ handle_transport:
}
if (!skip && (provider->flags & CAMEL_PROVIDER_IS_STORAGE))
- e_mail_store_add (session, CAMEL_STORE (service));
+ e_mail_store_add (backend, CAMEL_STORE (service));
return CAMEL_STORE (service);
@@ -392,16 +400,19 @@ fail:
}
void
-e_mail_store_remove (EMailSession *session,
+e_mail_store_remove (EMailBackend *backend,
CamelStore *store)
{
+ EMailSession *session;
MailFolderCache *folder_cache;
EMFolderTreeModel *default_model;
- g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
g_return_if_fail (CAMEL_IS_STORE (store));
g_return_if_fail (store_table != NULL);
+ session = e_mail_backend_get_session (backend);
+
/* Because the store table holds a reference to each store used
* as a key in it, none of them will ever be gc'ed, meaning any
* call to camel_session_get_{service,store} with the same URL
@@ -426,43 +437,48 @@ e_mail_store_remove (EMailSession *session,
}
void
-e_mail_store_remove_by_account (EMailSession *session,
+e_mail_store_remove_by_account (EMailBackend *backend,
EAccount *account)
{
+ EMailSession *session;
CamelService *service;
CamelProvider *provider;
+ const gchar *uid;
- g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
g_return_if_fail (E_IS_ACCOUNT (account));
- provider = camel_provider_get (account->source->url, NULL);
- if (provider == NULL)
- return;
+ uid = account->uid;
+ session = e_mail_backend_get_session (backend);
- if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
- return;
+ service = camel_session_get_service (CAMEL_SESSION (session), uid);
+ g_return_if_fail (CAMEL_IS_STORE (service));
- service = camel_session_get_service (
- CAMEL_SESSION (session), account->uid);
+ provider = camel_service_get_provider (service);
+ g_return_if_fail (provider != NULL);
- g_return_if_fail (CAMEL_IS_STORE (service));
+ if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
+ return;
- e_mail_store_remove (session, CAMEL_STORE (service));
+ e_mail_store_remove (backend, CAMEL_STORE (service));
}
void
-e_mail_store_foreach (EMailSession *session,
+e_mail_store_foreach (EMailBackend *backend,
GFunc func,
gpointer user_data)
{
+ EMailSession *session;
GList *list, *link;
/* XXX This is a silly convenience function.
* Could probably just get rid of it. */
- g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
g_return_if_fail (func != NULL);
+ session = e_mail_backend_get_session (backend);
+
list = camel_session_list_services (CAMEL_SESSION (session));
for (link = list; link != NULL; link = g_list_next (link)) {
diff --git a/mail/e-mail-store.h b/mail/e-mail-store.h
index 5dca416e09..2c676d4fc4 100644
--- a/mail/e-mail-store.h
+++ b/mail/e-mail-store.h
@@ -23,22 +23,22 @@
#define E_MAIL_STORE_H
#include <camel/camel.h>
-#include <mail/e-mail-session.h>
+#include <mail/e-mail-backend.h>
#include <libedataserver/e-account.h>
G_BEGIN_DECLS
-void e_mail_store_init (EMailSession *session,
+void e_mail_store_init (EMailBackend *backend,
const gchar *data_dir);
-void e_mail_store_add (EMailSession *session,
+void e_mail_store_add (EMailBackend *backend,
CamelStore *store);
-CamelStore * e_mail_store_add_by_account (EMailSession *session,
+CamelStore * e_mail_store_add_by_account (EMailBackend *backend,
EAccount *account);
-void e_mail_store_remove (EMailSession *session,
+void e_mail_store_remove (EMailBackend *backend,
CamelStore *store);
-void e_mail_store_remove_by_account (EMailSession *session,
+void e_mail_store_remove_by_account (EMailBackend *backend,
EAccount *account);
-void e_mail_store_foreach (EMailSession *session,
+void e_mail_store_foreach (EMailBackend *backend,
GFunc func,
gpointer user_data);
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index b9589d51c3..8ec881b1f0 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -4045,7 +4045,7 @@ forget_password_if_needed (EAccount *original_account,
if (!url)
return;
- url_str = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS);
+ url_str = camel_url_to_string (url, CAMEL_URL_HIDE_PARAMS);
if (url_str)
e_passwords_forget_password (NULL, url_str);
@@ -4108,11 +4108,9 @@ emae_commit (EConfig *ec,
&& emae->priv->source.provider
&& (emae->priv->source.provider->flags & CAMEL_PROVIDER_IS_STORAGE)) {
EMailBackend *backend;
- EMailSession *session;
backend = em_account_editor_get_backend (emae);
- session = e_mail_backend_get_session (backend);
- e_mail_store_add_by_account (session, account);
+ e_mail_store_add_by_account (backend, account);
}
}
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index e42559ab3b..837cc31f62 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -85,6 +85,7 @@ struct _AsyncContext {
gchar *folder_uri;
gchar *message_uid;
gboolean replace;
+ GtkWidget *destroy_when_done;
};
struct _ForwardData {
@@ -112,6 +113,9 @@ async_context_free (AsyncContext *context)
if (context->ptr_array != NULL)
g_ptr_array_unref (context->ptr_array);
+ if (context->destroy_when_done != NULL)
+ gtk_widget_destroy (context->destroy_when_done);
+
g_free (context->folder_uri);
g_free (context->message_uid);
@@ -1680,6 +1684,7 @@ forward_got_messages_cb (CamelFolder *folder,
if (e_activity_handle_cancellation (context->activity, error)) {
g_warn_if_fail (hash_table == NULL);
+ context->destroy_when_done = NULL;
async_context_free (context);
g_error_free (error);
return;
@@ -1690,6 +1695,7 @@ forward_got_messages_cb (CamelFolder *folder,
alert_sink,
"mail:get-multiple-messages",
error->message, NULL);
+ context->destroy_when_done = NULL;
async_context_free (context);
g_error_free (error);
return;
@@ -1721,6 +1727,7 @@ forward_got_messages_cb (CamelFolder *folder,
* @folder: folder containing messages to forward
* @uids: uids of messages to forward
* @style: the forward style to use
+ * @destroy_when_done: a #GtkWidget to destroy with gtk_widget_destroy() when done; can be NULL
*
* Forwards a group of messages in the given style.
*
@@ -1742,7 +1749,8 @@ void
em_utils_forward_messages (EMailReader *reader,
CamelFolder *folder,
GPtrArray *uids,
- EMailForwardStyle style)
+ EMailForwardStyle style,
+ GtkWidget *destroy_when_done)
{
EActivity *activity;
AsyncContext *context;
@@ -1760,6 +1768,7 @@ em_utils_forward_messages (EMailReader *reader,
context->reader = g_object_ref (reader);
context->ptr_array = g_ptr_array_ref (uids);
context->style = style;
+ context->destroy_when_done = destroy_when_done;
switch (style) {
case E_MAIL_FORWARD_STYLE_ATTACHED:
@@ -1837,7 +1846,7 @@ em_utils_redirect_message (EShell *shell,
/* Message disposition notifications, rfc 2298 */
void
-em_utils_handle_receipt (EMailSession *session,
+em_utils_handle_receipt (EMailBackend *backend,
CamelFolder *folder,
const gchar *message_uid,
CamelMimeMessage *message)
@@ -1846,7 +1855,7 @@ em_utils_handle_receipt (EMailSession *session,
const gchar *addr;
CamelMessageInfo *info;
- g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
g_return_if_fail (CAMEL_IS_FOLDER (folder));
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
@@ -1902,23 +1911,23 @@ em_utils_handle_receipt (EMailSession *session,
return;
}
- em_utils_send_receipt (session, folder, message);
+ em_utils_send_receipt (backend, folder, message);
}
static void
em_utils_receipt_done (CamelFolder *folder,
GAsyncResult *result,
- EMailSession *session)
+ EMailBackend *backend)
{
/* FIXME Poor error handling. */
if (!e_mail_folder_append_message_finish (folder, result, NULL, NULL))
return;
- mail_send (session);
+ mail_send (backend);
}
void
-em_utils_send_receipt (EMailSession *session,
+em_utils_send_receipt (EMailBackend *backend,
CamelFolder *folder,
CamelMimeMessage *message)
{
@@ -2093,7 +2102,7 @@ em_utils_send_receipt (EMailSession *session,
/* FIXME Pass a GCancellable. */
e_mail_folder_append_message (
out_folder, receipt, info, G_PRIORITY_DEFAULT, NULL,
- (GAsyncReadyCallback) em_utils_receipt_done, session);
+ (GAsyncReadyCallback) em_utils_receipt_done, backend);
camel_message_info_free (info);
}
@@ -2476,18 +2485,24 @@ concat_unique_addrs (CamelInternetAddress *dest,
}
}
-static void
-get_reply_all (CamelMimeMessage *message,
- CamelInternetAddress *to,
- CamelInternetAddress *cc,
- CamelNNTPAddress *postto)
+void
+em_utils_get_reply_all (CamelMimeMessage *message,
+ CamelInternetAddress *to,
+ CamelInternetAddress *cc,
+ CamelNNTPAddress *postto)
{
- CamelInternetAddress *reply_to, *to_addrs, *cc_addrs;
+ CamelInternetAddress *reply_to;
+ CamelInternetAddress *to_addrs;
+ CamelInternetAddress *cc_addrs;
CamelMedium *medium;
const gchar *name, *addr;
const gchar *posthdr = NULL;
GHashTable *rcpt_hash;
+ 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));
+
medium = CAMEL_MEDIUM (message);
/* check whether there is a 'Newsgroups: ' header in there */
@@ -2503,8 +2518,10 @@ get_reply_all (CamelMimeMessage *message,
rcpt_hash = em_utils_generate_account_hash ();
reply_to = get_reply_to (message);
- to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
- cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
+ to_addrs = camel_mime_message_get_recipients (
+ message, CAMEL_RECIPIENT_TYPE_TO);
+ cc_addrs = camel_mime_message_get_recipients (
+ message, CAMEL_RECIPIENT_TYPE_CC);
if (reply_to != NULL) {
gint ii = 0;
@@ -2547,15 +2564,6 @@ get_reply_all (CamelMimeMessage *message,
g_hash_table_destroy (rcpt_hash);
}
-void
-em_utils_get_reply_all (CamelMimeMessage *message,
- CamelInternetAddress *to,
- CamelInternetAddress *cc,
- CamelNNTPAddress *postto)
-{
- get_reply_all (message, to, cc, postto);
-}
-
enum {
ATTRIB_UNKNOWN,
ATTRIB_CUSTOM,
@@ -2938,7 +2946,7 @@ em_utils_reply_to_message (EShell *shell,
if (folder)
postto = camel_nntp_address_new ();
- get_reply_all (message, to, cc, postto);
+ em_utils_get_reply_all (message, to, cc, postto);
break;
}
@@ -2989,7 +2997,7 @@ post_header_clicked_cb (EComposerPostHeader *header,
shell_backend = e_shell_get_backend_by_name (shell, "mail");
/* FIXME Limit the folder tree to the NNTP account? */
- model = em_folder_tree_model_get_default (E_MAIL_BACKEND (shell_backend));
+ model = em_folder_tree_model_get_default ();
dialog = em_folder_selector_new (
GTK_WINDOW (composer),
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index e651186afc..bd6eb7cffd 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -25,9 +25,9 @@
#define EM_COMPOSER_UTILS_H
#include <em-format/em-format.h>
+#include <mail/e-mail-backend.h>
#include <mail/e-mail-enums.h>
#include <mail/e-mail-reader.h>
-#include <mail/e-mail-session.h>
#include <composer/e-msg-composer.h>
G_BEGIN_DECLS
@@ -54,14 +54,15 @@ EMsgComposer * em_utils_forward_message (EShell *shell,
void em_utils_forward_messages (EMailReader *reader,
CamelFolder *folder,
GPtrArray *uids,
- EMailForwardStyle style);
+ EMailForwardStyle style,
+ GtkWidget *destroy_when_done);
void em_utils_redirect_message (EShell *shell,
CamelMimeMessage *message);
-void em_utils_handle_receipt (EMailSession *session,
+void em_utils_handle_receipt (EMailBackend *backend,
CamelFolder *folder,
const gchar *message_uid,
CamelMimeMessage *message);
-void em_utils_send_receipt (EMailSession *session,
+void em_utils_send_receipt (EMailBackend *backend,
CamelFolder *folder,
CamelMimeMessage *message);
gchar * em_utils_construct_composer_text
diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c
index 26a3c9c2b0..9aa198fa8e 100644
--- a/mail/em-folder-selection-button.c
+++ b/mail/em-folder-selection-button.c
@@ -268,17 +268,13 @@ folder_selection_button_clicked (GtkButton *button)
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
if (priv->store != NULL) {
- EMailSession *session;
-
- session = e_mail_backend_get_session (priv->backend);
-
- model = em_folder_tree_model_new (priv->backend);
- em_folder_tree_model_set_session (model, session);
+ model = em_folder_tree_model_new ();
+ em_folder_tree_model_set_backend (model, priv->backend);
em_folder_tree_model_add_store (model, priv->store);
}
if (model == NULL)
- model = g_object_ref (em_folder_tree_model_get_default (priv->backend));
+ model = g_object_ref (em_folder_tree_model_get_default ());
dialog = em_folder_selector_new (
parent, priv->backend, model,
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 2116faf854..cc674cd792 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -34,11 +34,11 @@
#include <errno.h>
#include <sys/stat.h>
+#include <glib/gi18n.h>
+
#include "e-util/e-util.h"
#include "e-util/e-account-utils.h"
-#include <glib/gi18n.h>
-
#include "mail-tools.h"
#include "mail-mt.h"
#include "mail-ops.h"
@@ -68,7 +68,6 @@ struct _EMFolderTreeModelPrivate {
GtkTreeSelection *selection; /* weak reference */
EAccountList *accounts;
- EMailSession *session;
EMailBackend *backend;
/* CamelStore -> EMFolderTreeStoreInfo */
@@ -85,7 +84,6 @@ struct _EMFolderTreeModelPrivate {
enum {
PROP_0,
PROP_SELECTION,
- PROP_SESSION,
PROP_BACKEND
};
@@ -124,9 +122,10 @@ static gint
folder_tree_model_sort (GtkTreeModel *model,
GtkTreeIter *a,
GtkTreeIter *b,
- gpointer user_data)
+ gpointer unused)
{
- EShell *shell = user_data;
+ EMFolderTreeModel *folder_tree_model;
+ EMailBackend *backend;
gchar *aname, *bname;
CamelStore *store;
gboolean is_store;
@@ -134,6 +133,10 @@ folder_tree_model_sort (GtkTreeModel *model,
guint asortorder, bsortorder;
gint rv = -2;
+ folder_tree_model = EM_FOLDER_TREE_MODEL (model);
+ backend = em_folder_tree_model_get_backend (folder_tree_model);
+ g_return_val_if_fail (backend != NULL, -1);
+
gtk_tree_model_get (
model, a,
COL_BOOL_IS_STORE, &is_store,
@@ -151,7 +154,16 @@ folder_tree_model_sort (GtkTreeModel *model,
-1);
if (is_store) {
- if (e_shell_settings_get_boolean (e_shell_get_shell_settings (shell), "mail-sort-accounts-alpha")) {
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EShellSettings *shell_settings;
+
+ shell_backend = E_SHELL_BACKEND (backend);
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ if (e_shell_settings_get_boolean (
+ shell_settings, "mail-sort-accounts-alpha")) {
const gchar *on_this_computer = _("On This Computer");
const gchar *search_folders = _("Search Folders");
@@ -226,10 +238,12 @@ account_changed_cb (EAccountList *accounts,
EAccount *account,
EMFolderTreeModel *model)
{
+ EMailBackend *backend;
EMailSession *session;
CamelService *service;
- session = em_folder_tree_model_get_session (model);
+ backend = em_folder_tree_model_get_backend (model);
+ session = e_mail_backend_get_session (backend);
service = camel_session_get_service (
CAMEL_SESSION (session), account->uid);
@@ -251,10 +265,12 @@ account_removed_cb (EAccountList *accounts,
EAccount *account,
EMFolderTreeModel *model)
{
+ EMailBackend *backend;
EMailSession *session;
CamelService *service;
- session = em_folder_tree_model_get_session (model);
+ backend = em_folder_tree_model_get_backend (model);
+ session = e_mail_backend_get_session (backend);
service = camel_session_get_service (
CAMEL_SESSION (session), account->uid);
@@ -271,17 +287,17 @@ account_added_cb (EAccountList *accounts,
EAccount *account,
EMFolderTreeModel *model)
{
- EMailSession *session;
+ EMailBackend *backend;
+
+ backend = em_folder_tree_model_get_backend (model);
- session = em_folder_tree_model_get_session (model);
- e_mail_store_add_by_account (session, account);
+ e_mail_store_add_by_account (backend, account);
}
static void
folder_tree_model_sort_changed (EMFolderTreeModel *tree_model)
{
GtkTreeModel *model;
- EShellBackend *shell_backend;
g_return_if_fail (tree_model != NULL);
g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (tree_model));
@@ -290,12 +306,10 @@ folder_tree_model_sort_changed (EMFolderTreeModel *tree_model)
if (!model)
return;
- shell_backend = E_SHELL_BACKEND (em_folder_tree_model_get_backend (tree_model));
-
/* this invokes also sort on a GtkTreeStore */
gtk_tree_sortable_set_default_sort_func (
GTK_TREE_SORTABLE (model),
- folder_tree_model_sort, e_shell_backend_get_shell (shell_backend), NULL);
+ folder_tree_model_sort, NULL, NULL);
}
static void
@@ -339,14 +353,19 @@ account_sort_order_changed_cb (EMFolderTreeModel *folder_tree_model)
}
static void
-add_remove_special_folder (EMFolderTreeModel *model, const gchar *account_uid, gboolean add)
+add_remove_special_folder (EMFolderTreeModel *model,
+ const gchar *account_uid,
+ gboolean add)
{
+ EMailBackend *backend;
EMailSession *session;
CamelService *service;
- session = em_folder_tree_model_get_session (model);
+ backend = em_folder_tree_model_get_backend (model);
+ session = e_mail_backend_get_session (backend);
- service = camel_session_get_service (CAMEL_SESSION (session), account_uid);
+ service = camel_session_get_service (
+ CAMEL_SESSION (session), account_uid);
if (!CAMEL_IS_STORE (service))
return;
@@ -358,7 +377,9 @@ add_remove_special_folder (EMFolderTreeModel *model, const gchar *account_uid, g
}
static void
-enable_local_folders_changed_cb (EMFolderTreeModel *model, GParamSpec *spec, EShellSettings *shell_settings)
+enable_local_folders_changed_cb (EMFolderTreeModel *model,
+ GParamSpec *spec,
+ EShellSettings *shell_settings)
{
g_return_if_fail (model != NULL);
g_return_if_fail (shell_settings != NULL);
@@ -368,7 +389,9 @@ enable_local_folders_changed_cb (EMFolderTreeModel *model, GParamSpec *spec, ESh
}
static void
-enable_search_folders_changed_cb (EMFolderTreeModel *model, GParamSpec *spec, EShellSettings *shell_settings)
+enable_search_folders_changed_cb (EMFolderTreeModel *model,
+ GParamSpec *spec,
+ EShellSettings *shell_settings)
{
g_return_if_fail (model != NULL);
g_return_if_fail (shell_settings != NULL);
@@ -398,8 +421,8 @@ folder_tree_model_set_property (GObject *object,
g_value_get_object (value));
return;
- case PROP_SESSION:
- em_folder_tree_model_set_session (
+ case PROP_BACKEND:
+ em_folder_tree_model_set_backend (
EM_FOLDER_TREE_MODEL (object),
g_value_get_object (value));
return;
@@ -427,10 +450,10 @@ folder_tree_model_get_property (GObject *object,
EM_FOLDER_TREE_MODEL (object)));
return;
- case PROP_SESSION:
+ case PROP_BACKEND:
g_value_set_object (
value,
- em_folder_tree_model_get_session (
+ em_folder_tree_model_get_backend (
EM_FOLDER_TREE_MODEL (object)));
return;
case PROP_BACKEND:
@@ -515,9 +538,26 @@ folder_tree_model_dispose (GObject *object)
priv->selection = NULL;
}
- if (priv->session != NULL) {
- g_object_unref (priv->session);
- priv->session = NULL;
+ if (priv->backend != NULL) {
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EShellSettings *shell_settings;
+
+ shell_backend = E_SHELL_BACKEND (priv->backend);
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ g_signal_handlers_disconnect_by_func (
+ priv->backend, account_sort_order_changed_cb, object);
+ g_signal_handlers_disconnect_by_func (
+ shell_settings, account_sort_order_changed_cb, object);
+ g_signal_handlers_disconnect_by_func (
+ shell_settings, enable_local_folders_changed_cb, object);
+ g_signal_handlers_disconnect_by_func (
+ shell_settings, enable_search_folders_changed_cb, object);
+
+ g_object_unref (priv->backend);
+ priv->backend = NULL;
}
if (priv->backend) {
@@ -564,6 +604,54 @@ folder_tree_model_finalize (GObject *object)
}
static void
+folder_tree_model_constructed (GObject *object)
+{
+ EMFolderTreeModelPrivate *priv;
+
+ GType col_types[] = {
+ G_TYPE_STRING, /* display name */
+ G_TYPE_POINTER, /* store object */
+ G_TYPE_STRING, /* full name */
+ G_TYPE_STRING, /* icon name */
+ G_TYPE_STRING, /* uri */
+ G_TYPE_UINT, /* unread count */
+ G_TYPE_UINT, /* flags */
+ G_TYPE_BOOLEAN, /* is a store node */
+ G_TYPE_BOOLEAN, /* is a folder node */
+ G_TYPE_BOOLEAN, /* has not-yet-loaded subfolders */
+ G_TYPE_UINT, /* last known unread count */
+ G_TYPE_BOOLEAN, /* folder is a draft folder */
+ G_TYPE_UINT /* user's sortorder */
+ };
+
+ priv = EM_FOLDER_TREE_MODEL_GET_PRIVATE (object);
+
+ gtk_tree_store_set_column_types (
+ GTK_TREE_STORE (object), NUM_COLUMNS, col_types);
+ gtk_tree_sortable_set_default_sort_func (
+ GTK_TREE_SORTABLE (object),
+ folder_tree_model_sort, NULL, NULL);
+ gtk_tree_sortable_set_sort_column_id (
+ GTK_TREE_SORTABLE (object),
+ GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
+ GTK_SORT_ASCENDING);
+
+ priv->accounts = e_get_account_list ();
+ priv->account_changed_id = g_signal_connect (
+ priv->accounts, "account-changed",
+ G_CALLBACK (account_changed_cb), object);
+ priv->account_removed_id = g_signal_connect (
+ priv->accounts, "account-removed",
+ G_CALLBACK (account_removed_cb), object);
+ priv->account_added_id = g_signal_connect (
+ priv->accounts, "account-added",
+ G_CALLBACK (account_added_cb), object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+}
+
+static void
em_folder_tree_model_class_init (EMFolderTreeModelClass *class)
{
GObjectClass *object_class;
@@ -577,25 +665,26 @@ em_folder_tree_model_class_init (EMFolderTreeModelClass *class)
object_class->constructed = folder_tree_model_constructed;
object_class->dispose = folder_tree_model_dispose;
object_class->finalize = folder_tree_model_finalize;
+ object_class->constructed = folder_tree_model_constructed;
g_object_class_install_property (
object_class,
- PROP_SELECTION,
+ PROP_BACKEND,
g_param_spec_object (
- "selection",
- "Selection",
+ "backend",
NULL,
- GTK_TYPE_TREE_SELECTION,
+ NULL,
+ E_TYPE_MAIL_BACKEND,
G_PARAM_READWRITE));
g_object_class_install_property (
object_class,
- PROP_SESSION,
+ PROP_SELECTION,
g_param_spec_object (
- "session",
- NULL,
+ "selection",
+ "Selection",
NULL,
- E_TYPE_MAIL_SESSION,
+ GTK_TYPE_TREE_SELECTION,
G_PARAM_READWRITE));
g_object_class_install_property (
@@ -766,45 +855,68 @@ em_folder_tree_model_set_selection (EMFolderTreeModel *model,
g_object_notify (G_OBJECT (model), "selection");
}
-EMailSession *
-em_folder_tree_model_get_session (EMFolderTreeModel *model)
+EMailBackend *
+em_folder_tree_model_get_backend (EMFolderTreeModel *model)
{
g_return_val_if_fail (EM_IS_FOLDER_TREE_MODEL (model), NULL);
- return model->priv->session;
+ return model->priv->backend;
}
void
-em_folder_tree_model_set_session (EMFolderTreeModel *model,
- EMailSession *session)
+em_folder_tree_model_set_backend (EMFolderTreeModel *model,
+ EMailBackend *backend)
{
g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model));
- if (session != NULL) {
- g_return_if_fail (E_IS_MAIL_SESSION (session));
- g_object_ref (session);
+ if (backend != NULL) {
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_object_ref (backend);
}
- if (model->priv->session != NULL)
- g_object_unref (model->priv->session);
+ if (model->priv->backend != NULL)
+ g_object_unref (model->priv->backend);
- model->priv->session = session;
+ model->priv->backend = backend;
/* FIXME Technically we should be disconnecting this signal
- * when replacing an old session with a new session,
+ * when replacing an old backend with a new backend,
* but at present this function is only called once. */
- if (session != NULL) {
+ if (backend != NULL) {
MailFolderCache *folder_cache;
+ EMailSession *session;
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EShellSettings *shell_settings;
+
+ shell_backend = E_SHELL_BACKEND (backend);
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+ session = e_mail_backend_get_session (backend);
folder_cache = e_mail_session_get_folder_cache (session);
g_signal_connect_swapped (
+ backend, "account-sort-order-changed",
+ G_CALLBACK (account_sort_order_changed_cb), model);
+
+ g_signal_connect_swapped (
+ shell_settings, "notify::mail-sort-accounts-alpha",
+ G_CALLBACK (account_sort_order_changed_cb), model);
+ g_signal_connect_swapped (
+ shell_settings, "notify::mail-enable-local-folders",
+ G_CALLBACK (enable_local_folders_changed_cb), model);
+ g_signal_connect_swapped (
+ shell_settings, "notify::mail-enable-search-folders",
+ G_CALLBACK (enable_search_folders_changed_cb), model);
+
+ g_signal_connect_swapped (
folder_cache, "folder-unread-updated",
G_CALLBACK (folder_tree_model_set_unread_count),
model);
}
- g_object_notify (G_OBJECT (model), "session");
+ g_object_notify (G_OBJECT (model), "backend");
}
EMailBackend *
@@ -844,6 +956,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
GtkTreeRowReference *uri_row, *path_row;
GtkTreeStore *tree_store;
MailFolderCache *folder_cache;
+ EMailBackend *backend;
EMailSession *session;
EAccount *account;
guint unread;
@@ -868,7 +981,8 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
tree_store = GTK_TREE_STORE (model);
- session = em_folder_tree_model_get_session (model);
+ backend = em_folder_tree_model_get_backend (model);
+ session = e_mail_backend_get_session (backend);
folder_cache = e_mail_session_get_folder_cache (session);
uid = camel_service_get_uid (CAMEL_SERVICE (si->store));
diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h
index 3765cfea11..0188753942 100644
--- a/mail/em-folder-tree-model.h
+++ b/mail/em-folder-tree-model.h
@@ -120,11 +120,6 @@ GtkTreeSelection *
void em_folder_tree_model_set_selection
(EMFolderTreeModel *model,
GtkTreeSelection *selection);
-EMailSession * em_folder_tree_model_get_session
- (EMFolderTreeModel *model);
-void em_folder_tree_model_set_session
- (EMFolderTreeModel *model,
- EMailSession *session);
EMailBackend * em_folder_tree_model_get_backend
(EMFolderTreeModel *model);
void em_folder_tree_model_set_backend
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 6212f8a8ca..1d831cc4e4 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -1770,7 +1770,7 @@ em_folder_tree_new (EMailBackend *backend,
g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
g_return_val_if_fail (E_IS_ALERT_SINK (alert_sink), NULL);
- model = em_folder_tree_model_get_default (backend);
+ model = em_folder_tree_model_get_default ();
return em_folder_tree_new_with_model (backend, alert_sink, model);
}
@@ -1780,17 +1780,15 @@ em_folder_tree_new_with_model (EMailBackend *backend,
EAlertSink *alert_sink,
EMFolderTreeModel *model)
{
- EMailSession *session;
const gchar *data_dir;
g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
g_return_val_if_fail (E_IS_ALERT_SINK (alert_sink), NULL);
g_return_val_if_fail (EM_IS_FOLDER_TREE_MODEL (model), NULL);
- session = e_mail_backend_get_session (backend);
data_dir = e_shell_backend_get_data_dir (E_SHELL_BACKEND (backend));
- e_mail_store_init (session, data_dir);
+ e_mail_store_init (backend, data_dir);
return g_object_new (
EM_TYPE_FOLDER_TREE,
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index 54586ad763..e72b8014ad 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -487,7 +487,7 @@ em_folder_utils_copy_folder (GtkWindow *parent,
label = delete ? _("_Move") : _("C_opy");
title = delete ? _("Move Folder To") : _("Copy Folder To");
- model = em_folder_tree_model_get_default (backend);
+ model = em_folder_tree_model_get_default ();
dialog = em_folder_selector_new (
parent, backend, model,
@@ -565,10 +565,10 @@ em_folder_utils_create_folder (GtkWindow *parent,
shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
shell_settings = e_shell_get_shell_settings (shell);
- model = em_folder_tree_model_new (backend);
- session = e_mail_backend_get_session (backend);
- em_folder_tree_model_set_session (model, session);
+ model = em_folder_tree_model_new ();
+ em_folder_tree_model_set_backend (model, backend);
+ session = e_mail_backend_get_session (backend);
list = camel_session_list_services (CAMEL_SESSION (session));
for (link = list; link != NULL; link = g_list_next (link)) {
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index a1be319390..f3209b8b89 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -40,13 +40,14 @@
#undef interface
#endif
-#include <libedataserver/e-data-server-util.h> /* for e_utf8_strftime, what about e_time_format_time? */
+#include <libebackend/e-extensible.h>
#include <libedataserver/e-time-utils.h>
+#include <libedataserver/e-data-server-util.h> /* for e_utf8_strftime, what about e_time_format_time? */
+
#include "e-util/e-datetime-format.h"
#include "e-util/e-icon-factory.h"
#include "e-util/e-util-private.h"
#include "e-util/e-util.h"
-#include "e-util/e-extensible.h"
#include "misc/e-web-view.h"
#include <shell/e-shell.h>
@@ -1511,6 +1512,43 @@ emfh_getpuri (struct _EMFormatHTMLJob *job,
}
static void
+emfh_configure_stream_for_proxy (CamelHttpStream *stream,
+ const gchar *uri)
+{
+ EProxy *proxy;
+ SoupURI *proxy_uri;
+ gchar *basic;
+ gchar *basic64;
+ const gchar *user = "";
+ const gchar *password = "";
+
+ proxy = em_utils_get_proxy ();
+
+ if (!e_proxy_require_proxy_for_uri (proxy, uri))
+ return;
+
+ proxy_uri = e_proxy_peek_uri_for (proxy, uri);
+
+ if (proxy_uri == NULL)
+ return;
+
+ if (proxy_uri->user != NULL)
+ user = proxy_uri->user;
+
+ if (proxy_uri->password != NULL)
+ password = proxy_uri->password;
+
+ if (*user == '\0' && *password == '\0')
+ return;
+
+ basic = g_strdup_printf ("%s:%s", user, password);
+ basic64 = g_base64_encode ((guchar *) basic, strlen (basic));
+ camel_http_stream_set_proxy_authpass (stream, basic64);
+ g_free (basic64);
+ g_free (basic);
+}
+
+static void
emfh_gethttp (struct _EMFormatHTMLJob *job,
GCancellable *cancellable)
{
@@ -1533,7 +1571,6 @@ emfh_gethttp (struct _EMFormatHTMLJob *job,
if (instream == NULL) {
EMailImageLoadingPolicy policy;
- gchar *proxy;
policy = em_format_html_get_image_loading_policy (job->format);
@@ -1552,12 +1589,9 @@ emfh_gethttp (struct _EMFormatHTMLJob *job,
}
instream = camel_http_stream_new (CAMEL_HTTP_METHOD_GET, ((EMFormat *) job->format)->session, url);
- camel_http_stream_set_user_agent((CamelHttpStream *)instream, "CamelHttpStream/1.0 Evolution/" VERSION);
- proxy = em_utils_get_proxy_uri (job->u.uri);
- if (proxy) {
- camel_http_stream_set_proxy ((CamelHttpStream *) instream, proxy);
- g_free (proxy);
- }
+ camel_http_stream_set_user_agent((CamelHttpStream *) instream, "CamelHttpStream/1.0 Evolution/" VERSION);
+ emfh_configure_stream_for_proxy ((CamelHttpStream *) instream, job->u.uri);
+
camel_operation_push_message (
cancellable, _("Retrieving '%s'"), job->u.uri);
tmp_stream = (CamelHttpStream *) instream;
diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c
index 2dca93b51a..09b74bcb3c 100644
--- a/mail/em-subscription-editor.c
+++ b/mail/em-subscription-editor.c
@@ -51,7 +51,7 @@ typedef struct _AsyncContext AsyncContext;
typedef struct _StoreData StoreData;
struct _EMSubscriptionEditorPrivate {
- CamelSession *session;
+ EMailBackend *backend;
CamelStore *initial_store;
GtkWidget *combo_box; /* not referenced */
@@ -95,7 +95,7 @@ struct _StoreData {
enum {
PROP_0,
- PROP_SESSION,
+ PROP_BACKEND,
PROP_STORE
};
@@ -932,13 +932,13 @@ subscription_editor_set_store (EMSubscriptionEditor *editor,
}
static void
-subscription_editor_set_session (EMSubscriptionEditor *editor,
- CamelSession *session)
+subscription_editor_set_backend (EMSubscriptionEditor *editor,
+ EMailBackend *backend)
{
- g_return_if_fail (CAMEL_IS_SESSION (session));
- g_return_if_fail (editor->priv->session == NULL);
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+ g_return_if_fail (editor->priv->backend == NULL);
- editor->priv->session = g_object_ref (session);
+ editor->priv->backend = g_object_ref (backend);
}
static void
@@ -948,8 +948,8 @@ subscription_editor_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
- subscription_editor_set_session (
+ case PROP_BACKEND:
+ subscription_editor_set_backend (
EM_SUBSCRIPTION_EDITOR (object),
g_value_get_object (value));
return;
@@ -971,10 +971,10 @@ subscription_editor_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_SESSION:
+ case PROP_BACKEND:
g_value_set_object (
value,
- em_subscription_editor_get_session (
+ em_subscription_editor_get_backend (
EM_SUBSCRIPTION_EDITOR (object)));
return;
@@ -996,9 +996,9 @@ subscription_editor_dispose (GObject *object)
priv = EM_SUBSCRIPTION_EDITOR_GET_PRIVATE (object);
- if (priv->session != NULL) {
- g_object_unref (priv->session);
- priv->session = NULL;
+ if (priv->backend != NULL) {
+ g_object_unref (priv->backend);
+ priv->backend = NULL;
}
if (priv->initial_store != NULL) {
@@ -1044,14 +1044,17 @@ subscription_editor_constructed (GObject *object)
if (editor->priv->initial_store == NULL) {
EAccount *account;
CamelService *service;
- CamelSession *session;
- const gchar *uid;
+ EMailBackend *backend;
+ EMailSession *session;
account = e_get_default_account ();
- uid = account->uid;
- session = em_subscription_editor_get_session (editor);
- service = camel_session_get_service (session, uid);
+ backend = em_subscription_editor_get_backend (editor);
+ session = e_mail_backend_get_session (backend);
+
+ service = camel_session_get_service (
+ CAMEL_SESSION (session),
+ account->uid);
if (CAMEL_IS_SUBSCRIBABLE (service))
editor->priv->initial_store = g_object_ref (service);
@@ -1077,7 +1080,7 @@ subscription_editor_realize (GtkWidget *widget)
/* Find stores to display, and watch for the initial store. */
- model = em_folder_tree_model_get_default (NULL);
+ model = em_folder_tree_model_get_default ();
list = em_folder_tree_model_list_stores (model);
for (link = list; link != NULL; link = g_list_next (link)) {
@@ -1122,12 +1125,12 @@ em_subscription_editor_class_init (EMSubscriptionEditorClass *class)
g_object_class_install_property (
object_class,
- PROP_SESSION,
+ PROP_BACKEND,
g_param_spec_object (
- "session",
+ "backend",
NULL,
NULL,
- CAMEL_TYPE_SESSION,
+ E_TYPE_MAIL_BACKEND,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -1343,26 +1346,26 @@ em_subscription_editor_init (EMSubscriptionEditor *editor)
GtkWidget *
em_subscription_editor_new (GtkWindow *parent,
- CamelSession *session,
+ EMailBackend *backend,
CamelStore *initial_store)
{
g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
- g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
return g_object_new (
EM_TYPE_SUBSCRIPTION_EDITOR,
- "session", session,
+ "backend", backend,
"store", initial_store,
"transient-for", parent,
NULL);
}
-CamelSession *
-em_subscription_editor_get_session (EMSubscriptionEditor *editor)
+EMailBackend *
+em_subscription_editor_get_backend (EMSubscriptionEditor *editor)
{
g_return_val_if_fail (EM_IS_SUBSCRIPTION_EDITOR (editor), NULL);
- return editor->priv->session;
+ return editor->priv->backend;
}
CamelStore *
diff --git a/mail/em-subscription-editor.h b/mail/em-subscription-editor.h
index d75347760b..1b297f44ed 100644
--- a/mail/em-subscription-editor.h
+++ b/mail/em-subscription-editor.h
@@ -21,6 +21,7 @@
#include <gtk/gtk.h>
#include <camel/camel.h>
+#include <mail/e-mail-backend.h>
/* Standard GObject macros */
#define EM_TYPE_SUBSCRIPTION_EDITOR \
@@ -58,9 +59,11 @@ struct _EMSubscriptionEditorClass {
GType em_subscription_editor_get_type (void);
GtkWidget * em_subscription_editor_new (GtkWindow *parent,
- CamelSession *session,
+ EMailBackend *backend,
CamelStore *initial_store);
-CamelSession * em_subscription_editor_get_session
+EMailBackend * em_subscription_editor_get_backend
+ (EMSubscriptionEditor *editor);
+CamelStore * em_subscription_editor_get_store
(EMSubscriptionEditor *editor);
CamelStore * em_subscription_editor_get_store
(EMSubscriptionEditor *editor);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 5ff93887a2..67978884d0 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1194,69 +1194,6 @@ em_utils_folder_is_outbox (CamelFolder *folder)
static EProxy *emu_proxy = NULL;
static GStaticMutex emu_proxy_lock = G_STATIC_MUTEX_INIT;
-/* encode to string this way, because soup_uri_to_string doesn't include passwords */
-static gchar *
-suri_to_string (SoupURI *suri)
-{
- GString *uri;
- gchar *tmp;
-
- if (!suri)
- return NULL;
-
- uri = g_string_sized_new (20);
-
- if (suri->scheme)
- g_string_append_printf (uri, "%s:", suri->scheme);
- if (suri->host) {
- g_string_append (uri, "//");
- if (suri->user) {
- tmp = soup_uri_encode (suri->user, ":/;#@?\\");
- g_string_append (uri, tmp);
- g_free (tmp);
- }
-
- if (suri->password) {
- g_string_append_c (uri, ':');
- tmp = soup_uri_encode (suri->password, ":/;#@?\\");
- g_string_append (uri, tmp);
- g_free (tmp);
- }
-
- if (suri->user || suri->password)
- g_string_append_c (uri, '@');
-
- if (strchr (suri->host, ':')) {
- g_string_append_c (uri, '[');
- g_string_append (uri, suri->host);
- g_string_append_c (uri, ']');
- } else {
- tmp = soup_uri_encode (suri->host, ":/");
- g_string_append (uri, tmp);
- g_free (tmp);
- }
-
- if (suri->port && !soup_uri_uses_default_port (suri))
- g_string_append_printf (uri, ":%d", suri->port);
- if (!suri->path && (suri->query || suri->fragment))
- g_string_append_c (uri, '/');
- }
-
- if (suri->path && *suri->path)
- g_string_append (uri, suri->path);
-
- if (suri->query) {
- g_string_append_c (uri, '?');
- g_string_append (uri, suri->query);
- }
- if (suri->fragment) {
- g_string_append_c (uri, '#');
- g_string_append (uri, suri->fragment);
- }
-
- return g_string_free (uri, FALSE);
-}
-
static gpointer
emu_proxy_setup (gpointer data)
{
@@ -1269,30 +1206,18 @@ emu_proxy_setup (gpointer data)
return NULL;
}
-/**
- * em_utils_get_proxy_uri:
- *
- * Get the system proxy uri for 'pUri'.
- *
- * Return value: Must be freed when finished with.
- **/
-gchar *
-em_utils_get_proxy_uri (const gchar *pUri)
+EProxy *
+em_utils_get_proxy (void)
{
- gchar *uri = NULL;
-
g_static_mutex_lock (&emu_proxy_lock);
if (!emu_proxy) {
mail_call_main (MAIL_CALL_p_p, (MailMainFunc) emu_proxy_setup, NULL);
}
- if (e_proxy_require_proxy_for_uri (emu_proxy, pUri))
- uri = suri_to_string (e_proxy_peek_uri_for (emu_proxy, pUri));
-
g_static_mutex_unlock (&emu_proxy_lock);
- return uri;
+ return emu_proxy;
}
/**
@@ -2391,7 +2316,8 @@ free_account_sort_order_cache (void)
}
static void
-fill_accounts_sort_order_cache (EMailBackend *backend, gboolean force_reload)
+fill_accounts_sort_order_cache (EMailBackend *backend,
+ gboolean force_reload)
{
GSList *account_uids;
@@ -2455,7 +2381,8 @@ emu_get_sort_order_key_file (EMailBackend *backend)
}
void
-em_utils_save_accounts_sort_order (EMailBackend *backend, const GSList *account_uids)
+em_utils_save_accounts_sort_order (EMailBackend *backend,
+ const GSList *account_uids)
{
gchar *filename;
GKeyFile *key_file;
@@ -2520,7 +2447,8 @@ em_utils_load_accounts_sort_order (EMailBackend *backend)
}
guint
-em_utils_get_account_sort_order (EMailBackend *backend, const gchar *account_uid)
+em_utils_get_account_sort_order (EMailBackend *backend,
+ const gchar *account_uid)
{
guint res;
diff --git a/mail/em-utils.h b/mail/em-utils.h
index e6ebe8ca4b..b07b74b186 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include <sys/types.h>
#include <camel/camel.h>
+#include <libedataserver/e-proxy.h>
#include <mail/e-mail-reader.h>
#include <mail/e-mail-session.h>
@@ -66,7 +67,7 @@ gboolean em_utils_folder_is_templates (CamelFolder *folder);
gboolean em_utils_folder_is_sent (CamelFolder *folder);
gboolean em_utils_folder_is_outbox (CamelFolder *folder);
-gchar *em_utils_get_proxy_uri (const gchar *uri);
+EProxy * em_utils_get_proxy (void);
/* FIXME: should this have an override charset? */
gchar *em_utils_message_to_html (CamelMimeMessage *msg, const gchar *credits, guint32 flags, struct _EMFormat *source, const gchar *append, guint32 *validity_found);
diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c
index fbb711738f..04c009bc00 100644
--- a/mail/em-vfolder-rule.c
+++ b/mail/em-vfolder-rule.c
@@ -32,6 +32,7 @@
#include "em-vfolder-context.h"
#include "em-vfolder-rule.h"
+#include "mail/e-mail-folder-utils.h"
#include "mail/e-mail-store.h"
#include "mail/em-utils.h"
#include "mail/em-folder-tree.h"
@@ -532,63 +533,38 @@ select_source_with_changed (GtkWidget *widget,
data->vr->with = with;
}
-/* attempt to make a 'nice' folder name out of the raw uri */
-static gchar *
-format_source (const gchar *uri)
-{
- CamelURL *url;
- GString *out;
- gchar *res;
-
- /* This should really probably base it on the account name? */
- url = camel_url_new (uri, NULL);
-
- /* bad uri */
- if (url == NULL)
- return g_strdup (uri);
-
- out = g_string_new (url->protocol);
- g_string_append_c (out, ':');
- if (url->user && url->host) {
- g_string_append_printf(out, "%s@%s", url->user, url->host);
- if (url->port)
- g_string_append_printf(out, ":%d", url->port);
- }
- if (url->fragment)
- g_string_append (out, url->fragment);
- else if (url->path)
- g_string_append (out, url->path);
-
- res = out->str;
- g_string_free (out, FALSE);
-
- return res;
-}
-
static void
vfr_folder_response (EMFolderSelector *selector,
gint button,
struct _source_data *data)
{
+ EMailBackend *backend;
+ EMailSession *session;
const gchar *uri;
+ backend = em_folder_selector_get_backend (selector);
+ session = e_mail_backend_get_session (backend);
+
uri = em_folder_selector_get_selected_uri (selector);
if (button == GTK_RESPONSE_OK && uri != NULL) {
- gchar *urinice;
GtkTreeSelection *selection;
GtkTreeIter iter;
+ gchar *markup;
g_queue_push_tail (&data->vr->sources, g_strdup (uri));
+ markup = e_mail_folder_uri_to_markup (
+ CAMEL_SESSION (session), uri, NULL);
+
gtk_list_store_append (data->model, &iter);
- urinice = format_source (uri);
- gtk_list_store_set (data->model, &iter, 0, urinice, 1, uri, -1);
- g_free (urinice);
+ gtk_list_store_set (data->model, &iter, 0, markup, 1, uri, -1);
selection = gtk_tree_view_get_selection (data->list);
gtk_tree_selection_select_iter (selection, &iter);
data->current = uri;
+ g_free (markup);
+
set_sensitive (data);
}
@@ -610,7 +586,7 @@ source_add (GtkWidget *widget,
backend = em_vfolder_rule_get_backend (data->vr);
- model = em_folder_tree_model_get_default (backend);
+ model = em_folder_tree_model_get_default ();
dialog = em_folder_selector_new (
parent, backend, model,
@@ -687,6 +663,8 @@ get_widget (EFilterRule *fr,
ERuleContext *rc)
{
EMVFolderRule *vr =(EMVFolderRule *) fr;
+ EMailBackend *backend;
+ EMailSession *session;
GtkWidget *widget, *frame;
struct _source_data *data;
GtkRadioButton *rb;
@@ -721,13 +699,19 @@ get_widget (EFilterRule *fr,
object = gtk_builder_get_object (builder, "source_model");
data->model = GTK_LIST_STORE (object);
+ backend = em_vfolder_context_get_backend (EM_VFOLDER_CONTEXT (rc));
+ session = e_mail_backend_get_session (backend);
+
source = NULL;
while ((source = em_vfolder_rule_next_source (vr, source))) {
- gchar *nice = format_source (source);
+ gchar *markup;
+
+ markup = e_mail_folder_uri_to_markup (
+ CAMEL_SESSION (session), source, NULL);
gtk_list_store_append (data->model, &iter);
- gtk_list_store_set (data->model, &iter, 0, nice, 1, source, -1);
- g_free (nice);
+ gtk_list_store_set (data->model, &iter, 0, markup, 1, source, -1);
+ g_free (markup);
}
g_signal_connect (data->list, "cursor-changed", G_CALLBACK(select_source), data);
diff --git a/mail/importers/Makefile.am b/mail/importers/Makefile.am
index 0c1864928b..fa1a400f03 100644
--- a/mail/importers/Makefile.am
+++ b/mail/importers/Makefile.am
@@ -6,11 +6,11 @@ libevolution_mail_importers_la_CPPFLAGS = \
-I$(srcdir)/.. \
-I$(top_srcdir) \
-I$(top_srcdir)/widgets \
- $(GNOME_PLATFORM_CFLAGS) \
- $(EVOLUTION_MAIL_CFLAGS) \
-DG_LOG_DOMAIN=\"evolution-mail-importer\" \
-DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \
- $(IMPORTERS_CFLAGS)
+ $(EVOLUTION_DATA_SERVER_CFLAGS) \
+ $(GNOME_PLATFORM_CFLAGS) \
+ $(GTKHTML_CFLAGS)
libevolution_mail_importers_la_SOURCES = \
mail-importer.c \
@@ -28,8 +28,8 @@ libevolution_mail_importers_la_LIBADD = \
$(top_builddir)/mail/libevolution-mail.la \
$(top_builddir)/shell/libeshell.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(EVOLUTION_DATA_SERVER_LIBS) \
$(GNOME_PLATFORM_LIBS) \
- $(EVOLUTION_MAIL_LIBS) \
- $(IMPORTERS_LIBS)
+ $(GTKHTML_LIBS)
-include $(top_srcdir)/git.mk
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index 5d934aafa2..8c788b69ad 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -409,6 +409,11 @@ for display purposes only. </property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkAdjustment" id="adjustment6">
+ <property name="upper">65535</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkNotebook" id="composer_toplevel">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -1505,6 +1510,22 @@ for display purposes only. </property>
</packing>
</child>
<child>
+ <object class="GtkLabel" id="lblSocksHost">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">SOC_KS Proxy:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtSocksHost</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="lblIgnoreHosts">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -1547,6 +1568,20 @@ for display purposes only. </property>
</packing>
</child>
<child>
+ <object class="GtkEntry" id="txtSocksHost">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="lblHttpPort">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -1577,6 +1612,22 @@ for display purposes only. </property>
</packing>
</child>
<child>
+ <object class="GtkLabel" id="lblSocksPort">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Port:</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
<object class="GtkSpinButton" id="spnHttpPort">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -1607,6 +1658,22 @@ for display purposes only. </property>
</packing>
</child>
<child>
+ <object class="GtkSpinButton" id="spnSocksPort">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">adjustment6</property>
+ <property name="climb_rate">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
<object class="GtkEntry" id="txtIgnoreHosts">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -4265,6 +4332,7 @@ For example: "Work" or "Personal"</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
diff --git a/mail/mail-dialogs.ui b/mail/mail-dialogs.ui
index ff74671741..58a9f8c2aa 100644
--- a/mail/mail-dialogs.ui
+++ b/mail/mail-dialogs.ui
@@ -125,7 +125,7 @@
<child>
<object class="GtkCellRendererText" id="source_renderer"/>
<attributes>
- <attribute name="text">0</attribute>
+ <attribute name="markup">0</attribute>
</attributes>
</child>
</object>
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 0e1ac98413..30bbce6579 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -39,8 +39,8 @@
#include <glib/gstdio.h>
#include <libedataserver/e-data-server-util.h>
-#include "e-util/e-marshal.h"
-#include "e-util/e-util.h"
+#include <e-util/e-marshal.h>
+#include <e-util/e-util.h>
#include "mail-mt.h"
#include "mail-folder-cache.h"
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 2c4b3067df..57885172a9 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -215,7 +215,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m,
CamelFolder *folder = NULL;
CamelURL *url;
const gchar *uid;
- gboolean is_local_delivery;
+ gboolean is_local_delivery = FALSE;
gint i;
fm->destination = e_mail_local_get_folder (
@@ -452,7 +452,7 @@ static const gchar *resent_recipients[] = {
struct _send_queue_msg {
MailMsg base;
- EMailSession *session;
+ EMailBackend *backend;
CamelFolder *queue;
CamelTransport *transport;
@@ -483,6 +483,7 @@ mail_send_message (struct _send_queue_msg *m,
GError **error)
{
EAccount *account = NULL;
+ EMailSession *session;
const CamelInternetAddress *iaddr;
CamelAddress *from, *recipients;
CamelMessageInfo *info = NULL;
@@ -504,11 +505,13 @@ mail_send_message (struct _send_queue_msg *m,
camel_medium_set_header (CAMEL_MEDIUM (message), "X-Mailer", x_mailer);
- err = g_string_new("");
+ err = g_string_new ("");
xev = mail_tool_remove_xevolution_headers (message);
- tmp = camel_header_raw_find(&xev, "X-Evolution-Account", NULL);
- if (tmp) {
+ session = e_mail_backend_get_session (m->backend);
+
+ tmp = camel_header_raw_find (&xev, "X-Evolution-Account", NULL);
+ if (tmp != NULL) {
gchar *name;
name = g_strstrip (g_strdup (tmp));
@@ -522,7 +525,7 @@ mail_send_message (struct _send_queue_msg *m,
transport_uid = g_strconcat (
account->uid, "-transport", NULL);
service = camel_session_get_service (
- CAMEL_SESSION (m->session),
+ CAMEL_SESSION (session),
transport_uid);
g_free (transport_uid);
@@ -607,7 +610,7 @@ mail_send_message (struct _send_queue_msg *m,
uri = g_strstrip (g_strdup (header->value));
/* FIXME Not passing a GCancellable or GError here. */
folder = e_mail_session_uri_to_folder_sync (
- m->session, uri, 0, NULL, NULL);
+ session, uri, 0, NULL, NULL);
if (folder) {
/* FIXME Not passing a GCancellable or GError here. */
camel_folder_append_message_sync (
@@ -647,7 +650,7 @@ mail_send_message (struct _send_queue_msg *m,
if (sent_folder_uri) {
folder = e_mail_session_uri_to_folder_sync (
- m->session, sent_folder_uri, 0,
+ session, sent_folder_uri, 0,
cancellable, &local_error);
if (folder == NULL) {
g_string_append_printf (
@@ -714,7 +717,7 @@ mail_send_message (struct _send_queue_msg *m,
if (local_error == NULL) {
/* Mark the draft message for deletion, if present. */
e_mail_session_handle_draft_headers_sync (
- m->session, message, cancellable, &local_error);
+ session, message, cancellable, &local_error);
if (local_error != NULL) {
g_warning ("%s: Failed to handle draft headers: %s", G_STRFUNC, local_error->message);
g_clear_error (&local_error);
@@ -724,7 +727,7 @@ mail_send_message (struct _send_queue_msg *m,
* Source message refers to the message being forwarded
* or replied to. */
e_mail_session_handle_source_headers_sync (
- m->session, message, cancellable, &local_error);
+ session, message, cancellable, &local_error);
if (local_error != NULL) {
g_warning ("%s: Failed to handle source headers: %s", G_STRFUNC, local_error->message);
g_clear_error (&local_error);
@@ -766,8 +769,6 @@ exit:
camel_header_raw_clear (&xev);
g_string_free (err, TRUE);
g_object_unref (message);
-
- return;
}
/* ** SEND MAIL QUEUE ***************************************************** */
@@ -930,8 +931,8 @@ send_queue_desc (struct _send_queue_msg *m)
static void
send_queue_free (struct _send_queue_msg *m)
{
- if (m->session != NULL)
- g_object_unref (m->session);
+ if (m->backend != NULL)
+ g_object_unref (m->backend);
if (m->driver != NULL)
g_object_unref (m->driver);
if (m->transport != NULL)
@@ -950,7 +951,7 @@ static MailMsgInfo send_queue_info = {
/* same interface as fetch_mail, just 'cause i'm lazy today
* (and we need to run it from the same spot?) */
void
-mail_send_queue (EMailSession *session,
+mail_send_queue (EMailBackend *backend,
CamelFolder *queue,
CamelTransport *transport,
const gchar *type,
@@ -962,10 +963,15 @@ mail_send_queue (EMailSession *session,
void (*done)(gpointer data),
gpointer data)
{
+ EMailSession *session;
struct _send_queue_msg *m;
+ g_return_if_fail (E_IS_MAIL_BACKEND (backend));
+
+ session = e_mail_backend_get_session (backend);
+
m = mail_msg_new (&send_queue_info);
- m->session = g_object_ref (session);
+ m->backend = g_object_ref (backend);
m->queue = g_object_ref (queue);
m->transport = g_object_ref (transport);
if (G_IS_CANCELLABLE (cancellable))
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index 32784be245..4ec64ccf22 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -63,7 +63,7 @@ void mail_xfer_folder (const gchar *src_uri, const gchar *dest_uri, gboolean rem
gpointer data);
/* yeah so this is messy, but it does a lot, maybe i can consolidate all user_data's to be the one */
-void mail_send_queue (EMailSession *session,
+void mail_send_queue (EMailBackend *backend,
CamelFolder *queue,
CamelTransport *transport,
const gchar *type,
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 5fda76d103..33ac977e35 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -107,7 +107,7 @@ typedef enum {
struct _send_info {
send_info_t type; /* 0 = fetch, 1 = send */
- EMailSession *session;
+ EMailBackend *backend;
GCancellable *cancellable;
gchar *service_uid;
gboolean keep_on_server;
@@ -151,8 +151,8 @@ free_folder_info (struct _folder_info *info)
static void
free_send_info (struct _send_info *info)
{
- if (info->session)
- g_object_unref (info->session);
+ if (info->backend)
+ g_object_unref (info->backend);
if (info->cancellable)
g_object_unref (info->cancellable);
g_free (info->service_uid);
@@ -425,7 +425,7 @@ get_receive_type (CamelURL *url)
static struct _send_data *
build_dialog (GtkWindow *parent,
- EMailSession *session,
+ EMailBackend *backend,
EAccountList *accounts,
CamelFolder *outbox,
EAccount *outgoing_account,
@@ -552,7 +552,7 @@ build_dialog (GtkWindow *parent,
info = g_malloc0 (sizeof (*info));
info->type = type;
- info->session = g_object_ref (session);
+ info->backend = g_object_ref (backend);
d(printf("adding source %s\n", source->url));
@@ -802,21 +802,24 @@ receive_done (gpointer data)
/* if we've been called to run again - run again */
if (info->type == SEND_SEND && info->state == SEND_ACTIVE && info->again) {
+ EMailSession *session;
CamelFolder *local_outbox;
CamelService *service;
+ session = e_mail_backend_get_session (info->backend);
+
local_outbox = e_mail_local_get_folder (
E_MAIL_LOCAL_FOLDER_OUTBOX);
service = camel_session_get_service (
- CAMEL_SESSION (info->session),
+ CAMEL_SESSION (session),
info->service_uid);
g_return_if_fail (CAMEL_IS_TRANSPORT (service));
info->again = 0;
mail_send_queue (
- info->session,
+ info->backend,
local_outbox,
CAMEL_TRANSPORT (service),
E_FILTER_SOURCE_OUTGOING,
@@ -875,19 +878,24 @@ receive_get_folder (CamelFilterDriver *d,
{
struct _send_info *info = data;
CamelFolder *folder;
+ EMailSession *session;
struct _folder_info *oldinfo;
gpointer oldkey, oldinfoptr;
g_mutex_lock (info->data->lock);
oldinfo = g_hash_table_lookup (info->data->folders, uri);
g_mutex_unlock (info->data->lock);
+
if (oldinfo) {
g_object_ref (oldinfo->folder);
return oldinfo->folder;
}
+
+ session = e_mail_backend_get_session (info->backend);
+
/* FIXME Not passing a GCancellable here. */
folder = e_mail_session_uri_to_folder_sync (
- info->session, uri, 0, NULL, error);
+ session, uri, 0, NULL, error);
if (!folder)
return NULL;
@@ -965,6 +973,7 @@ refresh_folders_exec (struct _refresh_folders_msg *m,
GError **error)
{
CamelFolder *folder;
+ EMailSession *session;
gint i;
GError *local_error = NULL;
gulong handler_id = 0;
@@ -978,9 +987,11 @@ refresh_folders_exec (struct _refresh_folders_msg *m,
camel_operation_push_message (m->info->cancellable, _("Updating..."));
+ session = e_mail_backend_get_session (m->info->backend);
+
for (i = 0; i < m->folders->len; i++) {
folder = e_mail_session_uri_to_folder_sync (
- m->info->session,
+ session,
m->folders->pdata[i], 0,
cancellable, &local_error);
if (folder) {
@@ -1068,14 +1079,16 @@ static void
receive_update_got_store (CamelStore *store,
struct _send_info *info)
{
+ EMailSession *session;
MailFolderCache *folder_cache;
- folder_cache = e_mail_session_get_folder_cache (info->session);
+ session = e_mail_backend_get_session (info->backend);
+ folder_cache = e_mail_session_get_folder_cache (session);
if (store) {
mail_folder_cache_note_store (
folder_cache,
- CAMEL_SESSION (info->session),
+ CAMEL_SESSION (session),
store, info->cancellable,
receive_update_got_folderinfo, info);
} else {
@@ -1085,11 +1098,12 @@ receive_update_got_store (CamelStore *store,
static GtkWidget *
send_receive (GtkWindow *parent,
- EMailSession *session,
+ EMailBackend *backend,
gboolean allow_send)
{
CamelFolder *local_outbox;
struct _send_data *data;
+ EMailSession *session;
EAccountList *accounts;
EAccount *account;
GList *scan;
@@ -1101,6 +1115,8 @@ send_receive (GtkWindow *parent,
return send_recv_dialog;
}
+ session = e_mail_backend_get_session (backend);
+
if (!camel_session_get_online (CAMEL_SESSION (session)))
return send_recv_dialog;
@@ -1112,7 +1128,7 @@ send_receive (GtkWindow *parent,
local_outbox = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_OUTBOX);
data = build_dialog (
- parent, session, accounts,
+ parent, backend, accounts,
local_outbox, account, allow_send);
for (scan = data->infos; scan != NULL; scan = scan->next) {
@@ -1139,7 +1155,7 @@ send_receive (GtkWindow *parent,
case SEND_SEND:
/* todo, store the folder in info? */
mail_send_queue (
- session, local_outbox,
+ backend, local_outbox,
CAMEL_TRANSPORT (service),
E_FILTER_SOURCE_OUTGOING,
info->cancellable,
@@ -1161,21 +1177,21 @@ send_receive (GtkWindow *parent,
GtkWidget *
mail_send_receive (GtkWindow *parent,
- EMailSession *session)
+ EMailBackend *backend)
{
- return send_receive (parent, session, TRUE);
+ return send_receive (parent, backend, TRUE);
}
GtkWidget *
mail_receive (GtkWindow *parent,
- EMailSession *session)
+ EMailBackend *backend)
{
- return send_receive (parent, session, FALSE);
+ return send_receive (parent, backend, FALSE);
}
struct _auto_data {
EAccount *account;
- EMailSession *session;
+ EMailBackend *backend;
gint period; /* in seconds */
gint timeout_id;
};
@@ -1185,10 +1201,13 @@ static GHashTable *auto_active;
static gboolean
auto_timeout (gpointer data)
{
+ EMailSession *session;
struct _auto_data *info = data;
- if (camel_session_get_online (CAMEL_SESSION (info->session)))
- mail_receive_account (info->session, info->account);
+ session = e_mail_backend_get_session (info->backend);
+
+ if (camel_session_get_online (CAMEL_SESSION (session)))
+ mail_receive_account (info->backend, info->account);
return TRUE;
}
@@ -1211,8 +1230,8 @@ auto_account_removed (EAccountList *eal,
static void
auto_account_finalized (struct _auto_data *info)
{
- if (info->session != NULL)
- g_object_unref (info->session);
+ if (info->backend != NULL)
+ g_object_unref (info->backend);
if (info->timeout_id)
g_source_remove (info->timeout_id);
g_free (info);
@@ -1243,13 +1262,13 @@ auto_account_commit (struct _auto_data *info)
static void
auto_account_added (EAccountList *eal,
EAccount *ea,
- EMailSession *session)
+ EMailBackend *backend)
{
struct _auto_data *info;
info = g_malloc0 (sizeof (*info));
info->account = ea;
- info->session = g_object_ref (session);
+ info->backend = g_object_ref (backend);
g_object_set_data_full (
G_OBJECT (ea), "mail-autoreceive", info,
(GDestroyNotify) auto_account_finalized);
@@ -1314,7 +1333,6 @@ mail_autoreceive_init (EMailBackend *backend)
{
EShellBackend *shell_backend;
EShellSettings *shell_settings;
- EMailSession *session;
EAccountList *accounts;
EIterator *iter;
EShell *shell;
@@ -1327,11 +1345,9 @@ mail_autoreceive_init (EMailBackend *backend)
accounts = e_get_account_list ();
auto_active = g_hash_table_new (g_str_hash, g_str_equal);
- session = e_mail_backend_get_session (backend);
-
g_signal_connect (
accounts, "account-added",
- G_CALLBACK (auto_account_added), session);
+ G_CALLBACK (auto_account_added), backend);
g_signal_connect (
accounts, "account-removed",
G_CALLBACK (auto_account_removed), NULL);
@@ -1344,7 +1360,7 @@ mail_autoreceive_init (EMailBackend *backend)
e_iterator_next (iter))
auto_account_added (
accounts, (EAccount *)
- e_iterator_get (iter), session);
+ e_iterator_get (iter), backend);
shell_backend = E_SHELL_BACKEND (backend);
shell = e_shell_backend_get_shell (shell_backend);
@@ -1356,7 +1372,7 @@ mail_autoreceive_init (EMailBackend *backend)
/* also flush outbox on start */
if (e_shell_get_online (shell))
- mail_send (session);
+ mail_send (backend);
}
g_signal_connect (
@@ -1367,11 +1383,12 @@ mail_autoreceive_init (EMailBackend *backend)
/* 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
-mail_receive_account (EMailSession *session,
+mail_receive_account (EMailBackend *backend,
EAccount *account)
{
struct _send_info *info;
struct _send_data *data;
+ EMailSession *session;
CamelFolder *local_outbox;
CamelService *service;
CamelURL *url;
@@ -1394,7 +1411,7 @@ mail_receive_account (EMailSession *session,
info = g_malloc0 (sizeof (*info));
info->type = type;
- info->session = g_object_ref (session);
+ info->backend = g_object_ref (backend);
info->progress_bar = NULL;
info->status_label = NULL;
info->service_uid = g_strdup (account->uid);
@@ -1413,6 +1430,8 @@ mail_receive_account (EMailSession *session,
g_hash_table_insert (data->active, account->uid, info);
+ session = e_mail_backend_get_session (backend);
+
service = camel_session_get_service (
CAMEL_SESSION (session), account->uid);
@@ -1434,7 +1453,7 @@ mail_receive_account (EMailSession *session,
local_outbox = e_mail_local_get_folder (
E_MAIL_LOCAL_FOLDER_OUTBOX);
mail_send_queue (
- info->session,
+ info->backend,
local_outbox,
CAMEL_TRANSPORT (service),
E_FILTER_SOURCE_OUTGOING,
@@ -1452,10 +1471,11 @@ mail_receive_account (EMailSession *session,
}
void
-mail_send (EMailSession *session)
+mail_send (EMailBackend *backend)
{
CamelFolder *local_outbox;
CamelService *service;
+ EMailSession *session;
EAccount *account;
CamelURL *url;
struct _send_info *info;
@@ -1490,7 +1510,7 @@ mail_send (EMailSession *session)
info = g_malloc0 (sizeof (*info));
info->type = SEND_SEND;
- info->session = g_object_ref (session);
+ info->backend = g_object_ref (backend);
info->progress_bar = NULL;
info->status_label = NULL;
info->service_uid = g_strdup (transport_uid);
@@ -1508,6 +1528,8 @@ mail_send (EMailSession *session)
/* todo, store the folder in info? */
local_outbox = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_OUTBOX);
+ session = e_mail_backend_get_session (backend);
+
service = camel_session_get_service (
CAMEL_SESSION (session), transport_uid);
@@ -1516,7 +1538,7 @@ mail_send (EMailSession *session)
g_return_if_fail (CAMEL_IS_TRANSPORT (service));
mail_send_queue (
- session, local_outbox,
+ backend, local_outbox,
CAMEL_TRANSPORT (service),
E_FILTER_SOURCE_OUTGOING,
info->cancellable,
diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h
index 5da6599712..f702b74d7a 100644
--- a/mail/mail-send-recv.h
+++ b/mail/mail-send-recv.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
/* send/receive all uri's */
GtkWidget * mail_send_receive (GtkWindow *parent,
- EMailSession *session);
+ EMailBackend *backend);
GtkWidget * mail_receive (GtkWindow *parent,
- EMailSession *session);
+ EMailBackend *backend);
/* receive a single account */
-void mail_receive_account (EMailSession *session,
+void mail_receive_account (EMailBackend *backend,
EAccount *account);
-void mail_send (EMailSession *session);
+void mail_send (EMailBackend *backend);
/* setup auto receive stuff */
void mail_autoreceive_init (EMailBackend *backend);
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 78d0863e0c..c1e451d04c 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -1161,7 +1161,7 @@ vfolder_load_storage (EMailBackend *backend)
G_CALLBACK (context_rule_removed), context);
/* load store to mail component */
- e_mail_store_add (session, vfolder_store);
+ e_mail_store_add (backend, vfolder_store);
/* and setup the rules we have */
rule = NULL;
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index f32b4ce688..006cc559a4 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -540,5 +540,10 @@ An mbox account will be created to preserve the old mbox folders. You can delete
<_secondary>The reported error was &quot;{0}&quot;.</_secondary>
</error>
+ <error id="blacklisted-file" type="warning">
+ <_primary>Hidden file is attached.</_primary>
+ <_secondary xml:space="preserve">The attachment named {0} is a hidden file and may contain sensitive data. Please review it before sending.</_secondary>
+ </error>
+
</error-list>
diff --git a/mail/message-list.c b/mail/message-list.c
index cd44b9506a..603fc71d89 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -3332,7 +3332,7 @@ build_tree (MessageList *ml,
#endif
if (!saveuid && ml->cursor_uid && g_hash_table_lookup (ml->uid_nodemap, ml->cursor_uid)) {
/* this makes sure a visible node is selected, like when
- collapsing all nodes and a children had been selected
+ * collapsing all nodes and a children had been selected
*/
saveuid = g_strdup (ml->cursor_uid);
}
@@ -4125,7 +4125,7 @@ on_click (ETree *tree,
CamelMessageInfo *info;
gboolean folder_is_trash;
const gchar *uid;
- gint flag;
+ gint flag = 0;
guint32 flags;
if (col == COL_MESSAGE_STATUS)