[evolution-data-server] Bug 255032 - Be able to write a note on a mail



commit 74e7b27453d4eaaa8c881248df4c0b043dbb297a
Author: Milan Crha <mcrha redhat com>
Date:   Mon Sep 21 16:15:04 2015 +0200

    Bug 255032 - Be able to write a note on a mail

 camel/camel-folder-summary.c              |   22 +++++++++++++++++++---
 camel/providers/imapx/camel-imapx-utils.c |    8 ++++++--
 2 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 4c3be3f..cc8f77b 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -3840,6 +3840,9 @@ summary_build_content_info (CamelFolderSummary *summary,
                if (calendar_header || camel_content_type_is (ct, "text", "calendar"))
                        camel_message_info_set_user_flag (msginfo, "$has_cal", TRUE);
 
+               if (camel_mime_parser_header (mp, "X-Evolution-Note", NULL))
+                       camel_message_info_set_user_flag (msginfo, "$has_note", TRUE);
+
                if (p->index && camel_content_type_is (ct, "text", "*")) {
                        gchar *encoding;
                        const gchar *charset;
@@ -3972,6 +3975,7 @@ summary_build_content_info_message (CamelFolderSummary *summary,
        CamelMessageContentInfo *info = NULL, *child;
        CamelContentType *ct;
        const struct _camel_header_raw *header;
+       gboolean is_calendar = FALSE, is_note = FALSE;
 
        if (summary->priv->build_content)
                info = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->content_info_new_from_message (summary, 
object);
@@ -4010,13 +4014,25 @@ summary_build_content_info_message (CamelFolderSummary *summary,
 
                if (header->name && value && (
                    (g_ascii_strcasecmp (header->name, "Content-class") == 0 && g_ascii_strcasecmp (value, 
"urn:content-classes:calendarmessage") == 0) ||
-                   (g_ascii_strcasecmp (header->name, "X-Calendar-Attachment") == 0)))
-                       break;
+                   (g_ascii_strcasecmp (header->name, "X-Calendar-Attachment") == 0))) {
+                       is_calendar = TRUE;
+                       if (is_note)
+                               break;
+               }
+
+               if (header->name && value && g_ascii_strcasecmp (header->name, "X-Evolution-Note") == 0) {
+                       is_note = TRUE;
+                       if (is_calendar)
+                               break;
+               }
        }
 
-       if (header || camel_content_type_is (ct, "text", "calendar"))
+       if (is_calendar || camel_content_type_is (ct, "text", "calendar"))
                camel_message_info_set_user_flag (msginfo, "$has_cal", TRUE);
 
+       if (is_note)
+               camel_message_info_set_user_flag (msginfo, "$has_note", TRUE);
+
        /* using the object types is more accurate than using the mime/types */
        if (CAMEL_IS_MULTIPART (containee)) {
                parts = camel_multipart_get_number (CAMEL_MULTIPART (containee));
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 574463e..67b5b52 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -277,17 +277,21 @@ imapx_update_user_flags (CamelMessageInfo *info,
        gboolean changed = FALSE;
        CamelMessageInfoBase *binfo = (CamelMessageInfoBase *) info;
        CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) info;
-       gboolean set_cal = FALSE;
+       gboolean set_cal = FALSE, set_note = FALSE;
 
        if (camel_flag_get (&binfo->user_flags, "$has_cal"))
                set_cal = TRUE;
+       if (camel_flag_get (&binfo->user_flags, "$has_note"))
+               set_note = TRUE;
 
        changed = camel_flag_list_copy (&binfo->user_flags, &server_user_flags);
        camel_flag_list_copy (&xinfo->server_user_flags, &server_user_flags);
 
-       /* reset the calendar flag if it was set in messageinfo before */
+       /* reset the flags as they were set in messageinfo before */
        if (set_cal)
                camel_flag_set (&binfo->user_flags, "$has_cal", TRUE);
+       if (set_note)
+               camel_flag_set (&binfo->user_flags, "$has_note", TRUE);
 
        return changed;
 }


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