summaryrefslogtreecommitdiff
path: root/include/mailutils/sys
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-01-03 18:04:28 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2013-01-03 18:30:32 +0200
commitefa513048a74fca2e3ab1b16cc927f8331347f75 (patch)
tree06360b65fed31192dd5b51cb5cf53ba5f8060083 /include/mailutils/sys
parent3a6ea349ae7b1a941acd6ec882e93ad5b3a27ca4 (diff)
downloadmailutils-efa513048a74fca2e3ab1b16cc927f8331347f75.tar.gz
mailutils-efa513048a74fca2e3ab1b16cc927f8331347f75.tar.bz2
Make sure modifications to a message or its parts become visible in the message stream.
* include/mailutils/sys/body.h (_mu_body)<rawstream>: New member. * include/mailutils/sys/message.h (_mu_message)<rawstream>: New member. * libmailutils/mailbox/body.c: Rewrite. Return the specially crafted "body-stream" for user I/O operations. Writes to that stream trigger creation of a temporary stream (write-through mode) which will be used for subsequent I/O. * libmailutils/mailbox/msgbody.c (mu_message_get_body): Use msg->rawstream. * libmailutils/mailbox/msgheader.c (message_header_fill): Do not call mu_message_get_streamref, as that can result in endless recursion. Use msg->rawstream instead. * libmailutils/mailbox/msgref.c (_mu_message_free): Destroy both rawstream and outstream. * libmailutils/mailbox/msgstream.c (mu_message_set_stream): Set rawstream. (mu_message_get_stream): Create outstream as needed. (mu_message_get_streamref): If the message has been modified, create the outstream and return it to the caller. This way, the modifications become visible via the stream interface. * libmailutils/tests/Makefile.am: Add new testcases. * libmailutils/tests/testsuite.at: Likewise. * libmailutils/tests/modmesg.c: New file. * libmailutils/tests/modmesg00.at: New file. * libmailutils/tests/modmesg01.at: New file. * libmailutils/tests/modmesg02.at: New file. * libmailutils/tests/modmesg03.at: New file. * mh/mhn.c: Fix message reference counting.
Diffstat (limited to 'include/mailutils/sys')
-rw-r--r--include/mailutils/sys/body.h1
-rw-r--r--include/mailutils/sys/message.h3
2 files changed, 3 insertions, 1 deletions
diff --git a/include/mailutils/sys/body.h b/include/mailutils/sys/body.h
index 501bc83ce..651b614b8 100644
--- a/include/mailutils/sys/body.h
+++ b/include/mailutils/sys/body.h
@@ -33,6 +33,7 @@ struct _mu_body
{
void *owner;
mu_stream_t stream;
+ mu_stream_t rawstream;
mu_stream_t fstream;
int flags;
diff --git a/include/mailutils/sys/message.h b/include/mailutils/sys/message.h
index d9d4c4ac1..df258c2d7 100644
--- a/include/mailutils/sys/message.h
+++ b/include/mailutils/sys/message.h
@@ -47,7 +47,8 @@ struct _mu_message
mu_body_t body;
int flags;
- mu_stream_t stream;
+ mu_stream_t rawstream;
+ mu_stream_t outstream;
mu_attribute_t attribute;
mu_monitor_t monitor;
mu_mime_t mime;

Return to:

Send suggestions and report system problems to the System administrator.