aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-04-04 04:55:23 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-04-04 11:06:39 +0800
commita8feedf3901a6db06e810f0dfd6ef370b23a2718 (patch)
tree7037c865bae26f0abcf71500cedb62db130a12d5 /em-format
parent26240e0b180bdaf92702e513a21da2f859883fb3 (diff)
downloadgsoc2013-evolution-a8feedf3901a6db06e810f0dfd6ef370b23a2718.tar.gz
gsoc2013-evolution-a8feedf3901a6db06e810f0dfd6ef370b23a2718.tar.zst
gsoc2013-evolution-a8feedf3901a6db06e810f0dfd6ef370b23a2718.zip
Adapt to Camel API changes.
Diffstat (limited to 'em-format')
-rw-r--r--em-format/em-format-quote.c24
-rw-r--r--em-format/em-format.c58
2 files changed, 46 insertions, 36 deletions
diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c
index c297b48efa..93cb5c3b74 100644
--- a/em-format/em-format-quote.c
+++ b/em-format/em-format-quote.c
@@ -434,14 +434,15 @@ emfq_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, con
static void
emfq_format_source(EMFormat *emf, CamelStream *stream, CamelMimePart *part)
{
- CamelStreamFilter *filtered_stream;
+ CamelStream *filtered_stream;
CamelMimeFilter *html_filter;
- filtered_stream = camel_stream_filter_new_with_stream ((CamelStream *) stream);
+ filtered_stream = camel_stream_filter_new ((CamelStream *) stream);
html_filter = camel_mime_filter_tohtml_new (CAMEL_MIME_FILTER_TOHTML_CONVERT_NL
| CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES
| CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT, 0);
- camel_stream_filter_add(filtered_stream, html_filter);
+ camel_stream_filter_add (
+ CAMEL_STREAM_FILTER (filtered_stream), html_filter);
camel_object_unref(html_filter);
em_format_format_text(emf, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
@@ -473,7 +474,7 @@ emfq_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part,
static void
emfq_text_plain(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
{
- CamelStreamFilter *filtered_stream;
+ CamelStream *filtered_stream;
CamelMimeFilter *html_filter;
CamelMimeFilter *sig_strip;
CamelContentType *type;
@@ -492,16 +493,18 @@ emfq_text_plain(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part, E
&& !g_ascii_strcasecmp(format, "flowed"))
flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED;
- filtered_stream = camel_stream_filter_new_with_stream(stream);
+ filtered_stream = camel_stream_filter_new (stream);
if ((emfq->flags & EM_FORMAT_QUOTE_KEEP_SIG) == 0) {
sig_strip = em_stripsig_filter_new ();
- camel_stream_filter_add (filtered_stream, sig_strip);
+ camel_stream_filter_add (
+ CAMEL_STREAM_FILTER (filtered_stream), sig_strip);
camel_object_unref (sig_strip);
}
html_filter = camel_mime_filter_tohtml_new(flags, rgb);
- camel_stream_filter_add(filtered_stream, html_filter);
+ camel_stream_filter_add (
+ CAMEL_STREAM_FILTER (filtered_stream), html_filter);
camel_object_unref(html_filter);
em_format_format_text((EMFormat *)emfq, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
@@ -512,7 +515,7 @@ emfq_text_plain(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part, E
static void
emfq_text_enriched(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
{
- CamelStreamFilter *filtered_stream;
+ CamelStream *filtered_stream;
CamelMimeFilter *enriched;
guint32 flags = 0;
@@ -524,8 +527,9 @@ emfq_text_enriched(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part
}
enriched = camel_mime_filter_enriched_new(flags);
- filtered_stream = camel_stream_filter_new_with_stream (stream);
- camel_stream_filter_add(filtered_stream, enriched);
+ filtered_stream = camel_stream_filter_new (stream);
+ camel_stream_filter_add (
+ CAMEL_STREAM_FILTER (filtered_stream), enriched);
camel_object_unref(enriched);
camel_stream_write_string(stream, "<br><hr><br>");
diff --git a/em-format/em-format.c b/em-format/em-format.c
index 4c1330bc51..c348e0f19f 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -676,7 +676,7 @@ em_format_part(EMFormat *emf, CamelStream *stream, CamelMimePart *part)
gchar *mime_type;
CamelDataWrapper *dw;
- dw = camel_medium_get_content_object((CamelMedium *)part);
+ dw = camel_medium_get_content ((CamelMedium *)part);
mime_type = camel_data_wrapper_get_mime_type(dw);
if (mime_type) {
camel_strdown(mime_type);
@@ -1003,7 +1003,7 @@ void em_format_add_header(EMFormat *emf, const gchar *name, guint32 flags)
gint em_format_is_attachment(EMFormat *emf, CamelMimePart *part)
{
/*CamelContentType *ct = camel_mime_part_get_content_type(part);*/
- CamelDataWrapper *dw = camel_medium_get_content_object((CamelMedium *)part);
+ CamelDataWrapper *dw = camel_medium_get_content ((CamelMedium *)part);
if (!dw)
return 0;
@@ -1184,7 +1184,7 @@ em_format_busy (EMFormat *emf)
void
em_format_format_content(EMFormat *emf, CamelStream *stream, CamelMimePart *part)
{
- CamelDataWrapper *dw = camel_medium_get_content_object((CamelMedium *)part);
+ CamelDataWrapper *dw = camel_medium_get_content ((CamelMedium *)part);
if (camel_content_type_is (dw->mime_type, "text", "*"))
em_format_format_text(emf, stream, (CamelDataWrapper *)part);
@@ -1203,8 +1203,8 @@ em_format_format_content(EMFormat *emf, CamelStream *stream, CamelMimePart *part
void
em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
{
- CamelStreamFilter *filter_stream;
- CamelMimeFilterCharset *filter;
+ CamelStream *filter_stream;
+ CamelMimeFilter *filter;
const gchar *charset = NULL;
CamelMimeFilterWindows *windows = NULL;
CamelStream *mem_stream = NULL;
@@ -1225,11 +1225,13 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
* before we move on... */
null = camel_stream_null_new();
- filter_stream = camel_stream_filter_new_with_stream(null);
+ filter_stream = camel_stream_filter_new (null);
camel_object_unref(null);
windows = (CamelMimeFilterWindows *)camel_mime_filter_windows_new(charset);
- camel_stream_filter_add(filter_stream, (CamelMimeFilter *)windows);
+ camel_stream_filter_add (
+ CAMEL_STREAM_FILTER (filter_stream),
+ CAMEL_MIME_FILTER (windows));
camel_data_wrapper_decode_to_stream(dw, (CamelStream *)filter_stream);
camel_stream_flush((CamelStream *)filter_stream);
@@ -1241,10 +1243,12 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
}
mem_stream = (CamelStream *)camel_stream_mem_new ();
- filter_stream = camel_stream_filter_new_with_stream(mem_stream);
+ filter_stream = camel_stream_filter_new (mem_stream);
- if ((filter = camel_mime_filter_charset_new_convert(charset, "UTF-8"))) {
- camel_stream_filter_add(filter_stream, (CamelMimeFilter *) filter);
+ if ((filter = camel_mime_filter_charset_new (charset, "UTF-8"))) {
+ camel_stream_filter_add (
+ CAMEL_STREAM_FILTER (filter_stream),
+ CAMEL_MIME_FILTER (filter));
camel_object_unref(filter);
}
@@ -1258,7 +1262,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
}
g_object_unref (gconf);
- size = camel_data_wrapper_decode_to_stream(emf->mode == EM_FORMAT_SOURCE ? (CamelDataWrapper *)dw: camel_medium_get_content_object((CamelMedium *)dw), (CamelStream *)filter_stream);
+ size = camel_data_wrapper_decode_to_stream(emf->mode == EM_FORMAT_SOURCE ? (CamelDataWrapper *)dw: camel_medium_get_content ((CamelMedium *)dw), (CamelStream *)filter_stream);
camel_stream_flush((CamelStream *)filter_stream);
camel_object_unref(filter_stream);
camel_stream_reset (mem_stream);
@@ -1381,7 +1385,7 @@ emf_multipart_appledouble (EMFormat *emf,
const EMFormatHandler *info,
gboolean is_fallback)
{
- CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
+ CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content ((CamelMedium *)part);
CamelMimePart *mime_part;
gint len;
@@ -1410,7 +1414,7 @@ emf_multipart_mixed (EMFormat *emf,
const EMFormatHandler *info,
gboolean is_fallback)
{
- CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
+ CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content ((CamelMedium *)part);
gint i, nparts, len;
if (!CAMEL_IS_MULTIPART(mp)) {
@@ -1436,7 +1440,7 @@ emf_multipart_alternative (EMFormat *emf,
const EMFormatHandler *info,
gboolean is_fallback)
{
- CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
+ CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content ((CamelMedium *)part);
gint i, nparts, bestid = 0;
CamelMimePart *best = NULL;
@@ -1506,7 +1510,7 @@ emf_multipart_encrypted (EMFormat *emf,
return;
}
- mpe = (CamelMultipartEncrypted*)camel_medium_get_content_object((CamelMedium *)part);
+ mpe = (CamelMultipartEncrypted*)camel_medium_get_content ((CamelMedium *)part);
if (!CAMEL_IS_MULTIPART_ENCRYPTED(mpe)) {
em_format_format_error(emf, stream, _("Could not parse MIME message. Displaying as source."));
em_format_format_source(emf, stream, part);
@@ -1564,7 +1568,7 @@ emf_multipart_related (EMFormat *emf,
const EMFormatHandler *info,
gboolean is_fallback)
{
- CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
+ CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content ((CamelMedium *)part);
CamelMimePart *body_part, *display_part = NULL;
CamelContentType *content_type;
const gchar *start;
@@ -1675,7 +1679,7 @@ emf_multipart_signed (EMFormat *emf,
return;
}
- mps = (CamelMultipartSigned *)camel_medium_get_content_object((CamelMedium *)part);
+ mps = (CamelMultipartSigned *)camel_medium_get_content ((CamelMedium *)part);
if (!CAMEL_IS_MULTIPART_SIGNED(mps)
|| (cpart = camel_multipart_get_part((CamelMultipart *)mps, CAMEL_MULTIPART_SIGNED_CONTENT)) == NULL) {
em_format_format_error(emf, stream, _("Could not parse MIME message. Displaying as source."));
@@ -1765,7 +1769,7 @@ emf_application_mbox (EMFormat *emf,
mem_stream = camel_stream_mem_new ();
camel_data_wrapper_decode_to_stream (
- camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)), mem_stream);
+ camel_medium_get_content (CAMEL_MEDIUM (mime_part)), mem_stream);
camel_seekable_stream_seek (
CAMEL_SEEKABLE_STREAM (mem_stream), 0, CAMEL_STREAM_SET);
camel_mime_parser_init_with_stream (parser, mem_stream);
@@ -1805,7 +1809,7 @@ emf_message_rfc822 (EMFormat *emf,
const EMFormatHandler *info,
gboolean is_fallback)
{
- CamelDataWrapper *dw = camel_medium_get_content_object((CamelMedium *)part);
+ CamelDataWrapper *dw = camel_medium_get_content ((CamelMedium *)part);
const EMFormatHandler *handle;
gint len;
@@ -1837,7 +1841,7 @@ emf_message_deliverystatus (EMFormat *emf,
static void
emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, EMFormatHandler *info)
{
- CamelStreamFilter *filtered_stream;
+ CamelStream *filtered_stream;
CamelMimeFilterPgp *pgp_filter;
CamelContentType *content_type;
CamelCipherContext *cipher;
@@ -1872,15 +1876,17 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
/* Setup output stream */
ostream = camel_stream_mem_new();
- filtered_stream = camel_stream_filter_new_with_stream(ostream);
+ filtered_stream = camel_stream_filter_new (ostream);
/* Add PGP header / footer filter */
pgp_filter = (CamelMimeFilterPgp *)camel_mime_filter_pgp_new();
- camel_stream_filter_add(filtered_stream, (CamelMimeFilter *)pgp_filter);
+ camel_stream_filter_add (
+ CAMEL_STREAM_FILTER (filtered_stream),
+ CAMEL_MIME_FILTER (pgp_filter));
camel_object_unref(pgp_filter);
/* Pass through the filters that have been setup */
- dw = camel_medium_get_content_object((CamelMedium *)ipart);
+ dw = camel_medium_get_content ((CamelMedium *)ipart);
camel_data_wrapper_decode_to_stream(dw, (CamelStream *)filtered_stream);
camel_stream_flush((CamelStream *)filtered_stream);
camel_object_unref(filtered_stream);
@@ -1904,7 +1910,7 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
g_free (type);
opart = camel_mime_part_new ();
- camel_medium_set_content_object ((CamelMedium *) opart, dw);
+ camel_medium_set_content ((CamelMedium *) opart, dw);
camel_data_wrapper_set_mime_type_field ((CamelDataWrapper *) opart, dw->mime_type);
add_validity_found (emf, valid);
@@ -1948,7 +1954,7 @@ emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart
return;
}
- dw = camel_medium_get_content_object ((CamelMedium *)opart);
+ dw = camel_medium_get_content ((CamelMedium *)opart);
mime_type = camel_data_wrapper_get_mime_type (dw);
/* this ensures to show the 'opart' as inlined, if possible */
@@ -2029,7 +2035,7 @@ em_format_snoop_type (CamelMimePart *part)
if (filename != NULL)
name_type = e_util_guess_mime_type (filename, FALSE);
- dw = camel_medium_get_content_object((CamelMedium *)part);
+ dw = camel_medium_get_content ((CamelMedium *)part);
if (!camel_data_wrapper_is_offline(dw)) {
CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new();