diff options
author | Dan Vrátil <dvratil@redhat.com> | 2012-03-29 00:39:26 +0800 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2012-03-29 00:39:26 +0800 |
commit | d97c776f24ce577dc4a24c9be2d3830faa7627e8 (patch) | |
tree | 90754a31f50ef2703989cb3bba197b21038da845 /plugins/tnef-attachments | |
parent | a269411bacc7a7ce549db591204a868a7a8b2184 (diff) | |
download | gsoc2013-evolution-d97c776f24ce577dc4a24c9be2d3830faa7627e8.tar gsoc2013-evolution-d97c776f24ce577dc4a24c9be2d3830faa7627e8.tar.gz gsoc2013-evolution-d97c776f24ce577dc4a24c9be2d3830faa7627e8.tar.bz2 gsoc2013-evolution-d97c776f24ce577dc4a24c9be2d3830faa7627e8.tar.lz gsoc2013-evolution-d97c776f24ce577dc4a24c9be2d3830faa7627e8.tar.xz gsoc2013-evolution-d97c776f24ce577dc4a24c9be2d3830faa7627e8.tar.zst gsoc2013-evolution-d97c776f24ce577dc4a24c9be2d3830faa7627e8.zip |
WebKit port - port plugins
Diffstat (limited to 'plugins/tnef-attachments')
-rw-r--r-- | plugins/tnef-attachments/Makefile.am | 2 | ||||
-rw-r--r-- | plugins/tnef-attachments/tnef-plugin.c | 61 |
2 files changed, 32 insertions, 31 deletions
diff --git a/plugins/tnef-attachments/Makefile.am b/plugins/tnef-attachments/Makefile.am index 250453d740..6a393044d1 100644 --- a/plugins/tnef-attachments/Makefile.am +++ b/plugins/tnef-attachments/Makefile.am @@ -16,7 +16,6 @@ liborg_gnome_tnef_attachments_la_CPPFLAGS = \ -I$(top_srcdir)/widgets \ $(EVOLUTION_DATA_SERVER_CFLAGS) \ $(GNOME_PLATFORM_CFLAGS) \ - $(GTKHTML_CFLAGS) \ $(TNEF_CFLAGS) liborg_gnome_tnef_attachments_la_SOURCES = tnef-plugin.c @@ -28,7 +27,6 @@ liborg_gnome_tnef_attachments_la_LIBADD = \ $(top_builddir)/em-format/libemformat.la \ $(EVOLUTION_DATA_SERVER_LIBS) \ $(GNOME_PLATFORM_LIBS) \ - $(GTKHTML_LIBS) \ -lytnef EXTRA_DIST = org-gnome-tnef-attachments.eplug.xml diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c index 5ef2f270b4..0621c12dd3 100644 --- a/plugins/tnef-attachments/tnef-plugin.c +++ b/plugins/tnef-attachments/tnef-plugin.c @@ -92,6 +92,7 @@ org_gnome_format_tnef (gpointer ep, CamelMultipart *mp; CamelMimePart *mainpart; CamelDataWrapper *content; + const EMFormatHandler *handler; gint len; TNEFStruct tnef; @@ -102,15 +103,21 @@ org_gnome_format_tnef (gpointer ep, name = g_build_filename(tmpdir, ".evo-attachment.tnef", NULL); out = camel_stream_fs_new_with_name (name, O_RDWR | O_CREAT, 0666, NULL); - if (out == NULL) - goto fail; + if (out == NULL) { + g_free (name); + return; + } content = camel_medium_get_content ((CamelMedium *) t->part); - if (content == NULL) - goto fail; + if (content == NULL) { + g_free (name); + g_object_unref (out); + return; + } if (camel_data_wrapper_decode_to_stream_sync (content, out, NULL, NULL) == -1 || camel_stream_close (out, NULL, NULL) == -1) { g_object_unref (out); - goto fail; + g_free (name); + return; } g_object_unref (out); @@ -126,8 +133,11 @@ org_gnome_format_tnef (gpointer ep, /* Extraction done */ dir = opendir (tmpdir); - if (dir == NULL) - goto fail; + if (dir == NULL) { + g_object_unref (out); + g_free (name); + return; + } mainpart = camel_mime_part_new (); @@ -177,33 +187,26 @@ org_gnome_format_tnef (gpointer ep, closedir (dir); - len = t->format->part_id->len; - g_string_append_printf(t->format->part_id, ".tnef"); - - if (camel_multipart_get_number (mp) > 0) - /* FIXME Not passing a GCancellable here. */ - em_format_part_as ( - t->format, t->stream, mainpart, - "multipart/mixed", NULL); - else if (t->item->handler.old) - /* FIXME Not passing a GCancellable here. */ - t->item->handler.old->handler ( - t->format, t->stream, t->part, - t->item->handler.old, NULL, FALSE); + len = t->part_id->len; + g_string_append_printf(t->part_id, ".tnef"); + + if (camel_multipart_get_number (mp) > 0) { + handler = em_format_find_handler (t->format, "multiplart/mixed"); + /* FIXME Not passing a GCancellable here. */ + if (handler && handler->parse_func) { + CamelMimePart *part = camel_mime_part_new (); + camel_medium_set_content ((CamelMedium *) part, + CAMEL_DATA_WRAPPER (mp)); + handler->parse_func (t->format, part, t->part_id, t->info, NULL); + g_object_unref (part); + } + } - g_string_truncate (t->format->part_id, len); + g_string_truncate (t->part_id, len); g_object_unref (mp); g_object_unref (mainpart); - goto ok; - fail: - if (t->item->handler.old) - /* FIXME Not passing a GCancellable here. */ - t->item->handler.old->handler ( - t->format, t->stream, t->part, - t->item->handler.old, NULL, FALSE); - ok: g_free (name); g_free (tmpdir); } |