[evolution-data-server/gnome-40] Camel: Fails to filter unread junk messages in a virtual Junk folder



commit 3f6c2c3c7480964b18d02acbc48cfa29f362b154
Author: Milan Crha <mcrha redhat com>
Date:   Wed Mar 24 09:46:04 2021 +0100

    Camel: Fails to filter unread junk messages in a virtual Junk folder
    
    There used to be used the 'read' column to pick read/unread messages,
    but this column is used differently, it doesn't reflect the 'seen'
    flag in the 'flags' for junk and deleted messages, because it's used
    for the unread counts on the folders. Use the 'flags' column directly,
    instead of the 'read' column, to get proper value.

 src/camel/camel-search-sql-sexp.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/camel/camel-search-sql-sexp.c b/src/camel/camel-search-sql-sexp.c
index d2bfb66fe..288aab7ab 100644
--- a/src/camel/camel-search-sql-sexp.c
+++ b/src/camel/camel-search-sql-sexp.c
@@ -602,7 +602,13 @@ system_flag (struct _CamelSExp *f,
                        tstr = g_strdup ("unknown");
                }
 
-               r->value.string = g_strdup_printf ("(%s = 1)", tstr);
+               if (g_ascii_strcasecmp (tstr, "read") == 0) {
+                       /* The 'read' column is different, it covers also Junk and Deleted flags,
+                          to not count them for the real folders, thus check the flags directly. */
+                       r->value.string = g_strdup_printf ("((flags & 0x%x) != 0)", CAMEL_MESSAGE_SEEN);
+               } else {
+                       r->value.string = g_strdup_printf ("(%s = 1)", tstr);
+               }
                g_free (tstr);
        }
 


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