X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-formatter.c;h=8cdd09160b185fc07cbb7e78bd3157077245b317;hp=a503ed7544077a62fafd07640ae16e1f6a150a27;hb=0f713f7c9267bb57e8f25627718744520bc8a311;hpb=5f595ed317f7b7c135d411d58c5544fc9fb3dd46 diff --git a/src/modest-formatter.c b/src/modest-formatter.c index a503ed7..8cdd091 100644 --- a/src/modest-formatter.c +++ b/src/modest-formatter.c @@ -226,6 +226,32 @@ modest_formatter_inline (ModestFormatter *self, TnyMimePart *body, TnyHeader *he return modest_formatter_do (self, body, header, modest_formatter_wrapper_inline, attachments); } +static void +remove_purgeds (TnyMimePart *part) +{ + TnyList *parts; + TnyIterator *iterator; + + parts = TNY_LIST (tny_simple_list_new ()); + tny_mime_part_get_parts (part, parts); + + for (iterator = tny_list_create_iterator (parts); + !tny_iterator_is_done (iterator); + tny_iterator_next (iterator)) { + TnyMimePart *current; + + current = (TnyMimePart *) tny_iterator_get_current (iterator); + if (tny_mime_part_is_purged (current)) { + tny_mime_part_del_part (part, current); + } + + g_object_unref (current); + } + + g_object_unref (iterator); + g_object_unref (parts); +} + TnyMsg * modest_formatter_attach (ModestFormatter *self, TnyMsg *msg, TnyHeader *header) { @@ -247,6 +273,10 @@ modest_formatter_attach (ModestFormatter *self, TnyMsg *msg, TnyHeader *header) g_object_unref (body_part); if (msg) { + + /* Remove purgeds */ + remove_purgeds (TNY_MIME_PART (msg)); + /* Add parts */ tny_mime_part_add_part (TNY_MIME_PART (new_msg), TNY_MIME_PART (msg)); }