aboutsummaryrefslogtreecommitdiffstats
path: root/modules/vcard-inline
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-12-06 08:42:15 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-12-08 03:01:04 +0800
commit3924dc759dbf38df0f9ff6941990dcf242478617 (patch)
treeaa00cb03ef21e3b11759dd9f094c9c2563d05956 /modules/vcard-inline
parent4611bcd7b8958c5ffadccc8b68989c839cf3f144 (diff)
downloadgsoc2013-evolution-3924dc759dbf38df0f9ff6941990dcf242478617.tar.gz
gsoc2013-evolution-3924dc759dbf38df0f9ff6941990dcf242478617.tar.zst
gsoc2013-evolution-3924dc759dbf38df0f9ff6941990dcf242478617.zip
EMailParserExtension: Collect EMailParts in a GQueue.
Collect EMailParts in a GQueue provided to the EMailParserExtension, and change the return type of parse() to gboolean to indicate whether the given CamelMimePart was handled (even if no parts were added to the output GQueue). This avoids the awkward corner case of a parser extension returning a linked list node with a NULL data member to indicate the CamelMimePart was handled but no EMailParts produced, and then having to watch out for that NULL data member corner case throughout the application. Also, remove the GCancellable parameter from e_mail_parser_error() and e_mail_parser_wrap_as_attachment() since neither function blocks.
Diffstat (limited to 'modules/vcard-inline')
-rw-r--r--modules/vcard-inline/e-mail-parser-vcard-inline.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/modules/vcard-inline/e-mail-parser-vcard-inline.c b/modules/vcard-inline/e-mail-parser-vcard-inline.c
index 319775b6eb..84f4f2f538 100644
--- a/modules/vcard-inline/e-mail-parser-vcard-inline.c
+++ b/modules/vcard-inline/e-mail-parser-vcard-inline.c
@@ -328,39 +328,46 @@ decode_vcard (EMailPartVCardInline *vcard_part,
g_object_unref (stream);
}
-static GSList *
+static gboolean
empe_vcard_inline_parse (EMailParserExtension *extension,
EMailParser *parser,
CamelMimePart *part,
GString *part_id,
- GCancellable *cancellable)
+ GCancellable *cancellable,
+ GQueue *out_mail_parts)
{
EMailPartVCardInline *vcard_part;
+ GQueue work_queue = G_QUEUE_INIT;
gint len;
len = part_id->len;
g_string_append (part_id, ".org-gnome-vcard-inline-display");
vcard_part = (EMailPartVCardInline *) e_mail_part_subclass_new (
- part, part_id->str, sizeof (EMailPartVCardInline),
- (GFreeFunc) mail_part_vcard_inline_free);
+ part, part_id->str, sizeof (EMailPartVCardInline),
+ (GFreeFunc) mail_part_vcard_inline_free);
vcard_part->parent.mime_type = camel_content_type_simple (
- camel_mime_part_get_content_type (part));
+ camel_mime_part_get_content_type (part));
vcard_part->parent.bind_func = (EMailPartDOMBindFunc) bind_dom;
vcard_part->parent.is_attachment = TRUE;
vcard_part->formatter = g_object_new (
- EAB_TYPE_CONTACT_FORMATTER,
- "display-mode", EAB_CONTACT_DISPLAY_RENDER_COMPACT,
- "render-maps", FALSE, NULL);
+ EAB_TYPE_CONTACT_FORMATTER,
+ "display-mode", EAB_CONTACT_DISPLAY_RENDER_COMPACT,
+ "render-maps", FALSE, NULL);
g_object_ref (part);
decode_vcard (vcard_part, part);
g_string_truncate (part_id, len);
- return e_mail_parser_wrap_as_attachment (
- parser, part, g_slist_append (NULL, vcard_part),
- part_id, cancellable);
+ g_queue_push_tail (&work_queue, vcard_part);
+
+ e_mail_parser_wrap_as_attachment (
+ parser, part, part_id, &work_queue);
+
+ e_queue_transfer (&work_queue, out_mail_parts);
+
+ return TRUE;
}
static guint32