[evolution-data-server] [IMAPx] Notify about new messages early during folder update



commit 80500711edb2c6c273516001a9cb46320050f96b
Author: Milan Crha <mcrha redhat com>
Date:   Thu Dec 1 11:47:13 2016 +0100

    [IMAPx] Notify about new messages early during folder update
    
    The folder update is split into two phases:
    a) check for newly received messages
    b) update flags of the old message and discover removed message.
    After some recent changes the notification from the first phase
    had been waiting for the completion of the second phase, which could
    also exhibit (in the Evolution) as the folder tree having unread count
    changed, but the folder content didn't show any new messages until
    the both phases finished.

 src/camel/providers/imapx/camel-imapx-server.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
index e706972..24fd413 100644
--- a/src/camel/providers/imapx/camel-imapx-server.c
+++ b/src/camel/providers/imapx/camel-imapx-server.c
@@ -4977,6 +4977,25 @@ imapx_server_fetch_changes (CamelIMAPXServer *is,
        g_slist_free_full (fetch_summary_uids, (GDestroyNotify) camel_pstring_free);
        g_hash_table_destroy (infos);
 
+       g_mutex_lock (&is->priv->changes_lock);
+
+       /* Notify about new messages, thus they are shown in the UI early. */
+       if (camel_folder_change_info_changed (is->priv->changes)) {
+               CamelFolderChangeInfo *changes;
+
+               changes = is->priv->changes;
+               is->priv->changes = camel_folder_change_info_new ();
+
+               g_mutex_unlock (&is->priv->changes_lock);
+
+               camel_folder_summary_save (camel_folder_get_folder_summary (folder), NULL);
+               imapx_update_store_summary (folder);
+               camel_folder_changed (folder, changes);
+               camel_folder_change_info_free (changes);
+       } else {
+               g_mutex_unlock (&is->priv->changes_lock);
+       }
+
        return success;
 }
 


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