[evolution] Stop relying on CamelObject meta-data.



commit 55d6580d8627a9a85df1e6b19529196d4d9ac95a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Mar 31 20:02:13 2010 -0400

    Stop relying on CamelObject meta-data.

 em-format/em-format-quote.c             |    6 +-
 em-format/em-format.c                   |   71 ++++++++++++++++++++++--------
 em-format/em-format.h                   |    2 +-
 mail/em-format-hook.c                   |    5 +-
 mail/em-format-html-display.c           |    4 +-
 mail/em-format-html.c                   |   20 ++++-----
 modules/plugin-mono/Camel.cs            |   62 ---------------------------
 plugins/itip-formatter/itip-formatter.c |    2 +-
 plugins/prefer-plain/prefer-plain.c     |    4 +-
 plugins/tnef-attachments/tnef-plugin.c  |    4 +-
 10 files changed, 75 insertions(+), 105 deletions(-)
---
diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c
index 40a9f40..bf90653 100644
--- a/em-format/em-format-quote.c
+++ b/em-format/em-format-quote.c
@@ -169,10 +169,10 @@ emfq_format_clone(EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMim
 	g_object_unref (gconf);
 	handle = em_format_find_handler(emf, "x-evolution/message/prefix");
 	if (handle)
-		handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle);
+		handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle, FALSE);
 	handle = em_format_find_handler(emf, "x-evolution/message/rfc822");
 	if (handle)
-		handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle);
+		handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle, FALSE);
 
 	camel_stream_flush(emfq->stream);
 
@@ -474,7 +474,7 @@ emfq_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part,
 
 		camel_stream_write_string(stream, "</font></td></tr></table>");
 
-		handle->handler(emf, stream, part, handle);
+		handle->handler(emf, stream, part, handle, FALSE);
 	}
 }
 
diff --git a/em-format/em-format.c b/em-format/em-format.c
index e5856a0..3369819 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -670,11 +670,7 @@ em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const
 		if (handle != NULL
 		    && !em_format_is_attachment(emf, part)) {
 			d(printf("running handler for type '%s'\n", mime_type));
-			if (is_fallback)
-				camel_object_meta_set (part, "EMF-Fallback", "1");
-			handle->handler(emf, stream, part, handle);
-			if (is_fallback)
-				camel_object_meta_set (part, "EMF-Fallback",  NULL);
+			handle->handler(emf, stream, part, handle, is_fallback);
 			goto finish;
 		}
 		d(printf("this type is an attachment? '%s'\n", mime_type));
@@ -1347,7 +1343,11 @@ add_validity_found (EMFormat *emf, CamelCipherValidity *valid)
 
 #ifdef ENABLE_SMIME
 static void
-emf_application_xpkcs7mime(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
+emf_application_xpkcs7mime (EMFormat *emf,
+                            CamelStream *stream,
+                            CamelMimePart *part,
+                            const EMFormatHandler *info,
+                            gboolean is_fallback)
 {
 	CamelCipherContext *context;
 	CamelException *ex;
@@ -1392,7 +1392,11 @@ emf_application_xpkcs7mime(EMFormat *emf, CamelStream *stream, CamelMimePart *pa
 
 /* RFC 1740 */
 static void
-emf_multipart_appledouble(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
+emf_multipart_appledouble (EMFormat *emf,
+                           CamelStream *stream,
+                           CamelMimePart *part,
+                           const EMFormatHandler *info,
+                           gboolean is_fallback)
 {
 	CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
 	CamelMimePart *mime_part;
@@ -1417,7 +1421,11 @@ emf_multipart_appledouble(EMFormat *emf, CamelStream *stream, CamelMimePart *par
 
 /* RFC ??? */
 static void
-emf_multipart_mixed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
+emf_multipart_mixed (EMFormat *emf,
+                     CamelStream *stream,
+                     CamelMimePart *part,
+                     const EMFormatHandler *info,
+                     gboolean is_fallback)
 {
 	CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
 	gint i, nparts, len;
@@ -1439,7 +1447,11 @@ emf_multipart_mixed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, con
 
 /* RFC 1740 */
 static void
-emf_multipart_alternative(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
+emf_multipart_alternative (EMFormat *emf,
+                           CamelStream *stream,
+                           CamelMimePart *part,
+                           const EMFormatHandler *info,
+                           gboolean is_fallback)
 {
 	CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
 	gint i, nparts, bestid = 0;
@@ -1486,11 +1498,15 @@ emf_multipart_alternative(EMFormat *emf, CamelStream *stream, CamelMimePart *par
 		em_format_part(emf, stream, best);
 		g_string_truncate(emf->part_id, len);
 	} else
-		emf_multipart_mixed(emf, stream, part, info);
+		emf_multipart_mixed(emf, stream, part, info, is_fallback);
 }
 
 static void
-emf_multipart_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
+emf_multipart_encrypted (EMFormat *emf,
+                         CamelStream *stream,
+                         CamelMimePart *part,
+                         const EMFormatHandler *info,
+                         gboolean is_fallback)
 {
 	CamelCipherContext *context;
 	CamelException *ex;
@@ -1559,7 +1575,11 @@ emf_write_related(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
 
 /* RFC 2387 */
 static void
-emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
+emf_multipart_related (EMFormat *emf,
+                       CamelStream *stream,
+                       CamelMimePart *part,
+                       const EMFormatHandler *info,
+                       gboolean is_fallback)
 {
 	CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
 	CamelMimePart *body_part, *display_part = NULL;
@@ -1601,7 +1621,7 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
 	}
 
 	if (display_part == NULL) {
-		emf_multipart_mixed(emf, stream, part, info);
+		emf_multipart_mixed(emf, stream, part, info, is_fallback);
 		return;
 	}
 
@@ -1654,7 +1674,11 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
 }
 
 static void
-emf_multipart_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
+emf_multipart_signed (EMFormat *emf,
+                      CamelStream *stream,
+                      CamelMimePart *part,
+                      const EMFormatHandler *info,
+                      gboolean is_fallback)
 {
 	CamelMimePart *cpart;
 	CamelMultipartSigned *mps;
@@ -1728,7 +1752,8 @@ static void
 emf_application_mbox (EMFormat *emf,
                       CamelStream *stream,
                       CamelMimePart *mime_part,
-                      const EMFormatHandler *info)
+                      const EMFormatHandler *info,
+                      gboolean is_fallback)
 {
 	const EMFormatHandler *handle;
 	CamelMimeParser *parser;
@@ -1777,7 +1802,7 @@ emf_application_mbox (EMFormat *emf,
 		}
 
 		/* Render the message. */
-		handle->handler (emf, stream, mime_part, handle);
+		handle->handler (emf, stream, mime_part, handle, FALSE);
 
 		camel_object_unref (message);
 
@@ -1791,7 +1816,11 @@ emf_application_mbox (EMFormat *emf,
 }
 
 static void
-emf_message_rfc822(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
+emf_message_rfc822 (EMFormat *emf,
+                    CamelStream *stream,
+                    CamelMimePart *part,
+                    const EMFormatHandler *info,
+                    gboolean is_fallback)
 {
 	CamelDataWrapper *dw = camel_medium_get_content_object((CamelMedium *)part);
 	const EMFormatHandler *handle;
@@ -1807,13 +1836,17 @@ emf_message_rfc822(EMFormat *emf, CamelStream *stream, CamelMimePart *part, cons
 
 	handle = em_format_find_handler(emf, "x-evolution/message/rfc822");
 	if (handle)
-		handle->handler(emf, stream, (CamelMimePart *)dw, handle);
+		handle->handler(emf, stream, (CamelMimePart *)dw, handle, FALSE);
 
 	g_string_truncate(emf->part_id, len);
 }
 
 static void
-emf_message_deliverystatus(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
+emf_message_deliverystatus (EMFormat *emf,
+                            CamelStream *stream,
+                            CamelMimePart *part,
+                            const EMFormatHandler *info,
+                            gboolean is_fallback)
 {
 	em_format_format_text(emf, stream, (CamelDataWrapper *)part);
 }
diff --git a/em-format/em-format.h b/em-format/em-format.h
index 4d8beaa..39f6240 100644
--- a/em-format/em-format.h
+++ b/em-format/em-format.h
@@ -65,7 +65,7 @@ typedef struct _EMFormatPrivate EMFormatPrivate;
 typedef struct _EMFormatHandler EMFormatHandler;
 typedef struct _EMFormatHeader EMFormatHeader;
 
-typedef void (*EMFormatFunc) (EMFormat *md, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info);
+typedef void (*EMFormatFunc) (EMFormat *md, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info, gboolean is_fallback);
 
 typedef enum _em_format_mode_t {
 	EM_FORMAT_NORMAL,
diff --git a/mail/em-format-hook.c b/mail/em-format-hook.c
index 78c46d9..cab253f 100644
--- a/mail/em-format-hook.c
+++ b/mail/em-format-hook.c
@@ -66,7 +66,8 @@ static void
 emfh_format_format (EMFormat *md,
                     CamelStream *stream,
                     CamelMimePart *part,
-                    const EMFormatHandler *info)
+                    const EMFormatHandler *info,
+                    gboolean is_fallback)
 {
 	struct _EMFormatHookItem *item = (EMFormatHookItem *)info;
 
@@ -77,7 +78,7 @@ emfh_format_format (EMFormat *md,
 
 		e_plugin_invoke(item->hook->hook.plugin, item->format, &target);
 	} else if (info->old) {
-		info->old->handler(md, stream, part, info->old);
+		info->old->handler(md, stream, part, info->old, FALSE);
 	}
 }
 
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 14a74af..ee3e4ac 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -463,7 +463,7 @@ efhd_format_attachment (EMFormat *emf,
 		EM_FORMAT_HTML_VPAD);
 
 	if (handle && info->shown)
-		handle->handler (emf, stream, part, handle);
+		handle->handler (emf, stream, part, handle, FALSE);
 
 	g_free (classid);
 }
@@ -877,7 +877,7 @@ efhd_attachment_frame (EMFormat *emf,
 
 	if (info->shown)
 		info->handle->handler (
-			emf, stream, info->puri.part, info->handle);
+			emf, stream, info->puri.part, info->handle, FALSE);
 
 	camel_stream_close (stream);
 }
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 8e1cfce..a8ffc2f 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -208,7 +208,7 @@ efh_format_exec (struct _format_msg *m)
 		if (handle != NULL)
 			handle->handler (
 				format, (CamelStream *) m->estream,
-				(CamelMimePart *) m->message, handle);
+				(CamelMimePart *) m->message, handle, FALSE);
 
 		mime_type = "x-evolution/message/rfc822";
 		handle = em_format_find_handler (format, mime_type);
@@ -216,7 +216,7 @@ efh_format_exec (struct _format_msg *m)
 		if (handle != NULL)
 			handle->handler (
 				format, (CamelStream *) m->estream,
-				(CamelMimePart *) m->message, handle);
+				(CamelMimePart *) m->message, handle, FALSE);
 	}
 
 	camel_stream_flush((CamelStream *)m->estream);
@@ -738,7 +738,7 @@ efh_format_attachment (EMFormat *emf,
 	camel_stream_write_string (stream, "</font></td></tr><tr></table>");
 
 	if (handle && em_format_is_inline (emf, emf->part_id->str, part, handle))
-		handle->handler (emf, stream, part, handle);
+		handle->handler (emf, stream, part, handle, FALSE);
 }
 
 static gboolean
@@ -1630,7 +1630,11 @@ efh_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Camel
 }
 
 static void
-efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
+efh_text_plain (EMFormatHTML *efh,
+                CamelStream *stream,
+                CamelMimePart *part,
+                const EMFormatHandler *info,
+                gboolean is_fallback)
 {
 	CamelStreamFilter *filtered_stream;
 	CamelMimeFilter *html_filter;
@@ -1641,16 +1645,10 @@ efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
 	guint32 flags;
 	guint32 rgb;
 	gint i, count, len;
-	gchar *meta;
-	gboolean is_fallback;
 	struct _EMFormatHTMLCache *efhc;
 
 	flags = efh->text_html_flags;
 
-	meta = camel_object_meta_get (part, "EMF-Fallback");
-	is_fallback = meta != NULL;
-	g_free (meta);
-
 	dw = camel_medium_get_content_object((CamelMedium *)part);
 
 	/* Check for RFC 2646 flowed text. */
@@ -2814,7 +2812,7 @@ efh_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, cons
 
 	handle = em_format_find_handler(emf, "x-evolution/message/post-header");
 	if (handle)
-		handle->handler(emf, stream, part, handle);
+		handle->handler(emf, stream, part, handle, FALSE);
 
 	camel_stream_printf(stream, EM_FORMAT_HTML_VPAD);
 	em_format_part(emf, stream, part);
diff --git a/modules/plugin-mono/Camel.cs b/modules/plugin-mono/Camel.cs
index 4ad80e7..c415498 100644
--- a/modules/plugin-mono/Camel.cs
+++ b/modules/plugin-mono/Camel.cs
@@ -261,69 +261,7 @@ namespace Camel {
 			remove { removeEvent("finalize", ref finalise_id, value); }
 		}
 
-		public event MetaChangedEvent MetaChanged {
-			add { addEvent("meta_changed", ref meta_changed_id, (CamelEventFunc)metaChangedHook, value); }
-			remove { removeEvent("meta_changed", ref meta_changed_id, value); }
-		}
-
-		[DllImport("camel-1.2")] static extern IntPtr camel_object_get_ptr(IntPtr raw, ref CamelException ex, int tag);
 		[DllImport("camel-1.2")] static extern void camel_object_free(IntPtr raw, int tag, IntPtr val);
-		[DllImport("camel-1.2")] static extern int camel_object_get_int(IntPtr raw, ref CamelException ex, int tag);
-
-		// maybe we want an indexer class to get properties?
-		// e.g. name = folder.properties[Folder.Tag.NAME]
-		public String getString(int type) {
-			String s;
-			IntPtr o;
-			CamelException ex = new CamelException();
-
-			o = camel_object_get_ptr(cobject, ref ex, type);
-			if (ex.id != 0)
-				throw new Camel.Exception(ex);
-
-			s = Marshal.PtrToStringAuto(o);
-			camel_object_free(cobject, type, o);
-
-			return s;
-		}
-
-		public Camel.Object getObject(int type) {
-			IntPtr o;
-			Camel.Object co;
-			CamelException ex = new CamelException();
-
-			o = camel_object_get_ptr(cobject, ref ex, type);
-			if (ex.id != 0)
-				throw new Camel.Exception(ex);
-
-			co = fromCamel(o);
-			camel_object_free(cobject, type, o);
-
-			return co;
-		}
-
-		public int getInt(int type) {
-			int r;
-			CamelException ex = new CamelException();
-
-			r = camel_object_get_int(cobject, ref ex, type);
-			if (ex.id != 0)
-				throw new Camel.Exception(ex);
-
-			return r;
-		}
-
-		// meta-data
-		[DllImport("camel-1.2")] static extern String camel_object_meta_get(IntPtr raw, string name);
-		[DllImport("camel-1.2")] static extern bool camel_object_meta_set(IntPtr raw, string name, string value);
-
-		public String metaGet(String name) {
-			return camel_object_meta_get(cobject, name);
-		}
-
-		public bool metaSet(String name, String value) {
-			return camel_object_meta_set(cobject, name, value);
-		}
 	}
 
 	public class Provider {
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 526af07..f5c727b 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -2741,7 +2741,7 @@ itip_attachment_frame(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
 	struct _itip_puri *info = (struct _itip_puri *)puri;
 
 	d(printf("writing to frame content, handler is '%s'\n", info->handle->mime_type));
-	info->handle->handler(emf, stream, info->puri.part, info->handle);
+	info->handle->handler(emf, stream, info->puri.part, info->handle, FALSE);
 	camel_stream_close(stream);
 }
 
diff --git a/plugins/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c
index bd77e83..edfc8ff 100644
--- a/plugins/prefer-plain/prefer-plain.c
+++ b/plugins/prefer-plain/prefer-plain.c
@@ -83,7 +83,7 @@ org_gnome_prefer_plain_text_html (gpointer ep, EMFormatHookTarget *t)
 	if (epp_mode != EPP_TEXT
 	    || strstr (t->format->part_id->str, ".alternative-prefer-plain.") != NULL
 	    || em_format_is_inline (t->format, t->format->part_id->str, t->part, &(t->item->handler)))
-		t->item->handler.old->handler (t->format, t->stream, t->part, t->item->handler.old);
+		t->item->handler.old->handler (t->format, t->stream, t->part, t->item->handler.old, FALSE);
 	else if (epp_show_suppressed)
 		make_part_attachment (t->format, t->stream, t->part, -1);
 }
@@ -161,7 +161,7 @@ org_gnome_prefer_plain_multipart_alternative(gpointer ep, EMFormatHookTarget *t)
 			em_format_part_as (t->format, t->stream, display_part, "text/html");
 			g_string_truncate (t->format->part_id, partidlen);
 		} else {
-			t->item->handler.old->handler (t->format, t->stream, t->part, t->item->handler.old);
+			t->item->handler.old->handler (t->format, t->stream, t->part, t->item->handler.old, FALSE);
 		}
 		return;
 	} else if (!CAMEL_IS_MULTIPART(mp)) {
diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c
index 074ec63..cf0b11e 100644
--- a/plugins/tnef-attachments/tnef-plugin.c
+++ b/plugins/tnef-attachments/tnef-plugin.c
@@ -173,7 +173,7 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t)
 	if (camel_multipart_get_number(mp) > 0)
 		em_format_part_as(t->format, t->stream, mainpart, "multipart/mixed");
 	else if (t->item->handler.old)
-	    t->item->handler.old->handler(t->format, t->stream, t->part, t->item->handler.old);
+	    t->item->handler.old->handler(t->format, t->stream, t->part, t->item->handler.old, FALSE);
 
 	g_string_truncate(t->format->part_id, len);
 
@@ -183,7 +183,7 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t)
 	goto ok;
  fail:
 	if (t->item->handler.old)
-	    t->item->handler.old->handler(t->format, t->stream, t->part, t->item->handler.old);
+	    t->item->handler.old->handler(t->format, t->stream, t->part, t->item->handler.old, FALSE);
  ok:
 	g_free(name);
 	g_free(tmpdir);



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