Deleting attachments locally

About

Some devices don't have a lot local disk space. Therefore it's possible to remote attachments from locally cached messages.

Setting the mime parts to purged

TnyMsg *msg = ...
TnyList *list = tny_simple_list_new ();
TnyIterator *iter;

tny_mime_part_get_parts (TNY_MIME_PART (msg), list);
iter = tny_list_create_iterator (list);

while (!tny_iterator_is_done (iter))
{
    TnyMimePart *part = TNY_MIME_PART (tny_iterator_get_current (iter));
    tny_mime_part_set_purged (part);
    g_object_unref (part);
    tny_iterator_next (iter);
}
g_object_unref (iter);
g_object_unref (list)

Rewriting the message's cache after purging the parts

tny_msg_rewrite_cache (msg);

References to related other documentation