|
|
5e6360 |
diff -up evolution-data-server-3.12.11/camel/providers/imapx/camel-imapx-store.c.camel-imapx-folder-removed-on-refresh evolution-data-server-3.12.11/camel/providers/imapx/camel-imapx-store.c
|
|
|
5e6360 |
--- evolution-data-server-3.12.11/camel/providers/imapx/camel-imapx-store.c.camel-imapx-folder-removed-on-refresh 2015-07-24 13:52:20.253840769 +0200
|
|
|
5e6360 |
+++ evolution-data-server-3.12.11/camel/providers/imapx/camel-imapx-store.c 2015-07-24 13:52:20.266840678 +0200
|
|
|
5e6360 |
@@ -468,7 +468,7 @@ imapx_store_process_mailbox_attributes (
|
|
|
5e6360 |
fi = imapx_store_build_folder_info (store, folder_path, flags);
|
|
|
5e6360 |
|
|
|
5e6360 |
/* Figure out which signals to emit, if any. */
|
|
|
5e6360 |
- if (use_subscriptions) {
|
|
|
5e6360 |
+ if (use_subscriptions || camel_imapx_namespace_get_category (camel_imapx_mailbox_get_namespace (mailbox)) != CAMEL_IMAPX_NAMESPACE_PERSONAL) {
|
|
|
5e6360 |
/* If we are honoring folder subscriptions, then
|
|
|
5e6360 |
* subscription changes are equivalent to folder
|
|
|
5e6360 |
* creation / deletion as far as we're concerned. */
|
|
|
5e6360 |
@@ -1079,6 +1079,20 @@ get_folder_info_offline (CamelStore *sto
|
|
|
5e6360 |
if (!si_is_match)
|
|
|
5e6360 |
continue;
|
|
|
5e6360 |
|
|
|
5e6360 |
+ if (!use_subscriptions && !(si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) &&
|
|
|
5e6360 |
+ !(flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST)) {
|
|
|
5e6360 |
+ CamelIMAPXMailbox *mailbox;
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ mailbox = camel_imapx_store_ref_mailbox (imapx_store, ((CamelIMAPXStoreInfo *) si)->mailbox_name);
|
|
|
5e6360 |
+ if (!mailbox || camel_imapx_namespace_get_category (camel_imapx_mailbox_get_namespace (mailbox)) != CAMEL_IMAPX_NAMESPACE_PERSONAL) {
|
|
|
5e6360 |
+ /* Skip unsubscribed mailboxes which are not in the Personal namespace */
|
|
|
5e6360 |
+ g_clear_object (&mailbox);
|
|
|
5e6360 |
+ continue;
|
|
|
5e6360 |
+ }
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ g_clear_object (&mailbox);
|
|
|
5e6360 |
+ }
|
|
|
5e6360 |
+
|
|
|
5e6360 |
fi = imapx_store_build_folder_info (
|
|
|
5e6360 |
imapx_store, folder_path, 0);
|
|
|
5e6360 |
fi->unread = si->unread;
|
|
|
5e6360 |
@@ -1417,6 +1431,58 @@ imapx_store_remove_unknown_mailboxes_cb
|
|
|
5e6360 |
}
|
|
|
5e6360 |
|
|
|
5e6360 |
static gboolean
|
|
|
5e6360 |
+imapx_store_mailbox_is_unknown (CamelIMAPXStore *imapx_store,
|
|
|
5e6360 |
+ GPtrArray *store_infos,
|
|
|
5e6360 |
+ const CamelIMAPXStoreInfo *to_check)
|
|
|
5e6360 |
+{
|
|
|
5e6360 |
+ CamelIMAPXMailbox *mailbox;
|
|
|
5e6360 |
+ gboolean is_unknown;
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ g_return_val_if_fail (CAMEL_IS_IMAPX_STORE (imapx_store), FALSE);
|
|
|
5e6360 |
+ g_return_val_if_fail (store_infos != NULL, FALSE);
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ if (!to_check || !to_check->mailbox_name || !*to_check->mailbox_name)
|
|
|
5e6360 |
+ return FALSE;
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ mailbox = camel_imapx_store_ref_mailbox (imapx_store, to_check->mailbox_name);
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ is_unknown = mailbox && camel_imapx_mailbox_get_state (mailbox) == CAMEL_IMAPX_MAILBOX_STATE_UNKNOWN;
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ if (!mailbox && to_check->separator) {
|
|
|
5e6360 |
+ CamelSettings *settings;
|
|
|
5e6360 |
+ gboolean use_subscriptions;
|
|
|
5e6360 |
+ gchar *mailbox_with_separator;
|
|
|
5e6360 |
+ gint ii;
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ settings = camel_service_ref_settings (CAMEL_SERVICE (imapx_store));
|
|
|
5e6360 |
+ use_subscriptions = camel_imapx_settings_get_use_subscriptions (CAMEL_IMAPX_SETTINGS (settings));
|
|
|
5e6360 |
+ g_object_unref (settings);
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ mailbox_with_separator = g_strdup_printf ("%s%c", to_check->mailbox_name, to_check->separator);
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ for (ii = 0; ii < store_infos->len; ii++) {
|
|
|
5e6360 |
+ CamelIMAPXStoreInfo *si;
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ si = g_ptr_array_index (store_infos, ii);
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ if (si->mailbox_name && g_str_has_prefix (si->mailbox_name, mailbox_with_separator) && (
|
|
|
5e6360 |
+ !use_subscriptions || (((CamelStoreInfo *) si)->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) != 0)) {
|
|
|
5e6360 |
+ /* This can be a 'virtual' parent folder of some subscribed subfolder */
|
|
|
5e6360 |
+ break;
|
|
|
5e6360 |
+ }
|
|
|
5e6360 |
+ }
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ is_unknown = ii == store_infos->len;
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ g_free (mailbox_with_separator);
|
|
|
5e6360 |
+ }
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ g_clear_object (&mailbox);
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ return is_unknown;
|
|
|
5e6360 |
+}
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+static gboolean
|
|
|
5e6360 |
sync_folders (CamelIMAPXStore *imapx_store,
|
|
|
5e6360 |
const gchar *root_folder_path,
|
|
|
5e6360 |
CamelStoreGetFolderInfoFlags flags,
|
|
|
5e6360 |
@@ -1426,8 +1492,7 @@ sync_folders (CamelIMAPXStore *imapx_sto
|
|
|
5e6360 |
{
|
|
|
5e6360 |
CamelIMAPXServer *server;
|
|
|
5e6360 |
GHashTable *folder_info_results;
|
|
|
5e6360 |
- GPtrArray *array;
|
|
|
5e6360 |
- guint ii;
|
|
|
5e6360 |
+ gboolean update_folder_list;
|
|
|
5e6360 |
gboolean success;
|
|
|
5e6360 |
|
|
|
5e6360 |
server = camel_imapx_store_ref_server (imapx_store, NULL, FALSE, cancellable, error);
|
|
|
5e6360 |
@@ -1445,7 +1510,9 @@ sync_folders (CamelIMAPXStore *imapx_sto
|
|
|
5e6360 |
* in imapx_store_process_mailbox_attributes(). */
|
|
|
5e6360 |
g_atomic_int_inc (&imapx_store->priv->syncing_folders);
|
|
|
5e6360 |
|
|
|
5e6360 |
- if (!initial_setup && (!root_folder_path || !*root_folder_path)) {
|
|
|
5e6360 |
+ update_folder_list = !initial_setup && (!root_folder_path || !*root_folder_path);
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ if (update_folder_list) {
|
|
|
5e6360 |
g_mutex_lock (&imapx_store->priv->mailboxes_lock);
|
|
|
5e6360 |
g_hash_table_foreach (imapx_store->priv->mailboxes, imapx_store_mark_mailbox_unknown_cb, imapx_store);
|
|
|
5e6360 |
g_mutex_unlock (&imapx_store->priv->mailboxes_lock);
|
|
|
5e6360 |
@@ -1458,9 +1525,9 @@ sync_folders (CamelIMAPXStore *imapx_sto
|
|
|
5e6360 |
} else {
|
|
|
5e6360 |
gboolean have_folder_info_for_inbox;
|
|
|
5e6360 |
|
|
|
5e6360 |
- /* XXX We only fetch personal mailboxes at this time. */
|
|
|
5e6360 |
success = fetch_folder_info_for_namespace_category (
|
|
|
5e6360 |
- imapx_store, server, CAMEL_IMAPX_NAMESPACE_PERSONAL, flags,
|
|
|
5e6360 |
+ imapx_store, server, CAMEL_IMAPX_NAMESPACE_PERSONAL, flags |
|
|
|
5e6360 |
+ (update_folder_list ? CAMEL_STORE_FOLDER_INFO_SUBSCRIBED : 0),
|
|
|
5e6360 |
folder_info_results, cancellable, error);
|
|
|
5e6360 |
|
|
|
5e6360 |
have_folder_info_for_inbox =
|
|
|
5e6360 |
@@ -1481,53 +1548,41 @@ sync_folders (CamelIMAPXStore *imapx_sto
|
|
|
5e6360 |
if (!success)
|
|
|
5e6360 |
goto exit;
|
|
|
5e6360 |
|
|
|
5e6360 |
- if (!initial_setup && (!root_folder_path || !*root_folder_path)) {
|
|
|
5e6360 |
+ if (update_folder_list) {
|
|
|
5e6360 |
g_mutex_lock (&imapx_store->priv->mailboxes_lock);
|
|
|
5e6360 |
g_hash_table_foreach_remove (imapx_store->priv->mailboxes, imapx_store_remove_unknown_mailboxes_cb, imapx_store);
|
|
|
5e6360 |
g_mutex_unlock (&imapx_store->priv->mailboxes_lock);
|
|
|
5e6360 |
}
|
|
|
5e6360 |
|
|
|
5e6360 |
- array = camel_store_summary_array (imapx_store->summary);
|
|
|
5e6360 |
-
|
|
|
5e6360 |
- for (ii = 0; ii < array->len; ii++) {
|
|
|
5e6360 |
- CamelStoreInfo *si;
|
|
|
5e6360 |
- CamelFolderInfo *fi;
|
|
|
5e6360 |
- const gchar *mailbox_name;
|
|
|
5e6360 |
- const gchar *si_path;
|
|
|
5e6360 |
- gboolean pattern_match;
|
|
|
5e6360 |
-
|
|
|
5e6360 |
- si = g_ptr_array_index (array, ii);
|
|
|
5e6360 |
- si_path = camel_store_info_path (imapx_store->summary, si);
|
|
|
5e6360 |
-
|
|
|
5e6360 |
- mailbox_name = ((CamelIMAPXStoreInfo *) si)->mailbox_name;
|
|
|
5e6360 |
- if (mailbox_name == NULL || *mailbox_name == '\0')
|
|
|
5e6360 |
- continue;
|
|
|
5e6360 |
-
|
|
|
5e6360 |
- pattern_match =
|
|
|
5e6360 |
- (root_folder_path == NULL) ||
|
|
|
5e6360 |
- (*root_folder_path == '\0') ||
|
|
|
5e6360 |
- (g_str_has_prefix (si_path, root_folder_path));
|
|
|
5e6360 |
- if (!pattern_match)
|
|
|
5e6360 |
- continue;
|
|
|
5e6360 |
-
|
|
|
5e6360 |
- fi = g_hash_table_lookup (folder_info_results, mailbox_name);
|
|
|
5e6360 |
-
|
|
|
5e6360 |
- if (fi == NULL) {
|
|
|
5e6360 |
- gchar *dup_folder_path = g_strdup (si_path);
|
|
|
5e6360 |
-
|
|
|
5e6360 |
- if (dup_folder_path != NULL) {
|
|
|
5e6360 |
- /* Do not unsubscribe from it, it influences UI for non-subscribable folders */
|
|
|
5e6360 |
- imapx_delete_folder_from_cache (
|
|
|
5e6360 |
- imapx_store, dup_folder_path, FALSE);
|
|
|
5e6360 |
- g_free (dup_folder_path);
|
|
|
5e6360 |
- } else {
|
|
|
5e6360 |
- camel_store_summary_remove (
|
|
|
5e6360 |
- imapx_store->summary, si);
|
|
|
5e6360 |
+ if (!root_folder_path || !*root_folder_path) {
|
|
|
5e6360 |
+ GPtrArray *array;
|
|
|
5e6360 |
+ guint ii;
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ /* Finally update store's summary */
|
|
|
5e6360 |
+ array = camel_store_summary_array (imapx_store->summary);
|
|
|
5e6360 |
+ for (ii = 0; array && ii < array->len; ii++) {
|
|
|
5e6360 |
+ CamelStoreInfo *si;
|
|
|
5e6360 |
+ const gchar *si_path;
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ si = g_ptr_array_index (array, ii);
|
|
|
5e6360 |
+ si_path = camel_store_info_path (imapx_store->summary, si);
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ if (imapx_store_mailbox_is_unknown (imapx_store, array, (CamelIMAPXStoreInfo *) si)) {
|
|
|
5e6360 |
+ gchar *dup_folder_path = g_strdup (si_path);
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ if (dup_folder_path != NULL) {
|
|
|
5e6360 |
+ /* Do not unsubscribe from it, it influences UI for non-subscribable folders */
|
|
|
5e6360 |
+ imapx_delete_folder_from_cache (imapx_store, dup_folder_path, FALSE);
|
|
|
5e6360 |
+ g_free (dup_folder_path);
|
|
|
5e6360 |
+ } else {
|
|
|
5e6360 |
+ camel_store_summary_remove (imapx_store->summary, si);
|
|
|
5e6360 |
+ }
|
|
|
5e6360 |
}
|
|
|
5e6360 |
}
|
|
|
5e6360 |
+
|
|
|
5e6360 |
+ camel_store_summary_array_free (imapx_store->summary, array);
|
|
|
5e6360 |
}
|
|
|
5e6360 |
|
|
|
5e6360 |
- camel_store_summary_array_free (imapx_store->summary, array);
|
|
|
5e6360 |
camel_store_summary_save (imapx_store->summary);
|
|
|
5e6360 |
|
|
|
5e6360 |
exit:
|