[dovecot-cvs] dovecot/src/lib-mail message-parser.c, 1.73,
1.74 message-parser.h, 1.32, 1.33
tss-movial at dovecot.org
tss-movial at dovecot.org
Tue May 9 14:55:07 EEST 2006
Update of /var/lib/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv9933
Modified Files:
message-parser.c message-parser.h
Log Message:
Some fixes and added message_parser_set_crlfs().
Index: message-parser.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-parser.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- message-parser.c 9 May 2006 09:37:40 -0000 1.73
+++ message-parser.c 9 May 2006 11:55:04 -0000 1.74
@@ -244,6 +244,8 @@
while (boundary->part != ctx->part) {
message_size_add(&ctx->part->parent->body_size,
&ctx->part->body_size);
+ message_size_add(&ctx->part->parent->body_size,
+ &ctx->part->header_size);
ctx->part = ctx->part->parent;
}
@@ -556,6 +558,8 @@
while (ctx->part->parent != NULL) {
message_size_add(&ctx->part->parent->body_size,
&ctx->part->body_size);
+ message_size_add(&ctx->part->parent->body_size,
+ &ctx->part->header_size);
ctx->part = ctx->part->parent;
}
}
@@ -639,3 +643,44 @@
{
part_parse_headers(part, input, callback, context);
}
+
+static void
+message_parser_set_crlfs_diff(struct message_part *parts, bool use_crlf,
+ off_t diff)
+{
+ while (parts != NULL) {
+ uoff_t old_size = parts->header_size.physical_size +
+ parts->body_size.physical_size;
+
+ if (use_crlf) {
+ parts->header_size.physical_size =
+ parts->header_size.virtual_size;
+ parts->body_size.physical_size =
+ parts->body_size.virtual_size;
+ } else {
+ parts->header_size.physical_size =
+ parts->header_size.virtual_size -
+ parts->header_size.lines;
+ parts->body_size.physical_size =
+ parts->body_size.virtual_size -
+ parts->body_size.lines;
+ }
+ parts->physical_pos += diff;
+
+ diff += (off_t)(parts->header_size.physical_size +
+ parts->body_size.physical_size) -
+ (off_t)old_size;
+
+ if (parts->children != NULL) {
+ message_parser_set_crlfs_diff(parts->children,
+ use_crlf, diff);
+ }
+
+ parts = parts->next;
+ }
+}
+
+void message_parser_set_crlfs(struct message_part *parts, bool use_crlf)
+{
+ message_parser_set_crlfs_diff(parts, use_crlf, 0);
+}
Index: message-parser.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-parser.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- message-parser.h 9 May 2006 09:37:40 -0000 1.32
+++ message-parser.h 9 May 2006 11:55:04 -0000 1.33
@@ -83,4 +83,9 @@
message_part_header_callback_t *callback,
void *context);
+/* Update the physical_size of all parts. If use_crlf is TRUE, they're set
+ to same as virtual_size. If use_crlf is FALSE, they're set to
+ virtual_size - lines. physical_pos fields are also updated. */
+void message_parser_set_crlfs(struct message_part *parts, bool use_crlf);
+
#endif
More information about the dovecot-cvs
mailing list