[evolution-data-server] [IMAPx] Do not change Sent folder for GMail in initial setup
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] [IMAPx] Do not change Sent folder for GMail in initial setup
- Date: Wed, 30 Mar 2016 20:25:47 +0000 (UTC)
commit 9a22c22267fb95094788d9d7ed627b352dc50f1e
Author: Milan Crha <mcrha redhat com>
Date: Wed Mar 30 22:22:56 2016 +0200
[IMAPx] Do not change Sent folder for GMail in initial setup
GMail stores sent messages on the server side automatically, thus
saving a sent message there would make only doubled copies of that
message on the server. This doesn't change the Sent folder at all,
thus if users have it already set to the server, or anywhere else,
then the setting is preserved.
camel/providers/imapx/camel-imapx-store.c | 38 +++++++++++++++++++++++++---
1 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
index 498f79f..9d900e3 100644
--- a/camel/providers/imapx/camel-imapx-store.c
+++ b/camel/providers/imapx/camel-imapx-store.c
@@ -2258,6 +2258,32 @@ exit:
return success;
}
+static gboolean
+imapx_is_gmail_server (CamelService *service)
+{
+ CamelSettings *settings;
+ gboolean is_gmail = FALSE;
+
+ g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
+
+ settings = camel_service_ref_settings (service);
+ if (CAMEL_IS_NETWORK_SETTINGS (settings)) {
+ gchar *host;
+
+ host = camel_network_settings_dup_host (CAMEL_NETWORK_SETTINGS (settings));
+
+ is_gmail = host && (
+ camel_strstrcase (host, ".gmail.com") != NULL ||
+ camel_strstrcase (host, ".googlemail.com") != NULL);
+
+ g_free (host);
+ }
+
+ g_clear_object (&settings);
+
+ return is_gmail;
+}
+
static gchar *
imapx_find_folder_for_initial_setup (CamelFolderInfo *root,
const gchar *path)
@@ -2508,10 +2534,14 @@ imapx_initial_setup_sync (CamelStore *store,
CAMEL_STORE_SETUP_ARCHIVE_FOLDER, NULL, NULL,
archive_names, G_N_ELEMENTS (archive_names));
- imapx_check_initial_setup_group (imapx_store, finfo, save_setup,
- CAMEL_IMAPX_LIST_ATTR_SENT,
- CAMEL_STORE_SETUP_SENT_FOLDER, NULL, NULL,
- sent_names, G_N_ELEMENTS (sent_names));
+ /* Skip changing Sent folder for GMail, because GMail stores sent messages
+ automatically, thus it would make doubled copies on the server. */
+ if (!imapx_is_gmail_server (CAMEL_SERVICE (store))) {
+ imapx_check_initial_setup_group (imapx_store, finfo, save_setup,
+ CAMEL_IMAPX_LIST_ATTR_SENT,
+ CAMEL_STORE_SETUP_SENT_FOLDER, NULL, NULL,
+ sent_names, G_N_ELEMENTS (sent_names));
+ }
/* It's a folder path inside the account, thus not use the 'f' type, but the 's' type. */
imapx_check_initial_setup_group (imapx_store, finfo, save_setup,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]