[evolution-data-server] CamelFolderSummary: Hide empty email address in user visible strings



commit daae2d0c4bb4a0290c6ef9c4d113bc1a1c5e1e52
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jul 11 11:40:26 2022 +0200

    CamelFolderSummary: Hide empty email address in user visible strings
    
    Let an empty email address, which constructs string like "user <>",
    be removed from the string, because it looks odd in the UI.

 src/camel/camel-folder-summary.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/camel/camel-folder-summary.c b/src/camel/camel-folder-summary.c
index 8a8a9ba96..1cc49c129 100644
--- a/src/camel/camel-folder-summary.c
+++ b/src/camel/camel-folder-summary.c
@@ -2909,6 +2909,13 @@ summary_format_address (const CamelNameValueArray *headers,
        if ((addr = camel_header_address_decode (text, charset))) {
                str = camel_header_address_list_format (addr);
                camel_header_address_list_clear (&addr);
+
+               /* Special-case empty email part only here, not in the camel_header_address_list_format(),
+                  to cover only the user-visible string, which looks odd with the empty email address. */
+               if (str && g_str_has_suffix (str, " <>") && strlen (str) > 3) {
+                       str[strlen (str) - 3] = '\0';
+               }
+
                g_free (text);
        } else {
                str = text;


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