[dovecot-cvs] dovecot/src/lib-index/mbox mbox-sync-full.c,1.5,1.6
cras at procontrol.fi
cras at procontrol.fi
Thu Dec 12 07:33:52 EET 2002
Update of /home/cvs/dovecot/src/lib-index/mbox
In directory danu:/tmp/cvs-serv25835/lib-index/mbox
Modified Files:
mbox-sync-full.c
Log Message:
Deleting messages in the middle of mbox caused dovecot to reindex the
following messages as new messages (ie. change UIDs and set \Recent flag).
Index: mbox-sync-full.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-sync-full.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mbox-sync-full.c 6 Dec 2002 01:09:23 -0000 1.5
+++ mbox-sync-full.c 12 Dec 2002 05:33:50 -0000 1.6
@@ -96,8 +96,10 @@
MailIndexUpdate *update;
MessageSize hdr_parsed_size;
MboxHeaderContext ctx;
- uoff_t header_offset, body_offset, offset, hdr_size, body_size;
+ uoff_t header_offset, body_offset, offset;
+ uoff_t hdr_size, body_size;
unsigned char current_digest[16];
+ int hdr_size_fixed;
*next_rec = NULL;
@@ -105,29 +107,37 @@
skip_line(input);
header_offset = input->v_offset;
- if (!mbox_mail_get_location(index, rec, NULL, &hdr_size, &body_size))
- return FALSE;
+ hdr_size = 0; hdr_size_fixed = FALSE;
+ do {
+ if (!mbox_mail_get_location(index, rec, NULL, NULL, &body_size))
+ return FALSE;
- if (body_size == 0) {
- /* possibly broken message, find the next From-line and make
- sure header parser won't pass it. */
- mbox_skip_header(input);
- i_stream_set_read_limit(input, input->v_offset);
i_stream_seek(input, header_offset);
- }
- /* get the MD5 sum of fixed headers and the current message flags
- in Status and X-Status fields */
- mbox_header_init_context(&ctx, index, input);
- message_parse_header(NULL, input, &hdr_parsed_size,
- mbox_header_func, &ctx);
- md5_final(&ctx.md5, current_digest);
+ if (body_size == 0 && !hdr_size_fixed) {
+ /* possibly broken message, find the next From-line
+ and make sure header parser won't pass it. */
+ mbox_skip_header(input);
+ i_stream_set_read_limit(input, input->v_offset);
+ i_stream_seek(input, header_offset);
+ hdr_size_fixed = TRUE;
+ hdr_size = 0;
+ }
- mbox_header_free_context(&ctx);
- i_stream_set_read_limit(input, 0);
+ if (hdr_size == 0) {
+ /* get the MD5 sum of fixed headers and the current
+ message flags in Status and X-Status fields */
+ mbox_header_init_context(&ctx, index, input);
+ message_parse_header(NULL, input, &hdr_parsed_size,
+ mbox_header_func, &ctx);
+ md5_final(&ctx.md5, current_digest);
+
+ mbox_header_free_context(&ctx);
+ i_stream_set_read_limit(input, 0);
+
+ body_offset = input->v_offset;
+ }
- body_offset = input->v_offset;
- do {
if (verify_header_md5sum(index, rec, current_digest) &&
mbox_verify_end_of_body(input, body_offset + body_size)) {
/* valid message */
More information about the dovecot-cvs
mailing list