evolution-data-server r9598 - in trunk/camel: . providers/groupwise providers/imap



Author: mcrha
Date: Wed Sep 24 11:53:36 2008
New Revision: 9598
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9598&view=rev

Log:
2008-09-24  Milan Crha  <mcrha redhat com>

	** Part of fix for bug #313225

	* camel/providers/groupwise/camel-groupwise-folder.c: (gw_update_cache), (gw_update_summary):
	Set the user flag '$has_cal' in the message info when the message
	is type of the appointment, task or note.

	* camel/providers/imap/camel-imap-folder.c: (CAMEL_MESSAGE_INFO_HEADERS):
	Transfer always 'CONTENT-CLASS' and 'X-CALENDAR-ATTACHMENT' headers.
	
	* camel/camel-folder-summary.c: (summary_build_content_info),
	(summary_build_content_info_message): Check whether message contains
	headers indicating a calendar attachment and if so, then set the user
	flag '$has_cal' in the message info.



Modified:
   trunk/camel/ChangeLog
   trunk/camel/camel-folder-summary.c
   trunk/camel/providers/groupwise/ChangeLog
   trunk/camel/providers/groupwise/camel-groupwise-folder.c
   trunk/camel/providers/imap/ChangeLog
   trunk/camel/providers/imap/camel-imap-folder.c

Modified: trunk/camel/camel-folder-summary.c
==============================================================================
--- trunk/camel/camel-folder-summary.c	(original)
+++ trunk/camel/camel-folder-summary.c	Wed Sep 24 11:53:36 2008
@@ -3556,6 +3556,8 @@
 	struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
 	CamelMimeFilterCharset *mfc;
 	CamelMessageContentInfo *part;
+	const char *calendar_header;
+	int calendar_header_offset = -1;
 
 	d(printf("building content info\n"));
 
@@ -3578,6 +3580,21 @@
 			)
 			camel_message_info_set_flags(msginfo, CAMEL_MESSAGE_SECURE, CAMEL_MESSAGE_SECURE);
 
+		calendar_header = camel_mime_parser_header (mp, "Content-class", &calendar_header_offset);
+		if (calendar_header) {
+			while (calendar_header [calendar_header_offset] && isspace (calendar_header [calendar_header_offset]))
+				calendar_header_offset++;
+
+			if (g_ascii_strcasecmp (calendar_header + calendar_header_offset, "urn:content-classes:calendarmessage") != 0)
+				calendar_header = NULL;
+		}
+
+		if (!calendar_header)
+			calendar_header = camel_mime_parser_header (mp, "X-Calendar-Attachment", &calendar_header_offset);
+
+		if (calendar_header)
+			camel_message_info_set_user_flag (msginfo, "$has_cal", TRUE);
+
 		if (p->index && camel_content_type_is(ct, "text", "*")) {
 			char *encoding;
 			const char *charset;
@@ -3707,6 +3724,7 @@
 	struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
 	CamelMessageContentInfo *info = NULL, *child;
 	CamelContentType *ct;
+	const struct _camel_header_raw *header;
 
 	if (s->build_content)
 		info = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->content_info_new_from_message(s, object);
@@ -3736,6 +3754,22 @@
 		camel_message_info_set_flags(msginfo, CAMEL_MESSAGE_SECURE, CAMEL_MESSAGE_SECURE);
 	}
 
+	for (header = object->headers; header; header = header->next) {
+		const char *value = header->value;
+
+		/* skip preceding spaces in the value */
+		while (value && *value && isspace (*value))
+			value++;
+
+		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;
+	}
+
+	if (header)
+		camel_message_info_set_user_flag (msginfo, "$has_cal", 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));

Modified: trunk/camel/providers/groupwise/camel-groupwise-folder.c
==============================================================================
--- trunk/camel/providers/groupwise/camel-groupwise-folder.c	(original)
+++ trunk/camel/providers/groupwise/camel-groupwise-folder.c	Wed Sep 24 11:53:36 2008
@@ -1299,6 +1299,9 @@
 				mi->info.content = camel_folder_summary_content_info_new (folder->summary);
 				mi->info.content->type = camel_content_type_new ("multipart", "mixed");	
 			}
+
+			if (type == E_GW_ITEM_TYPE_APPOINTMENT || type == E_GW_ITEM_TYPE_TASK || type == E_GW_ITEM_TYPE_NOTE)
+				camel_message_info_set_user_flag ((CamelMessageInfo*)mi, "$has_cal", TRUE);
 		}
 		
 		rk = e_gw_item_get_recurrence_key (item);
@@ -1518,6 +1521,9 @@
 				mi->info.content = camel_folder_summary_content_info_new (folder->summary);
 				mi->info.content->type = camel_content_type_new ("multipart", "mixed");
 			}
+
+			if (type == E_GW_ITEM_TYPE_APPOINTMENT || type == E_GW_ITEM_TYPE_TASK || type == E_GW_ITEM_TYPE_NOTE)
+				camel_message_info_set_user_flag ((CamelMessageInfo*)mi, "$has_cal", TRUE);
 		}
 		
 		rk = e_gw_item_get_recurrence_key (item);

Modified: trunk/camel/providers/imap/camel-imap-folder.c
==============================================================================
--- trunk/camel/providers/imap/camel-imap-folder.c	(original)
+++ trunk/camel/providers/imap/camel-imap-folder.c	Wed Sep 24 11:53:36 2008
@@ -3127,7 +3127,7 @@
 	}
 }
 
-#define CAMEL_MESSAGE_INFO_HEADERS "DATE FROM TO CC SUBJECT REFERENCES IN-REPLY-TO MESSAGE-ID MIME-VERSION CONTENT-TYPE "
+#define CAMEL_MESSAGE_INFO_HEADERS "DATE FROM TO CC SUBJECT REFERENCES IN-REPLY-TO MESSAGE-ID MIME-VERSION CONTENT-TYPE CONTENT-CLASS X-CALENDAR-ATTACHMENT "
 
 /* FIXME: this needs to be kept in sync with camel-mime-utils.c's list
    of mailing-list headers and so might be best if this were



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