[evolution] Bug #273535 - Meeting request with attachments has bogus CID value



commit e004ae81885231237cc92907dbc4fb3e50cea309
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jul 30 11:31:14 2009 +0200

    Bug #273535 - Meeting request with attachments has bogus CID value

 calendar/gui/dialogs/comp-editor.c |   24 ++++++++++++++++--------
 calendar/gui/itip-utils.c          |    6 ++++++
 calendar/gui/itip-utils.h          |    1 +
 3 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 1bd002e..6a97128 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -2516,19 +2516,24 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str
 		}
 	} else {
 		/* Clone the component with attachments set to CID:...  */
-		gint num_attachments, i;
 		GSList *attach_list = NULL;
-		GSList *mime_attach_list;
+		GSList *mime_attach_list, *attach;
 
-		num_attachments = e_cal_component_get_num_attachments (send_comp);
+		/* mime_attach_list is freed by itip_send_comp */
+		mime_attach_list = comp_editor_get_mime_attach_list (editor);
+
+		for (attach = mime_attach_list; attach; attach = attach->next) {
+			struct CalMimeAttach *cma = (struct CalMimeAttach *) attach->data;
 
-		for (i = 0; i < num_attachments; i++) {
-			attach_list = g_slist_append (attach_list, g_strdup ("CID:..."));
+			attach_list = g_slist_append (attach_list, cma->content_id);
+		}
+
+		if (attach_list) {
+			e_cal_component_set_attachment_list (send_comp, attach_list);
+
+			g_slist_free (attach_list);
 		}
-		e_cal_component_set_attachment_list (send_comp, attach_list);
 
-		/* mime_attach_list is freed by itip_send_comp */
-		mime_attach_list = comp_editor_get_mime_attach_list (editor);
 		if (itip_send_comp (method, send_comp, priv->client,
 					NULL, mime_attach_list, users, strip_alarms, priv->flags & COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY)) {
 			gboolean saved = save_comp (editor);
@@ -2734,6 +2739,8 @@ comp_editor_get_mime_attach_list (CompEditor *editor)
 		camel_data_wrapper_decode_to_stream (wrapper, (CamelStream *) mstream);
 		buffer = g_memdup (mstream->buffer->data, mstream->buffer->len);
 
+		camel_mime_part_set_content_id (mime_part, NULL);
+
 		cal_mime_attach->encoded_data = (gchar *)buffer;
 		cal_mime_attach->length = mstream->buffer->len;
 		cal_mime_attach->filename = g_strdup (camel_mime_part_get_filename (mime_part));
@@ -2742,6 +2749,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor)
 			desc = _("attachment");
 		cal_mime_attach->description = g_strdup (desc);
 		cal_mime_attach->content_type = g_strdup (camel_data_wrapper_get_mime_type (wrapper));
+		cal_mime_attach->content_id = g_strdup (camel_mime_part_get_content_id (mime_part));
 
 		disp = camel_mime_part_get_disposition (mime_part);
 		if (disp && !g_ascii_strcasecmp(disp, "inline"))
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 1de0ed5..10751a3 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -1173,6 +1173,8 @@ append_cal_attachments (EMsgComposer *composer,
 		camel_mime_part_set_content (
 			attachment, mime_attach->encoded_data,
 			mime_attach->length, mime_attach->content_type);
+		if (mime_attach->content_id)
+			camel_mime_part_set_content_id (attachment, mime_attach->content_id);
 		if (mime_attach->filename != NULL)
 			camel_mime_part_set_filename (
 				attachment, mime_attach->filename);
@@ -1190,9 +1192,13 @@ append_cal_attachments (EMsgComposer *composer,
 
 		g_free (mime_attach->filename);
 		g_free (mime_attach->content_type);
+		g_free (mime_attach->content_id);
 		g_free (mime_attach->description);
 		g_free (mime_attach->encoded_data);
+		g_free (mime_attach);
 	}
+
+	g_slist_free (attach_list);
 }
 
 gboolean
diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h
index b93ffe2..6e27d89 100644
--- a/calendar/gui/itip-utils.h
+++ b/calendar/gui/itip-utils.h
@@ -41,6 +41,7 @@ typedef enum {
 struct CalMimeAttach {
 	gchar *filename;
 	gchar *content_type;
+	gchar *content_id;
 	gchar *description;
 	gchar *encoded_data;
 	gboolean disposition;



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