[evolution-data-server/gnome-3-22] [IMAPx] Notify about new messages early during folder update



commit d874baa6c42b57090957ca89a198e47670a50de9
Author: Milan Crha <mcrha redhat com>
Date:   Thu Dec 1 11:54:25 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.

 camel/providers/imapx/camel-imapx-server.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 3caeb45..98fd54f 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -4988,6 +4988,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_to_db (folder->summary, 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]