[evolution-mapi/gnome-3-0] Bug #613147 - Recipients should not be discarded



commit ffaa230382c43fa807b3dc25cd080fd703dc8330
Author: Milan Crha <mcrha redhat com>
Date:   Thu May 5 16:28:50 2011 +0200

    Bug #613147 - Recipients should not be discarded
    
    The last fallback code for Exchange 2003 servers.

 src/libexchangemapi/exchange-mapi-mail-utils.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/libexchangemapi/exchange-mapi-mail-utils.c b/src/libexchangemapi/exchange-mapi-mail-utils.c
index 6eb2c1e..600fa83 100644
--- a/src/libexchangemapi/exchange-mapi-mail-utils.c
+++ b/src/libexchangemapi/exchange-mapi-mail-utils.c
@@ -378,6 +378,9 @@ mapi_mime_set_recipient_list (ExchangeMapiConnection *conn, CamelMimeMessage *ms
 			display_name = g_strdup (name);
 		rcpt_type = (type ? *type : MAPI_TO);
 
+		if (!display_name && (!recip->email_id || !*recip->email_id))
+			break;
+
 		switch (rcpt_type) {
 		case MAPI_TO:
 			camel_internet_address_add (to_addr, display_name, recip->email_id ? recip->email_id : "");
@@ -393,6 +396,21 @@ mapi_mime_set_recipient_list (ExchangeMapiConnection *conn, CamelMimeMessage *ms
 		g_free (display_name);
 	}
 
+	if (l != NULL) {
+		/* some recipient didn't have set email or
+		   display name, fallback to PR_DISPLAY_TO/_CC/_BCC */
+		camel_address_remove (CAMEL_ADDRESS (to_addr), -1);
+		camel_address_remove (CAMEL_ADDRESS (cc_addr), -1);
+		camel_address_remove (CAMEL_ADDRESS (bcc_addr), -1);
+
+		if (item->header.to && *item->header.to)
+			camel_address_decode (CAMEL_ADDRESS (to_addr), item->header.to);
+		if (item->header.cc && *item->header.cc)
+			camel_address_decode (CAMEL_ADDRESS (cc_addr), item->header.cc);
+		if (item->header.bcc && *item->header.bcc)
+			camel_address_decode (CAMEL_ADDRESS (bcc_addr), item->header.bcc);
+	}
+
 	/*Add to message*/
 	camel_mime_message_set_recipients (msg, "To", to_addr);
 	camel_mime_message_set_recipients (msg, "Cc", cc_addr);



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