[dovecot-cvs] dovecot/src/lib-mail message-parser.c, 1.72, 1.73 message-parser.h, 1.31, 1.32

tss-movial at dovecot.org tss-movial at dovecot.org
Tue May 9 12:37:42 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv2521

Modified Files:
	message-parser.c message-parser.h 
Log Message:
Added message_part to struct message_block and some cleanups.


Index: message-parser.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-parser.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- message-parser.c	8 May 2006 08:46:19 -0000	1.72
+++ message-parser.c	9 May 2006 09:37:40 -0000	1.73
@@ -242,15 +242,8 @@
 	/* get back to parent MIME part, summing the child MIME part sizes
 	   into parent's body sizes */
 	while (boundary->part != ctx->part) {
-		ctx->part->parent->body_size.physical_size +=
-			ctx->part->header_size.physical_size +
-			ctx->part->body_size.physical_size;
-		ctx->part->parent->body_size.virtual_size +=
-			ctx->part->header_size.virtual_size +
-			ctx->part->body_size.virtual_size;
-		ctx->part->parent->body_size.lines +=
-			ctx->part->header_size.lines +
-			ctx->part->body_size.lines;
+		message_size_add(&ctx->part->parent->body_size,
+				 &ctx->part->body_size);
 		ctx->part = ctx->part->parent;
 	}
 
@@ -542,29 +535,27 @@
 	int ret;
 	bool eof = FALSE;
 
+	block_r->part = ctx->part;
+
 	while ((ret = ctx->parse_next_block(ctx, block_r)) == 0) {
 		if ((ret = i_stream_read(ctx->input)) == 0)
 			break;
 		if (ret < 0) {
+			if (ret == -2)
+				ret = 0;
 			if (eof)
 				break;
 			eof = TRUE;
 		} else {
 			eof = FALSE;
 		}
+		block_r->part = ctx->part;
 	}
 
 	if (ret < 0) {
 		while (ctx->part->parent != NULL) {
-			ctx->part->parent->body_size.physical_size +=
-				ctx->part->header_size.physical_size +
-				ctx->part->body_size.physical_size;
-			ctx->part->parent->body_size.virtual_size +=
-				ctx->part->header_size.virtual_size +
-				ctx->part->body_size.virtual_size;
-			ctx->part->parent->body_size.lines +=
-				ctx->part->header_size.lines +
-				ctx->part->body_size.lines;
+			message_size_add(&ctx->part->parent->body_size,
+					 &ctx->part->body_size);
 			ctx->part = ctx->part->parent;
 		}
 	}
@@ -581,7 +572,7 @@
 	int ret;
 
 	while ((ret = message_parser_parse_next_block(ctx, &block)) > 0) {
-		callback(ctx->part, block.hdr, context);
+		callback(block.part, block.hdr, context);
 
 		if (block.hdr == NULL)
 			break;
@@ -605,7 +596,7 @@
 
 	while ((ret = message_parser_parse_next_block(ctx, &block)) > 0) {
 		if (block.size == 0 && hdr_callback != NULL)
-			hdr_callback(ctx->part, block.hdr, context);
+			hdr_callback(block.part, block.hdr, context);
 	}
 	i_assert(ret != 0);
 }

Index: message-parser.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-parser.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- message-parser.h	8 May 2006 08:46:19 -0000	1.31
+++ message-parser.h	9 May 2006 09:37:40 -0000	1.32
@@ -38,6 +38,9 @@
 struct message_parser_ctx;
 
 struct message_block {
+	/* Message part this block belongs to */
+	struct message_part *part;
+
 	/* non-NULL if a header line was read */
 	struct message_header_line *hdr;
 



More information about the dovecot-cvs mailing list