[evolution-data-server] camel_flag_list_copy: Avoid false 'changed' notifications



commit b1cbe039a1225d637208b1d6d75a501bc89206bc
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 28 15:25:54 2014 +0100

    camel_flag_list_copy: Avoid false 'changed' notifications
    
    The function, as written, returned that the destination list
    changed even in cases where both flag lists were empty. This
    made for example IMAPx report that each message in a folder
    hanged, even there did not change any.

 camel/camel-folder-summary.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index e32037c..fbcc894 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -4120,7 +4120,7 @@ camel_flag_list_copy (CamelFlag **to,
                       CamelFlag **from)
 {
        CamelFlag *flag, *tmp;
-       gint changed = FALSE;
+       gboolean changed = FALSE;
 
        if (*to == NULL && from == NULL)
                return FALSE;
@@ -4130,18 +4130,20 @@ camel_flag_list_copy (CamelFlag **to,
        while (flag->next) {
                tmp = flag->next;
                if (!camel_flag_get (from, tmp->name)) {
+                       if (*tmp->name)
+                               changed = TRUE;
                        flag->next = tmp->next;
                        g_free (tmp);
-                       changed = TRUE;
                } else {
                        flag = tmp;
                }
        }
 
-       /* Add any new flags */
+       /* Add any new non-empty flags */
        flag = *from;
        while (flag) {
-               changed |= camel_flag_set (to, flag->name, TRUE);
+               if (*flag->name)
+                       changed |= camel_flag_set (to, flag->name, TRUE);
                flag = flag->next;
        }
 


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