comparison src/lib-storage/index/mbox/mbox-sync.c @ 3200:a9a5a399a027 HEAD

When writing the dummy message after all messages were expunged from mbox, the UIDVALIDITY value was set to 0 if X-IMAP/X-IMAPbase header wasn't read. This caused the next parsing to treat the header invalid and didn't recognize it as dummy message.
author Timo Sirainen <tss@iki.fi>
date Mon, 14 Mar 2005 16:32:48 +0200
parents 566558dcc228
children 2d19bc073996
comparison
equal deleted inserted replaced
3199:938f948651f1 3200:a9a5a399a027
953 } 953 }
954 954
955 static int mbox_write_dummy(struct mbox_sync_context *sync_ctx) 955 static int mbox_write_dummy(struct mbox_sync_context *sync_ctx)
956 { 956 {
957 string_t *str; 957 string_t *str;
958 unsigned int uid_validity;
959
960 uid_validity = sync_ctx->base_uid_validity != 0 ?
961 sync_ctx->base_uid_validity : sync_ctx->hdr->uid_validity;
962 i_assert(uid_validity != 0);
958 963
959 str = t_str_new(1024); 964 str = t_str_new(1024);
960 str_printfa(str, "%sDate: %s\n" 965 str_printfa(str, "%sDate: %s\n"
961 "From: Mail System Internal Data <MAILER-DAEMON@%s>\n" 966 "From: Mail System Internal Data <MAILER-DAEMON@%s>\n"
962 "Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA" 967 "Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA"
966 "\n" 971 "\n"
967 DUMMY_MESSAGE_BODY, 972 DUMMY_MESSAGE_BODY,
968 mbox_from_create("MAILER_DAEMON", ioloop_time), 973 mbox_from_create("MAILER_DAEMON", ioloop_time),
969 message_date_create(ioloop_time), 974 message_date_create(ioloop_time),
970 my_hostname, dec2str(ioloop_time), my_hostname, 975 my_hostname, dec2str(ioloop_time), my_hostname,
971 sync_ctx->base_uid_validity, 976 uid_validity, sync_ctx->next_uid-1);
972 sync_ctx->next_uid-1);
973 977
974 if (pwrite_full(sync_ctx->fd, str_data(str), str_len(str), 0) < 0) { 978 if (pwrite_full(sync_ctx->fd, str_data(str), str_len(str), 0) < 0) {
975 if (!ENOSPACE(errno)) { 979 if (!ENOSPACE(errno)) {
976 mbox_set_syscall_error(sync_ctx->ibox, 980 mbox_set_syscall_error(sync_ctx->ibox,
977 "pwrite_full()"); 981 "pwrite_full()");