changeset 9285:ae00eda5b152 HEAD

index-mail: Expose tee_stream so plugins can read the stream too while mail is being read.
author Timo Sirainen <tss@iki.fi>
date Thu, 06 Aug 2009 15:56:31 -0400
parents 8ea90a23ed74
children 528f904067d4
files src/lib-storage/index/index-mail-headers.c src/lib-storage/index/index-mail.h
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-mail-headers.c	Tue Aug 04 16:58:33 2009 -0400
+++ b/src/lib-storage/index/index-mail-headers.c	Thu Aug 06 15:56:31 2009 -0400
@@ -371,9 +371,9 @@
 index_mail_cache_parse_init(struct mail *_mail, struct istream *input)
 {
 	struct index_mail *mail = (struct index_mail *)_mail;
-	struct tee_istream *tee;
 	struct istream *input2;
 
+	i_assert(mail->data.tee_stream == NULL);
 	i_assert(mail->data.parser_ctx == NULL);
 
 	/* we're doing everything for now, figure out later if we want to
@@ -382,9 +382,9 @@
 	mail->data.save_bodystructure_header = TRUE;
 	mail->data.save_bodystructure_body = TRUE;
 
-	tee = tee_i_stream_create(input);
-	input = tee_i_stream_create_child(tee);
-	input2 = tee_i_stream_create_child(tee);
+	mail->data.tee_stream = tee_i_stream_create(input);
+	input = tee_i_stream_create_child(mail->data.tee_stream);
+	input2 = tee_i_stream_create_child(mail->data.tee_stream);
 
 	index_mail_parse_header_init(mail, NULL);
 	mail->data.parser_ctx =
--- a/src/lib-storage/index/index-mail.h	Tue Aug 04 16:58:33 2009 -0400
+++ b/src/lib-storage/index/index-mail.h	Thu Aug 06 15:56:31 2009 -0400
@@ -89,6 +89,7 @@
 	unsigned int dont_cache_field_idx;
 
 	struct istream *stream, *filter_stream;
+	struct tee_istream *tee_stream;
 	struct message_size hdr_size, body_size;
 	struct message_parser_ctx *parser_ctx;
 	int parsing_count;