|
|
6bbc61 |
diff -up evolution-data-server-3.8.5/camel/camel-folder-summary.c.imapx-message-flags evolution-data-server-3.8.5/camel/camel-folder-summary.c
|
|
|
6bbc61 |
--- evolution-data-server-3.8.5/camel/camel-folder-summary.c.imapx-message-flags 2013-08-02 16:56:47.000000000 +0200
|
|
|
6bbc61 |
+++ evolution-data-server-3.8.5/camel/camel-folder-summary.c 2014-01-30 12:01:15.998935449 +0100
|
|
|
6bbc61 |
@@ -2011,12 +2011,29 @@ perform_content_info_load_from_db (Camel
|
|
|
6bbc61 |
}
|
|
|
6bbc61 |
|
|
|
6bbc61 |
static void
|
|
|
6bbc61 |
-append_changed_uids (gchar *key,
|
|
|
6bbc61 |
- CamelMessageInfoBase *info,
|
|
|
6bbc61 |
- GPtrArray *array)
|
|
|
6bbc61 |
+gather_dirty_uids (gpointer key,
|
|
|
6bbc61 |
+ gpointer value,
|
|
|
6bbc61 |
+ gpointer user_data)
|
|
|
6bbc61 |
{
|
|
|
6bbc61 |
- if (info->dirty || info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED)
|
|
|
6bbc61 |
- g_ptr_array_add (array, (gpointer) camel_pstring_strdup ((camel_message_info_uid (info))));
|
|
|
6bbc61 |
+ const gchar *uid = key;
|
|
|
6bbc61 |
+ CamelMessageInfoBase *info = value;
|
|
|
6bbc61 |
+ GHashTable *hash = user_data;
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
+ if (info->dirty)
|
|
|
6bbc61 |
+ g_hash_table_insert (hash, (gpointer) camel_pstring_strdup (uid), GINT_TO_POINTER (1));
|
|
|
6bbc61 |
+}
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
+static void
|
|
|
6bbc61 |
+gather_changed_uids (gpointer key,
|
|
|
6bbc61 |
+ gpointer value,
|
|
|
6bbc61 |
+ gpointer user_data)
|
|
|
6bbc61 |
+{
|
|
|
6bbc61 |
+ const gchar *uid = key;
|
|
|
6bbc61 |
+ guint32 flags = GPOINTER_TO_UINT (value);
|
|
|
6bbc61 |
+ GHashTable *hash = user_data;
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
+ if ((flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0)
|
|
|
6bbc61 |
+ g_hash_table_insert (hash, (gpointer) camel_pstring_strdup (uid), GINT_TO_POINTER (1));
|
|
|
6bbc61 |
}
|
|
|
6bbc61 |
|
|
|
6bbc61 |
/**
|
|
|
6bbc61 |
@@ -2027,16 +2044,21 @@ append_changed_uids (gchar *key,
|
|
|
6bbc61 |
GPtrArray *
|
|
|
6bbc61 |
camel_folder_summary_get_changed (CamelFolderSummary *summary)
|
|
|
6bbc61 |
{
|
|
|
6bbc61 |
- GPtrArray *res = g_ptr_array_new ();
|
|
|
6bbc61 |
-
|
|
|
6bbc61 |
- /* FIXME[disk-summary] sucks, this function returns from memory.
|
|
|
6bbc61 |
- * We need to have collate or something to get the modified ones
|
|
|
6bbc61 |
- * from DB and merge */
|
|
|
6bbc61 |
+ GPtrArray *res;
|
|
|
6bbc61 |
+ GHashTable *hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, (GDestroyNotify) camel_pstring_free, NULL);
|
|
|
6bbc61 |
|
|
|
6bbc61 |
camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
|
|
|
6bbc61 |
- g_hash_table_foreach (summary->priv->loaded_infos, (GHFunc) append_changed_uids, res);
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
+ g_hash_table_foreach (summary->priv->loaded_infos, gather_dirty_uids, hash);
|
|
|
6bbc61 |
+ g_hash_table_foreach (summary->priv->uids, gather_changed_uids, hash);
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
+ res = g_ptr_array_sized_new (g_hash_table_size (hash));
|
|
|
6bbc61 |
+ g_hash_table_foreach (hash, folder_summary_dupe_uids_to_array, res);
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
|
|
|
6bbc61 |
|
|
|
6bbc61 |
+ g_hash_table_destroy (hash);
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
return res;
|
|
|
6bbc61 |
}
|
|
|
6bbc61 |
|
|
|
6bbc61 |
diff -up evolution-data-server-3.8.5/camel/camel-imapx-server.c.imapx-message-flags evolution-data-server-3.8.5/camel/camel-imapx-server.c
|
|
|
6bbc61 |
--- evolution-data-server-3.8.5/camel/camel-imapx-server.c.imapx-message-flags 2014-01-30 12:01:15.989935450 +0100
|
|
|
6bbc61 |
+++ evolution-data-server-3.8.5/camel/camel-imapx-server.c 2014-01-30 12:02:29.616932482 +0100
|
|
|
6bbc61 |
@@ -6898,7 +6898,12 @@ imapx_parser_thread (gpointer d)
|
|
|
6bbc61 |
GError *local_error = NULL;
|
|
|
6bbc61 |
|
|
|
6bbc61 |
QUEUE_LOCK (is);
|
|
|
6bbc61 |
- cancellable = camel_operation_new ();
|
|
|
6bbc61 |
+ /* Do not use CamelOperation here, because it can be cancelled at
|
|
|
6bbc61 |
+ an application end with camel_operation_cancel_all() call, which
|
|
|
6bbc61 |
+ is done too early, before any pending jobs are properly finished
|
|
|
6bbc61 |
+ (it can be IDLE job, or save of folder changes back to the server).
|
|
|
6bbc61 |
+ */
|
|
|
6bbc61 |
+ cancellable = g_cancellable_new ();
|
|
|
6bbc61 |
is->cancellable = g_object_ref (cancellable);
|
|
|
6bbc61 |
QUEUE_UNLOCK (is);
|
|
|
6bbc61 |
|
|
|
6bbc61 |
@@ -7715,6 +7720,40 @@ imapx_sync_free_user (GArray *user_set)
|
|
|
6bbc61 |
g_array_free (user_set, TRUE);
|
|
|
6bbc61 |
}
|
|
|
6bbc61 |
|
|
|
6bbc61 |
+static void
|
|
|
6bbc61 |
+imapx_unset_folder_flagged_flag (CamelFolderSummary *summary,
|
|
|
6bbc61 |
+ GPtrArray *changed_uids)
|
|
|
6bbc61 |
+{
|
|
|
6bbc61 |
+ CamelMessageInfo *info;
|
|
|
6bbc61 |
+ gboolean changed = FALSE;
|
|
|
6bbc61 |
+ gint ii;
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
+ g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
|
|
|
6bbc61 |
+ g_return_if_fail (changed_uids != NULL);
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
+ for (ii = 0; ii < changed_uids->len; ii++) {
|
|
|
6bbc61 |
+ info = camel_folder_summary_get (summary, changed_uids->pdata[ii]);
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
+ if (info) {
|
|
|
6bbc61 |
+ CamelMessageInfoBase *mi = (CamelMessageInfoBase *) info;
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
+ /* some infos could be only 'dirty' (needed to save into summary) */
|
|
|
6bbc61 |
+ if ((mi->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0) {
|
|
|
6bbc61 |
+ mi->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
|
|
|
6bbc61 |
+ mi->dirty = TRUE;
|
|
|
6bbc61 |
+ changed = TRUE;
|
|
|
6bbc61 |
+ }
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
+ camel_message_info_free (info);
|
|
|
6bbc61 |
+ }
|
|
|
6bbc61 |
+ }
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
+ if (changed) {
|
|
|
6bbc61 |
+ camel_folder_summary_touch (summary);
|
|
|
6bbc61 |
+ camel_folder_summary_save_to_db (summary, NULL);
|
|
|
6bbc61 |
+ }
|
|
|
6bbc61 |
+}
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
static gboolean
|
|
|
6bbc61 |
imapx_server_sync_changes (CamelIMAPXServer *is,
|
|
|
6bbc61 |
CamelFolder *folder,
|
|
|
6bbc61 |
@@ -7873,6 +7912,7 @@ imapx_server_sync_changes (CamelIMAPXSer
|
|
|
6bbc61 |
if (nothing_to_do) {
|
|
|
6bbc61 |
imapx_sync_free_user (on_user);
|
|
|
6bbc61 |
imapx_sync_free_user (off_user);
|
|
|
6bbc61 |
+ imapx_unset_folder_flagged_flag (folder->summary, changed_uids);
|
|
|
6bbc61 |
camel_folder_free_uids (folder, changed_uids);
|
|
|
6bbc61 |
return TRUE;
|
|
|
6bbc61 |
}
|
|
|
6bbc61 |
diff -up evolution-data-server-3.8.5/camel/camel-imapx-utils.c.imapx-message-flags evolution-data-server-3.8.5/camel/camel-imapx-utils.c
|
|
|
6bbc61 |
--- evolution-data-server-3.8.5/camel/camel-imapx-utils.c.imapx-message-flags 2014-01-30 12:01:15.996935450 +0100
|
|
|
6bbc61 |
+++ evolution-data-server-3.8.5/camel/camel-imapx-utils.c 2014-01-30 12:01:15.999935449 +0100
|
|
|
6bbc61 |
@@ -257,6 +257,15 @@ imapx_update_message_info_flags (CamelMe
|
|
|
6bbc61 |
gboolean changed = FALSE;
|
|
|
6bbc61 |
CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) info;
|
|
|
6bbc61 |
|
|
|
6bbc61 |
+ /* This makes sure that server flags has precedence from locally stored flags,
|
|
|
6bbc61 |
+ thus a user actually sees what is stored on the server, but only if the message
|
|
|
6bbc61 |
+ was not changed locally and is ready to be saved */
|
|
|
6bbc61 |
+ if (!(camel_message_info_flags (info) & CAMEL_MESSAGE_FOLDER_FLAGGED) &&
|
|
|
6bbc61 |
+ (camel_message_info_flags (info) & CAMEL_IMAPX_SERVER_FLAGS) != (server_flags & CAMEL_IMAPX_SERVER_FLAGS)) {
|
|
|
6bbc61 |
+ xinfo->server_flags = (xinfo->server_flags & ~CAMEL_IMAPX_SERVER_FLAGS) |
|
|
|
6bbc61 |
+ (camel_message_info_flags (info) & CAMEL_IMAPX_SERVER_FLAGS);
|
|
|
6bbc61 |
+ }
|
|
|
6bbc61 |
+
|
|
|
6bbc61 |
if (server_flags != xinfo->server_flags) {
|
|
|
6bbc61 |
guint32 server_set, server_cleared;
|
|
|
6bbc61 |
|