[evolution-data-server/gnome-3-22] Bug 777781 - Unfold header values before comparing them



commit 1dd7f217420451a38cbcb528440c87d562c188bb
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 26 17:23:30 2017 +0100

    Bug 777781 - Unfold header values before comparing them

 camel/camel-search-private.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/camel/camel-search-private.c b/camel/camel-search-private.c
index d68d86f..a79fd10 100644
--- a/camel/camel-search-private.c
+++ b/camel/camel-search-private.c
@@ -443,9 +443,13 @@ camel_search_header_match (const gchar *value,
        const guchar *ptr;
        gint truth = FALSE, i;
        CamelInternetAddress *cia;
-       gchar *v, *vdom, *mdom;
+       gchar *v, *vdom, *mdom, *unfolded;
        gunichar c;
 
+       unfolded = camel_header_unfold (value);
+       if (unfolded)
+               value = unfolded;
+
        ptr = (const guchar *) value;
        while ((c = camel_utf8_getc (&ptr)) && g_unichar_isspace (c))
                value = (const gchar *) ptr;
@@ -477,8 +481,10 @@ camel_search_header_match (const gchar *value,
        case CAMEL_SEARCH_TYPE_ADDRESS_ENCODED:
        case CAMEL_SEARCH_TYPE_ADDRESS:
                /* Possible simple case to save some work if we can. */
-               if (header_match (value, match, how))
-                       return TRUE;
+               if (header_match (value, match, how)) {
+                       truth = TRUE;
+                       break;
+               }
 
                /* Now we decode any addresses, and try
                 * as-is matches on name and address parts. */
@@ -497,6 +503,8 @@ camel_search_header_match (const gchar *value,
                break;
        }
 
+       g_free (unfolded);
+
        return truth;
 }
 


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