Improve mime support, introduce ref/unref functions for mu_message_t and mu_mime_t.
* include/mailutils/message.h (mu_message_ref): Change proto. (mu_message_unref): New proto (instead of macro). * include/mailutils/mime.h (mu_mime_ref) (mu_mime_unref, mu_mime_to_message): New protos. * include/mailutils/sys/message.h (MESSAGE_MODIFIED) (MESSAGE_INTERNAL_STREAM): New constants (from mime.c) (MESSAGE_MIME_OWNER): New constant. (_mu_message) <ref_count>: Rename from ref. * include/mailutils/sys/mime.h (MIME_SEEK_ACTIVE): New constant. (_mu_mime) <ref_count>: New member. * libmailutils/mailbox/message.c (MESSAGE_MODIFIED) (MESSAGE_INTERNAL_STREAM): Removed (see above). * libmailutils/mailer/mailer.c (mu_message_unref): New function. (mu_message_destroy): Rewrite. (mu_message_ref): Returns void. (mu_message_lines): Don't access header and body directly to give virtual functions a chance to initialize them. (mu_message_quick_lines): likewise. * libmailutils/mailer/mailer.c (send_fragments): Use mu_mime_to_message instead of mu_message_unref. * libmailutils/mime/mime.c (_mime_append_part): Set offset only if mime->stream is not null. (_mime_body_stream_seek): Implement (albeit inefficiently). (mu_mime_create): Set ref_count. (mu_mime_ref, mu_mime_unref): New functions. (mu_mime_destroy): Reimplement as a wrapper over _mu_mime_free. (mu_mime_get_message): Increase refcount of the message being returned. (mu_mime_to_message): New function. * libmailutils/stream/message_stream.c (_message_open): Handle arbitrary text as RFC822 without headers. * libmu_sieve/actions.c: Unref the message returned by mu_mime_get_message. * libmu_sieve/extensions/vacation.c: Likewise. * mh/mhn.c: Likewise. * libmailutils/stream/stream.c (mu_stream_seek) <MU_SEEK_CUR>: Bugfix.
Showing
12 changed files
with
266 additions
and
126 deletions
-
Please register or sign in to post a comment