[evolution-mapi] Bug 592057 - Headers missing, Date: header corrupt



commit 57fd0588664264efaff38e9d4db170390f108d0f
Author: Johnny Jacob <jjohnny novell com>
Date:   Tue Aug 25 17:00:13 2009 +0530

    Bug 592057 - Headers missing, Date: header corrupt
    
    Camel : Use PR_TRANSPORT_MESSAGE_HEADERS.

 src/camel/ChangeLog           |    6 ++++++
 src/camel/camel-mapi-folder.c |   27 +++++++++++++++++++++++----
 src/camel/camel-mapi-folder.h |    1 +
 3 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/src/camel/ChangeLog b/src/camel/ChangeLog
index 380534b..7ce1d8a 100644
--- a/src/camel/ChangeLog
+++ b/src/camel/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-26  Johnny Jacob  <jjohnny novell com>
+
+	* camel-mapi-folder.c (mapi_msg_set_recipient_list): Avoid duplicate
+	header entries.
+	(mapi_populate_details_from_item): Use PR_TRANSPORT_MESSAGE_HEADERS.
+
 2009-08-10  Johnny Jacob  <jjohnny novell com>
 
 	* camel-mapi-provider.c (mapi_conf_entries): Removed UI entries for
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index 19aeaf9..1cc50fe 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -266,6 +266,9 @@ read_item_common (MapiItem *item, uint32_t ulPropTag, gconstpointer prop_data)
 	case PR_IN_REPLY_TO_ID:
 		item->header.in_reply_to = g_strdup (prop_data);
 		break;
+	case PR_TRANSPORT_MESSAGE_HEADERS:
+		item->header.transport_headers = utf8tolinux (prop_data);
+		break;
 	default:
 		found = FALSE;
 		break;
@@ -953,7 +956,8 @@ mapi_refresh_folder(CamelFolder *folder, CamelException *ex)
 		PR_IN_REPLY_TO_ID,
 		PR_DISPLAY_TO,
 		PR_DISPLAY_CC,
-		PR_DISPLAY_BCC
+		PR_DISPLAY_BCC,
+		PR_TRANSPORT_MESSAGE_HEADERS
 	};
 
 	if (((CamelOfflineStore *) mapi_store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
@@ -1081,6 +1085,7 @@ static const uint32_t camel_GetPropsList[] = {
 	PR_MID, 
 	PR_INTERNET_CPID,
 
+	PR_TRANSPORT_MESSAGE_HEADERS,
 	PR_MESSAGE_CLASS, 
 	PR_MESSAGE_CLASS_UNICODE, 
 	PR_MESSAGE_SIZE, 
@@ -1368,7 +1373,7 @@ mapi_msg_set_recipient_list (CamelMimeMessage *msg, MapiItem *item)
 	}
 	
 	/*Add to message*/
-	camel_mime_message_set_recipients(msg, "To", to_addr);
+	/*Note : To field is added from PR_TRANSPORT_MESSAGE_HEADERS*/
 	camel_mime_message_set_recipients(msg, "Cc", cc_addr);
 	camel_mime_message_set_recipients(msg, "Bcc", bcc_addr);
 
@@ -1384,10 +1389,24 @@ mapi_populate_details_from_item (CamelFolder *folder, CamelMimeMessage *msg, Map
 	time_t recieved_time;
 	CamelInternetAddress *addr = NULL;
 	CamelMapiStore *mapi_store = CAMEL_MAPI_STORE(folder->parent_store);
-
+	struct _camel_header_raw *headers = NULL;
+	gchar **header_list = NULL;
 	int offset = 0;
+	guint i;
 	time_t actual_time;
 
+	/* Setting headers from PR_TRANSPORT_MESSAGE_HEADERS */
+	
+	header_list = g_strsplit (item->header.transport_headers, "\n", i);
+	for (i = 0; header_list [i]; i++)
+		camel_header_raw_append_parse (&headers, header_list[i], -1);
+
+	while (headers->next) {
+		camel_medium_add_header (CAMEL_MEDIUM (msg), headers->name, headers->value);
+		headers = headers->next ;
+	}
+
+	/* Overwrite headers if we have specific properties available*/
 	temp_str = item->header.subject;
 	if(temp_str) 
 		camel_mime_message_set_subject (msg, temp_str);
@@ -1395,7 +1414,7 @@ mapi_populate_details_from_item (CamelFolder *folder, CamelMimeMessage *msg, Map
 	recieved_time = item->header.recieved_time;
 
 	actual_time = camel_header_decode_date (ctime(&recieved_time), &offset);
-	camel_mime_message_set_date (msg, actual_time, offset);
+	/* camel_mime_message_set_date (msg, actual_time, offset); */
 
 	if (item->header.from) {
 		if ((item->header.from_type != NULL) && !g_utf8_collate (item->header.from_type, "EX")) {
diff --git a/src/camel/camel-mapi-folder.h b/src/camel/camel-mapi-folder.h
index b2c2ccb..b3b003a 100644
--- a/src/camel/camel-mapi-folder.h
+++ b/src/camel/camel-mapi-folder.h
@@ -78,6 +78,7 @@ typedef struct {
 	time_t recieved_time;
 	time_t send_time;
 	guint cpid; /* codepage id */
+	gchar *transport_headers;
 } MapiItemHeader;
 
 typedef struct {



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