[dovecot-cvs] dovecot/src/lib-storage/index/mbox
mbox-sync-private.h, 1.22, 1.23 mbox-sync-rewrite.c, 1.22,
1.23 mbox-sync-update.c, 1.18, 1.19 mbox-sync.c, 1.53, 1.54
cras at procontrol.fi
cras at procontrol.fi
Tue Jun 29 01:03:26 EEST 2004
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-parse.c,
1.17, 1.18 mbox-sync-private.h, 1.21, 1.22 mbox-sync-rewrite.c,
1.21, 1.22 mbox-sync-update.c, 1.17, 1.18
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-cache.c, 1.33,
1.34 mail-cache.h, 1.12, 1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv12905/lib-storage/index/mbox
Modified Files:
mbox-sync-private.h mbox-sync-rewrite.c mbox-sync-update.c
mbox-sync.c
Log Message:
some fixes for handling pseudo headers.
Index: mbox-sync-private.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-private.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- mbox-sync-private.h 28 Jun 2004 21:32:29 -0000 1.22
+++ mbox-sync-private.h 28 Jun 2004 22:03:24 -0000 1.23
@@ -20,6 +20,7 @@
};
#define MBOX_NONRECENT MAIL_RECENT /* kludgy */
+#define MBOX_EXPUNGED 0x40
#define STATUS_FLAGS_MASK (MAIL_SEEN|MBOX_NONRECENT)
#define XSTATUS_FLAGS_MASK (MAIL_ANSWERED|MAIL_FLAGGED|MAIL_DRAFT|MAIL_DELETED)
Index: mbox-sync-rewrite.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-rewrite.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- mbox-sync-rewrite.c 28 Jun 2004 21:32:29 -0000 1.22
+++ mbox-sync-rewrite.c 28 Jun 2004 22:03:24 -0000 1.23
@@ -80,11 +80,16 @@
i_assert(size < SSIZE_T_MAX);
- /* Append at the end of X-Keywords header,
- or X-UID if it doesn't exist */
- start_pos = ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] != (size_t)-1 ?
- ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] :
- ctx->hdr_pos[MBOX_HDR_X_UID];
+ if (ctx->pseudo)
+ start_pos = ctx->hdr_pos[MBOX_HDR_X_IMAPBASE];
+ else {
+ /* Append at the end of X-Keywords header,
+ or X-UID if it doesn't exist */
+ start_pos = ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] != (size_t)-1 ?
+ ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] :
+ ctx->hdr_pos[MBOX_HDR_X_UID];
+ }
+ i_assert(start_pos != (size_t)-1);
data = str_data(ctx->header);
data_size = str_len(ctx->header);
@@ -298,7 +303,7 @@
/* mbox_sync_parse_next_mail() checks that UIDs are growing,
so we have to fool it. */
old_prev_msg_uid = sync_ctx->prev_msg_uid;
- sync_ctx->prev_msg_uid = mails[idx].uid-1;
+ sync_ctx->prev_msg_uid = mails[idx].uid == 0 ? 0 : mails[idx].uid-1;
sync_ctx->dest_first_mail = mails[idx].from_offset == 0;
mbox_sync_parse_next_mail(sync_ctx->input, &mail_ctx);
@@ -380,7 +385,7 @@
/* after expunge the next mail must have been missing space, or we
would have moved it backwards already */
- i_assert(mails[0].space < 0 || mails[0].uid == 0);
+ i_assert(mails[0].space < 0 || (mails[0].flags & MBOX_EXPUNGED) != 0);
/* start moving backwards. */
do {
@@ -396,14 +401,15 @@
space_diff = mails[idx].space;
end_offset = mails[idx].offset + mails[idx].space;
- if (mails[idx].uid != 0) {
+ if ((mails[idx].flags & MBOX_EXPUNGED) == 0) {
space_diff -= extra_per_mail;
end_offset -= extra_per_mail;
mails[idx].space = extra_per_mail;
}
idx--;
- if (mails[idx].space <= 0 && mails[idx].uid != 0) {
+ if (mails[idx].space <= 0 &&
+ (mails[idx].flags & MBOX_EXPUNGED) == 0) {
/* offset points to beginning of headers. read the
header again, update it and give enough space to
fill space_diff */
Index: mbox-sync-update.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-update.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- mbox-sync-update.c 28 Jun 2004 21:32:29 -0000 1.18
+++ mbox-sync-update.c 28 Jun 2004 22:03:24 -0000 1.19
@@ -135,7 +135,7 @@
str_append_c(ctx->header, '\n');
}
- if (ctx->hdr_pos[MBOX_HDR_X_UID] == (size_t)-1) {
+ if (ctx->hdr_pos[MBOX_HDR_X_UID] == (size_t)-1 && !ctx->pseudo) {
str_append(ctx->header, "X-UID: ");
ctx->hdr_pos[MBOX_HDR_X_UID] = str_len(ctx->header);
str_printfa(ctx->header, "%u\n", ctx->mail.uid);
Index: mbox-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- mbox-sync.c 24 Jun 2004 13:47:35 -0000 1.53
+++ mbox-sync.c 28 Jun 2004 22:03:24 -0000 1.54
@@ -666,6 +666,7 @@
struct mbox_sync_mail mail;
memset(&mail, 0, sizeof(mail));
+ mail.flags = MBOX_EXPUNGED;
mail.offset = mail_ctx->from_offset -
sync_ctx->expunged_space;
mail.space = sync_ctx->expunged_space;
@@ -804,13 +805,15 @@
while ((ret = mbox_sync_read_next_mail(sync_ctx, mail_ctx)) > 0) {
uid = mail_ctx->mail.uid;
+ if (mail_ctx->pseudo)
+ uid = 0;
+
/* get all sync records related to this message */
if (mbox_sync_read_index_syncs(sync_ctx, uid, &expunged) < 0)
return -1;
rec = NULL;
- if (uid != 0 && !mail_ctx->pseudo &&
- sync_ctx->ibox->md5hdr_extra_idx == 0) {
+ if (uid != 0 && sync_ctx->ibox->md5hdr_extra_idx == 0) {
ret = mbox_sync_read_index_rec(sync_ctx, uid, &rec);
if (ret < 0)
return -1;
@@ -818,7 +821,8 @@
uid = 0;
}
- if (uid == 0 && sync_ctx->ibox->mbox_readonly) {
+ if (uid == 0 && sync_ctx->ibox->mbox_readonly &&
+ !mail_ctx->pseudo) {
/* Use MD5 sums */
if (sync_ctx->ibox->md5hdr_extra_idx == 0) {
sync_ctx->ibox->md5hdr_extra_idx =
@@ -836,7 +840,7 @@
uid = rec->uid;
}
- if (uid == 0) {
+ if (uid == 0 && !mail_ctx->pseudo) {
/* missing/broken X-UID. all the rest of the mails
need new UIDs. */
while (sync_ctx->idx_seq <= messages_count) {
@@ -860,12 +864,14 @@
return ret;
}
- if (!expunged && !mail_ctx->pseudo) {
- if (mbox_sync_update_index(sync_ctx, mail_ctx,
- rec) < 0)
- return -1;
+ if (!mail_ctx->pseudo) {
+ if (!expunged) {
+ if (mbox_sync_update_index(sync_ctx, mail_ctx,
+ rec) < 0)
+ return -1;
+ }
+ sync_ctx->idx_seq++;
}
- sync_ctx->idx_seq++;
istream_raw_mbox_next(sync_ctx->input,
mail_ctx->mail.body_size);
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-parse.c,
1.17, 1.18 mbox-sync-private.h, 1.21, 1.22 mbox-sync-rewrite.c,
1.21, 1.22 mbox-sync-update.c, 1.17, 1.18
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-cache.c, 1.33,
1.34 mail-cache.h, 1.12, 1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list