[evolution-data-server] [IMAPx] Unnecessary local summary rewrites after folder update



commit 44d5677b6b3fec29eb561ef37767301a96f2d3e1
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 22 14:07:28 2016 +0100

    [IMAPx] Unnecessary local summary rewrites after folder update
    
    This fixes info-s re-set of the 'dirty' flag after folder update,
    when those were schedules for save to the DB only, without having
    the 'folder-flagged' flag set. Such info-s could be re-saved to
    the disk ad infinity, together with real info changes.

 src/camel/providers/imapx/camel-imapx-server.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
index 2e9bbef..a8febc3 100644
--- a/src/camel/providers/imapx/camel-imapx-server.c
+++ b/src/camel/providers/imapx/camel-imapx-server.c
@@ -5573,8 +5573,16 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                        gboolean set_folder_flagged;
                        guint32 has_flags, set_server_flags;
                        gboolean changed_meanwhile;
+                       const gchar *uid;
 
-                       info = camel_folder_summary_get (folder_summary, changed_uids->pdata[i]);
+                       uid = g_ptr_array_index (changed_uids, i);
+
+                       /* the 'stamps' hash table contains only those uid-s,
+                          which were also flagged, not only 'dirty' */
+                       if (!g_hash_table_lookup (stamps, uid))
+                               continue;
+
+                       info = camel_folder_summary_get (folder_summary, uid);
                        xinfo = info ? CAMEL_IMAPX_MESSAGE_INFO (info) : NULL;
 
                        if (!info || !xinfo) {
@@ -5585,7 +5593,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                        camel_message_info_property_lock (info);
 
                        changed_meanwhile = camel_message_info_get_folder_flagged_stamp (info) !=
-                               GPOINTER_TO_UINT (g_hash_table_lookup (stamps, changed_uids->pdata[i]));
+                               GPOINTER_TO_UINT (g_hash_table_lookup (stamps, uid));
 
                        has_flags = camel_message_info_get_flags (info);
                        set_server_flags = has_flags & CAMEL_IMAPX_SERVER_FLAGS;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]