From b4c31f5153efd4a7aa58bd1ebd3319297e528f42 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 18 Sep 2001 20:03:10 +0000 Subject: Virtualize this. * camel-data-wrapper.c (camel_data_wrapper_is_offline): Virtualize this. * camel-medium.c (is_offline): A medium is offline if its content object is offline. * camel-multipart.c (is_offline): A multipart is offline if any of its subparts are offline. svn path=/trunk/; revision=12948 --- camel/camel-multipart.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'camel/camel-multipart.c') diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c index 836297a1c8..076ec3af76 100644 --- a/camel/camel-multipart.c +++ b/camel/camel-multipart.c @@ -44,6 +44,7 @@ #define d(x) +static gboolean is_offline (CamelDataWrapper *data_wrapper); static void add_part (CamelMultipart *multipart, CamelMimePart *part); static void add_part_at (CamelMultipart *multipart, @@ -94,6 +95,7 @@ camel_multipart_class_init (CamelMultipartClass *camel_multipart_class) /* virtual method overload */ camel_data_wrapper_class->write_to_stream = write_to_stream; + camel_data_wrapper_class->is_offline = is_offline; } static void @@ -414,6 +416,24 @@ camel_multipart_get_boundary (CamelMultipart *multipart) return CMP_CLASS (multipart)->get_boundary (multipart); } +static gboolean +is_offline (CamelDataWrapper *data_wrapper) +{ + CamelMultipart *multipart = CAMEL_MULTIPART (data_wrapper); + GList *node; + CamelDataWrapper *part; + + if (parent_class->is_offline (data_wrapper)) + return TRUE; + for (node = multipart->parts; node; node = node->next) { + part = node->data; + if (camel_data_wrapper_is_offline (part)) + return TRUE; + } + + return FALSE; +} + /* this is MIME specific, doesn't belong here really */ static int write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) -- cgit v1.2.3