]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Removed mail_update_uid() / mail_index_update_uid().
authorTimo Sirainen <tss@iki.fi>
Wed, 30 Jun 2010 20:21:19 +0000 (21:21 +0100)
committerTimo Sirainen <tss@iki.fi>
Wed, 30 Jun 2010 20:21:19 +0000 (21:21 +0100)
It was working properly only with mdbox and there wasn't really a need for it.

--HG--
branch : HEAD

28 files changed:
src/doveadm/doveadm-dump-log.c
src/lib-index/mail-index-sync-update.c
src/lib-index/mail-index-transaction-export.c
src/lib-index/mail-index-transaction-finish.c
src/lib-index/mail-index-transaction-private.h
src/lib-index/mail-index-transaction-update.c
src/lib-index/mail-index.h
src/lib-index/mail-transaction-log-file.c
src/lib-index/mail-transaction-log.h
src/lib-index/test-mail-index-transaction-finish.c
src/lib-index/test-mail-index-transaction-update.c
src/lib-storage/index/cydir/cydir-mail.c
src/lib-storage/index/dbox-multi/mdbox-mail.c
src/lib-storage/index/dbox-multi/mdbox-save.c
src/lib-storage/index/dbox-single/sdbox-mail.c
src/lib-storage/index/index-mail.c
src/lib-storage/index/index-mail.h
src/lib-storage/index/index-transaction.c
src/lib-storage/index/maildir/maildir-mail.c
src/lib-storage/index/maildir/maildir-save.c
src/lib-storage/index/maildir/maildir-storage.h
src/lib-storage/index/mbox/mbox-mail.c
src/lib-storage/index/raw/raw-mail.c
src/lib-storage/mail-storage-private.h
src/lib-storage/mail-storage.h
src/lib-storage/mail.c
src/lib-storage/test-mail.c
src/plugins/virtual/virtual-mail.c

index 9b7e6567597801bc4a2c7380f781da25de84e123..ae0ae401c297942caa3f0756703f2a11815d0740 100644 (file)
@@ -52,7 +52,6 @@ mail_transaction_header_has_modseq(const struct mail_transaction_header *hdr)
        case MAIL_TRANSACTION_FLAG_UPDATE:
        case MAIL_TRANSACTION_KEYWORD_UPDATE:
        case MAIL_TRANSACTION_KEYWORD_RESET:
-       case MAIL_TRANSACTION_UID_UPDATE:
                /* these changes increase modseq */
                return TRUE;
        }
@@ -103,9 +102,6 @@ static const char *log_record_type(unsigned int type)
        case MAIL_TRANSACTION_EXT_ATOMIC_INC:
                name = "ext-atomic-inc";
                break;
-       case MAIL_TRANSACTION_UID_UPDATE:
-               name = "uid-update";
-               break;
        case MAIL_TRANSACTION_MODSEQ_UPDATE:
                name = "modseq-update";
                break;
@@ -396,16 +392,6 @@ static void log_record_print(const struct mail_transaction_header *hdr,
                printf("\n");
                break;
        }
-       case MAIL_TRANSACTION_UID_UPDATE: {
-               const struct mail_transaction_uid_update *rec, *end;
-
-               end = CONST_PTR_OFFSET(data, size);
-               for (rec = data; rec < end; rec++) {
-                       printf(" - old uid=%u new uid=%u\n",
-                              rec->old_uid, rec->new_uid);
-               }
-               break;
-       }
        case MAIL_TRANSACTION_MODSEQ_UPDATE: {
                const struct mail_transaction_modseq_update *rec, *end;
 
index bf1d16e2cfadc9a03816d9bc8dfa95bc11121a84..1a804f9332eba3503b535d8d48d71da523f6fccd 100644 (file)
@@ -301,41 +301,6 @@ static bool sync_update_ignored_change(struct mail_index_sync_map_ctx *ctx)
        return TRUE;
 }
 
-static void sync_uid_update(struct mail_index_sync_map_ctx *ctx,
-                           uint32_t old_uid, uint32_t new_uid)
-{
-       struct mail_index_view *view = ctx->view;
-       struct mail_index_map *map;
-       struct mail_index_record *rec;
-       uint32_t old_seq;
-       void *dest;
-
-       if (new_uid < ctx->view->map->hdr.next_uid) {
-               /* uid update is no longer possible */
-               if (sync_update_ignored_change(ctx))
-                       view->index->sync_commit_result->ignored_uid_changes++;
-               return;
-       }
-
-       if (!mail_index_lookup_seq(view, old_uid, &old_seq))
-               return;
-
-       map = mail_index_sync_get_atomic_map(ctx);
-       map->hdr.next_uid = new_uid+1;
-       map->rec_map->last_appended_uid = new_uid;
-
-       /* add the new record */
-       dest = sync_append_record(map);
-       rec = MAIL_INDEX_MAP_IDX(map, old_seq-1);
-       rec->uid = new_uid;
-       memcpy(dest, rec, map->hdr.record_size);
-
-       /* @UNSAFE: remove the old record */
-       memmove(rec, PTR_OFFSET(rec, map->hdr.record_size),
-               (map->rec_map->records_count + 1 - old_seq) *
-               map->hdr.record_size);
-}
-
 static int
 sync_modseq_update(struct mail_index_sync_map_ctx *ctx,
                   const struct mail_transaction_modseq_update *u,
@@ -799,14 +764,6 @@ int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx,
                ret = mail_index_sync_keywords_reset(ctx, hdr, rec);
                break;
        }
-       case MAIL_TRANSACTION_UID_UPDATE: {
-               const struct mail_transaction_uid_update *rec, *end;
-
-               end = CONST_PTR_OFFSET(data, hdr->size);
-               for (rec = data; rec < end; rec++)
-                       sync_uid_update(ctx, rec->old_uid, rec->new_uid);
-               break;
-       }
        case MAIL_TRANSACTION_MODSEQ_UPDATE: {
                const struct mail_transaction_modseq_update *rec = data;
 
index b94fd3f12e9be029ecf615dce5de7383c7b57252..1c9d48142c6b3735f04a3fac1cc03d877f3fe29b 100644 (file)
@@ -336,61 +336,6 @@ log_append_keyword_updates(struct mail_index_export_context *ctx)
        return change_mask;
 }
 
-static bool
-mail_index_transaction_export_new_uids(struct mail_index_export_context *ctx,
-                                      struct mail_index_transaction *t)
-{
-       const struct mail_index_record *appends;
-       const struct mail_transaction_uid_update *updates;
-       unsigned int a, u, append_count, update_count;
-
-       if (!array_is_created(&t->uid_updates)) {
-               /* fast path */
-               if (!array_is_created(&t->appends))
-                       return FALSE;
-
-               log_append_buffer(ctx, t->appends.arr.buffer,
-                                 MAIL_TRANSACTION_APPEND);
-               return TRUE;
-       }
-       if (!array_is_created(&t->appends)) {
-               log_append_buffer(ctx, t->uid_updates.arr.buffer,
-                                 MAIL_TRANSACTION_UID_UPDATE);
-               return TRUE;
-       }
-
-       /* we'll need to merge so that UIDs are only being appended.
-          appends quite a lot of separate records unnecessarily,
-          but UID updates are rare.. */
-       appends = array_get(&t->appends, &append_count);
-       updates = array_get(&t->uid_updates, &update_count);
-
-       for (a = u = 0; a < append_count && u < update_count; ) {
-               if (appends[a].uid < updates[u].new_uid) {
-                       mail_transaction_log_append_add(ctx->append_ctx,
-                                       MAIL_TRANSACTION_APPEND,
-                                       &appends[a], sizeof(appends[a]));
-                       a++;
-               } else {
-                       mail_transaction_log_append_add(ctx->append_ctx,
-                                       MAIL_TRANSACTION_UID_UPDATE,
-                                       &updates[u], sizeof(updates[u]));
-                       u++;
-               }
-       }
-       if (a < append_count) {
-               mail_transaction_log_append_add(ctx->append_ctx,
-                               MAIL_TRANSACTION_APPEND, &appends[a],
-                               (append_count - a) * sizeof(appends[a]));
-       }
-       if (u < update_count) {
-               mail_transaction_log_append_add(ctx->append_ctx,
-                               MAIL_TRANSACTION_UID_UPDATE, &updates[u],
-                               (update_count - u) * sizeof(updates[u]));
-       }
-       return TRUE;
-}
-
 void mail_index_transaction_export(struct mail_index_transaction *t,
                                   struct mail_transaction_log_append_ctx *append_ctx)
 {
@@ -416,8 +361,11 @@ void mail_index_transaction_export(struct mail_index_transaction *t,
                log_append_buffer(&ctx, log_get_hdr_update_buffer(t, TRUE),
                                  MAIL_TRANSACTION_HEADER_UPDATE);
        }
-       if (mail_index_transaction_export_new_uids(&ctx, t))
+       if (array_is_created(&t->appends)) {
                change_mask |= MAIL_INDEX_SYNC_TYPE_APPEND;
+               log_append_buffer(&ctx, t->appends.arr.buffer,
+                                 MAIL_TRANSACTION_APPEND);
+       }
 
        if (array_is_created(&t->updates)) {
                change_mask |= MAIL_INDEX_SYNC_TYPE_FLAGS;
index e3796b738c5b82c1579d7a5e9b4a1654814c27eb..2e4f3747d57fd8e5b58ef737086d2257326e0282 100644 (file)
@@ -311,7 +311,6 @@ mail_index_transaction_convert_to_uids(struct mail_index_transaction *t)
 
         keyword_updates_convert_to_uids(t);
        expunges_convert_to_uids(t);
-       mail_index_convert_to_uids(t, (void *)&t->uid_updates);
        mail_index_convert_to_uids(t, (void *)&t->modseq_updates);
        mail_index_convert_to_uid_ranges(t, (void *)&t->updates);
        mail_index_convert_to_uid_ranges(t, &t->keyword_resets);
index eeb85515c49c66e6118d3fc6697dd7d55ff75edd..1e54ba6199257bc10dd0832dbed846692ebc38e8 100644 (file)
@@ -45,7 +45,6 @@ struct mail_index_transaction {
        uint32_t min_flagupdate_seq, max_flagupdate_seq;
 
        ARRAY_DEFINE(modseq_updates, struct mail_transaction_modseq_update);
-       ARRAY_DEFINE(uid_updates, struct mail_transaction_uid_update);
        ARRAY_DEFINE(expunges, struct mail_transaction_expunge_guid);
        ARRAY_DEFINE(updates, struct mail_transaction_flag_update);
        size_t last_update_idx;
index 277866c9a1c80df4f6fafd282c7306e09f09f7dc..3d4312190f96bc92c1ee86f207726bd3a818dcc2 100644 (file)
@@ -64,8 +64,6 @@ void mail_index_transaction_reset_v(struct mail_index_transaction *t)
 
        if (array_is_created(&t->appends))
                array_free(&t->appends);
-       if (array_is_created(&t->uid_updates))
-               array_free(&t->uid_updates);
        if (array_is_created(&t->modseq_updates))
                array_free(&t->modseq_updates);
        if (array_is_created(&t->expunges))
@@ -107,7 +105,6 @@ void mail_index_transaction_set_log_updates(struct mail_index_transaction *t)
 {
        /* flag updates aren't included in log_updates */
        t->log_updates = array_is_created(&t->appends) ||
-               array_is_created(&t->uid_updates) ||
                array_is_created(&t->modseq_updates) ||
                array_is_created(&t->expunges) ||
                array_is_created(&t->keyword_resets) ||
@@ -240,21 +237,6 @@ void mail_index_append_finish_uids(struct mail_index_transaction *t,
        }
 }
 
-void mail_index_update_uid(struct mail_index_transaction *t, uint32_t seq,
-                          uint32_t new_uid)
-{
-       struct mail_transaction_uid_update *u;
-
-       if (!array_is_created(&t->uid_updates))
-               i_array_init(&t->uid_updates, 32);
-
-       u = array_append_space(&t->uid_updates);
-       u->old_uid = seq;
-       u->new_uid = new_uid;
-
-       t->log_updates = TRUE;
-}
-
 void mail_index_update_modseq(struct mail_index_transaction *t, uint32_t seq,
                              uint64_t min_modseq)
 {
index c5aeddac5fd2ee308bd04a813337d220113c6b52..0983c970c1fb425f5bfccd847a3e9ecf9e15e980 100644 (file)
@@ -192,7 +192,6 @@ struct mail_index_transaction_commit_result {
           all of it was written to the same file. */
        uoff_t commit_size;
 
-       unsigned int ignored_uid_changes;
        unsigned int ignored_modseq_changes;
 };
 
@@ -425,12 +424,6 @@ void mail_index_append(struct mail_index_transaction *t, uint32_t uid,
 void mail_index_append_finish_uids(struct mail_index_transaction *t,
                                   uint32_t first_uid,
                                   ARRAY_TYPE(seq_range) *uids_r);
-/* Update message's UID. The new UID must not be lower than next_uid at the
-   commit time, otherwise the UID update fails and is just ignored.
-   If there are appends in the same transaction, the updated UIDs must be
-   higher than the append UIDs. */
-void mail_index_update_uid(struct mail_index_transaction *t, uint32_t seq,
-                          uint32_t new_uid);
 /* Expunge record from index. Note that this doesn't affect sequence numbers
    until transaction is committed and mailbox is synced. */
 void mail_index_expunge(struct mail_index_transaction *t, uint32_t seq);
index ca761d209bf3064db0151e421345460efa03cb95..4d0f4a1bb7de4a5693c276d5b3b0a38e7499094a 100644 (file)
@@ -852,7 +852,6 @@ void mail_transaction_update_modseq(const struct mail_transaction_header *hdr,
        case MAIL_TRANSACTION_FLAG_UPDATE:
        case MAIL_TRANSACTION_KEYWORD_UPDATE:
        case MAIL_TRANSACTION_KEYWORD_RESET:
-       case MAIL_TRANSACTION_UID_UPDATE:
                /* these changes increase modseq */
                *cur_modseq += 1;
                break;
index a633db76fe8077d3d3090daf328d6c04d24ff0e2..c3dfe7bac492602e8ba0ec7e9bfed2cf86c7b16b 100644 (file)
@@ -39,7 +39,6 @@ enum mail_transaction_type {
        MAIL_TRANSACTION_KEYWORD_RESET          = 0x00000800,
        MAIL_TRANSACTION_EXT_ATOMIC_INC         = 0x00001000,
        MAIL_TRANSACTION_EXPUNGE_GUID           = 0x00002000,
-       MAIL_TRANSACTION_UID_UPDATE             = 0x00004000,
        MAIL_TRANSACTION_MODSEQ_UPDATE          = 0x00008000,
        MAIL_TRANSACTION_EXT_HDR_UPDATE32       = 0x00010000,
        MAIL_TRANSACTION_INDEX_DELETED          = 0x00020000,
@@ -67,10 +66,6 @@ struct mail_transaction_header {
        uint32_t type; /* enum mail_transaction_type */
 };
 
-struct mail_transaction_uid_update {
-       uint32_t old_uid, new_uid;
-};
-
 struct mail_transaction_modseq_update {
        uint32_t uid;
        /* don't use uint64_t here. it adds extra 32 bits of paddiong and also
index 037a258259a029ebd5916a65ee9353ff5da53e66..efda81a036dda0c1c19b73188a168f5ac90284b0 100644 (file)
@@ -154,38 +154,6 @@ static void test_mail_index_transaction_finish_check_conflicts(void)
        test_end();
 }
 
-static void test_mail_index_transaction_finish_uid_updates(void)
-{
-       struct mail_index_transaction *t;
-       const struct mail_transaction_uid_update *uid_updates;
-       struct mail_transaction_uid_update *u;
-       unsigned int count;
-
-       t = t_new(struct mail_index_transaction, 1);
-
-       test_begin("mail index transaction finish uid updates");
-
-       t_array_init(&t->uid_updates, 10);
-       u = array_append_space(&t->uid_updates);
-       u->old_uid = 1; u->new_uid = 15;
-       u = array_append_space(&t->uid_updates);
-       u->old_uid = 2; u->new_uid = 16;
-       u = array_append_space(&t->uid_updates);
-       u->old_uid = 5; u->new_uid = 17;
-       u = array_append_space(&t->uid_updates);
-       u->old_uid = 2; u->new_uid = 18;
-
-       mail_index_transaction_finish(t);
-
-       uid_updates = array_get(&t->uid_updates, &count);
-       test_assert(count == 4);
-       test_assert(uid_updates[0].old_uid == 1*2 && uid_updates[0].new_uid == 15);
-       test_assert(uid_updates[1].old_uid == 2*2 && uid_updates[1].new_uid == 16);
-       test_assert(uid_updates[2].old_uid == 5*2 && uid_updates[2].new_uid == 17);
-       test_assert(uid_updates[3].old_uid == 2*2 && uid_updates[3].new_uid == 18);
-       test_end();
-}
-
 static void test_mail_index_transaction_finish_modseq_updates(void)
 {
        struct mail_index_transaction *t;
@@ -288,7 +256,6 @@ int main(void)
        static void (*test_functions[])(void) = {
                test_mail_index_transaction_finish_flag_updates,
                test_mail_index_transaction_finish_check_conflicts,
-               test_mail_index_transaction_finish_uid_updates,
                test_mail_index_transaction_finish_modseq_updates,
                test_mail_index_transaction_finish_expunges,
                NULL
index f902817cbeab12ffc1c15ab83fda32cd27151fc7..3a7d36a9890371f611d7ce36620da6c1291a4bbb 100644 (file)
@@ -462,31 +462,6 @@ static void test_mail_index_transaction_get_flag_update_pos(void)
        test_end();
 }
 
-static void test_mail_index_uid_update(void)
-{
-       struct mail_index_transaction *t;
-       const struct mail_transaction_uid_update *uid_updates;
-       unsigned int count;
-
-       test_begin("mail index uid update");
-
-       hdr.messages_count = 10;
-       t = mail_index_transaction_new();
-
-       mail_index_update_uid(t, 4, 7);
-       mail_index_update_uid(t, 6, 8);
-       mail_index_update_uid(t, 2, 5);
-       mail_index_update_uid(t, 4, 9);
-
-       uid_updates = array_get(&t->uid_updates, &count);
-       test_assert(count == 4);
-       test_assert(uid_updates[0].old_uid == 4 && uid_updates[0].new_uid == 7);
-       test_assert(uid_updates[1].old_uid == 6 && uid_updates[1].new_uid == 8);
-       test_assert(uid_updates[2].old_uid == 2 && uid_updates[2].new_uid == 5);
-       test_assert(uid_updates[3].old_uid == 4 && uid_updates[3].new_uid == 9);
-       test_end();
-}
-
 static void test_mail_index_modseq_update(void)
 {
        struct mail_index_transaction *t;
@@ -578,7 +553,6 @@ int main(void)
                test_mail_index_flag_update_appends,
                test_mail_index_cancel_flag_updates,
                test_mail_index_transaction_get_flag_update_pos,
-               test_mail_index_uid_update,
                test_mail_index_modseq_update,
                test_mail_index_expunge,
                NULL
index 318e166bf0b4c45b65af4c4f2c899b214063af8b..008ddfed17ec7dc18bc6699bce25a0199ed87967 100644 (file)
@@ -146,7 +146,6 @@ struct mail_vfuncs cydir_mail_vfuncs = {
        index_mail_update_flags,
        index_mail_update_keywords,
        index_mail_update_modseq,
-       index_mail_update_uid,
        NULL,
        index_mail_expunge,
        index_mail_set_cache_corrupted
index 0f20708ea48db241643c2d8cdea7d6e445693025..ddc7e12fd8758b5de932f4ced4f710295c7f1934 100644 (file)
@@ -212,7 +212,6 @@ struct mail_vfuncs mdbox_mail_vfuncs = {
        mdbox_mail_update_flags,
        index_mail_update_keywords,
        index_mail_update_modseq,
-       index_mail_update_uid,
        NULL,
        index_mail_expunge,
        index_mail_set_cache_corrupted
index 1a995a78d42b6320d628e57c6060dab4ddb292a3..7ad581362f0a76dce5300621210675462ee6fa87 100644 (file)
@@ -273,9 +273,12 @@ int mdbox_transaction_save_commit_pre(struct mail_save_context *_ctx)
 
        /* save map UIDs to mailbox index */
        if (first_map_uid != 0) {
+               const struct mdbox_mail_index_record *old_rec;
                struct mdbox_mail_index_record rec;
                const struct dbox_save_mail *mails;
                unsigned int i, count;
+               const void *data;
+               bool expunged;
                uint32_t next_map_uid = first_map_uid;
 
                mdbox_update_header(mbox, ctx->ctx.trans, NULL);
@@ -284,6 +287,15 @@ int mdbox_transaction_save_commit_pre(struct mail_save_context *_ctx)
                rec.save_date = ioloop_time;
                mails = array_get(&ctx->mails, &count);
                for (i = 0; i < count; i++) {
+                       mail_index_lookup_ext(_t->view, mails[i].seq,
+                                             mbox->ext_id, &data, &expunged);
+                       old_rec = data;
+                       if (old_rec != NULL && old_rec->map_uid != 0) {
+                               /* message was copied. keep the existing
+                                  map uid */
+                               continue;
+                       }
+
                        rec.map_uid = next_map_uid++;
                        mail_index_update_ext(ctx->ctx.trans, mails[i].seq,
                                              mbox->ext_id, &rec, NULL);
index d74e409648a3acf37e56d48d49b02617596087f8..d8a1a8bd1931501d20ba13ddc79026ab6b3c41ab 100644 (file)
@@ -102,7 +102,6 @@ struct mail_vfuncs sdbox_mail_vfuncs = {
        index_mail_update_flags,
        index_mail_update_keywords,
        index_mail_update_modseq,
-       index_mail_update_uid,
        NULL,
        index_mail_expunge,
        index_mail_set_cache_corrupted
index 24de5bb1eb5d1455df2b90bb1d22874fc06e24f0..92838b9fb76ded9734bcf2cbc579ebb3aa1a47bc 100644 (file)
@@ -1476,11 +1476,6 @@ void index_mail_update_modseq(struct mail *mail, uint64_t min_modseq)
                                 min_modseq);
 }
 
-void index_mail_update_uid(struct mail *mail, uint32_t new_uid)
-{
-       mail_index_update_uid(mail->transaction->itrans, mail->seq, new_uid);
-}
-
 void index_mail_expunge(struct mail *mail)
 {
        const char *value;
index 877b8c09f431f9fa0029a0d7c0480c2b943dc096..d5340c6c7c1d4a5b66703da6ae9023ab250d23fb 100644 (file)
@@ -201,7 +201,6 @@ void index_mail_update_flags(struct mail *mail, enum modify_type modify_type,
 void index_mail_update_keywords(struct mail *mail, enum modify_type modify_type,
                                struct mail_keywords *keywords);
 void index_mail_update_modseq(struct mail *mail, uint64_t min_modseq);
-void index_mail_update_uid(struct mail *mail, uint32_t new_uid);
 void index_mail_expunge(struct mail *mail);
 void index_mail_set_cache_corrupted(struct mail *mail,
                                    enum mail_fetch_field field);
index 9d81c8ff006a6b03058518f1cb981931755de99d..f2f046338d568ad0f5541b93fb6962336b1f82d1 100644 (file)
@@ -126,7 +126,6 @@ int index_transaction_commit(struct mailbox_transaction_context *t,
        if (ret < 0 && mail_index_is_deleted(box->index))
                mailbox_set_deleted(box);
 
-       changes_r->ignored_uid_changes = result.ignored_uid_changes;
        changes_r->ignored_modseq_changes = result.ignored_modseq_changes;
        return ret;
 }
index faf6b09f0e1e7447602f89c0e0bfa0460c351fd9..2149dcfaadd3b7a6b88e064cecd7846453be3b56 100644 (file)
@@ -506,12 +506,6 @@ static int maildir_mail_get_stream(struct mail *_mail,
        return index_mail_init_stream(mail, hdr_size, body_size, stream_r);
 }
 
-static void maildir_mail_update_uid(struct mail *_mail, uint32_t new_uid)
-{
-       maildir_save_add_conflict(_mail->transaction, _mail->uid, new_uid);
-       index_mail_update_uid(_mail, new_uid);
-}
-
 static void maildir_update_pop3_uidl(struct mail *_mail, const char *uidl)
 {
        struct maildir_mailbox *mbox = (struct maildir_mailbox *)_mail->box;
@@ -589,7 +583,6 @@ struct mail_vfuncs maildir_mail_vfuncs = {
        index_mail_update_flags,
        index_mail_update_keywords,
        index_mail_update_modseq,
-       maildir_mail_update_uid,
        maildir_update_pop3_uidl,
        index_mail_expunge,
        maildir_mail_set_cache_corrupted
index 2f715d9d3f9af5abee1be9a149af4d9db57ce771..7f7821b1d71b35b22f3519ee4490aafe4c0aa60e 100644 (file)
@@ -37,10 +37,6 @@ struct maildir_filename {
        /* unsigned int keywords[]; */
 };
 
-struct maildir_save_conflict {
-       uint32_t old_uid, new_uid;
-};
-
 struct maildir_save_context {
        struct mail_save_context ctx;
        pool_t pool;
@@ -56,8 +52,6 @@ struct maildir_save_context {
        struct maildir_filename *files, **files_tail, *file_last;
        unsigned int files_count;
 
-       ARRAY_DEFINE(conflicts, struct maildir_save_conflict);
-
        buffer_t keywords_buffer;
        ARRAY_TYPE(keyword_indexes) keywords_array;
 
@@ -611,55 +605,6 @@ void maildir_save_cancel(struct mail_save_context *_ctx)
        (void)maildir_save_finish(_ctx);
 }
 
-void maildir_save_add_conflict(struct mailbox_transaction_context *t,
-                              uint32_t old_uid, uint32_t new_uid)
-{
-       struct maildir_save_context *save_ctx;
-       struct maildir_save_conflict *c;
-
-       save_ctx = (struct maildir_save_context *)maildir_save_alloc(t);
-
-       if (!array_is_created(&save_ctx->conflicts))
-               i_array_init(&save_ctx->conflicts, 64);
-
-       c = array_append_space(&save_ctx->conflicts);
-       c->old_uid = old_uid;
-       c->new_uid = new_uid;
-}
-
-static void maildir_sync_conflict(struct maildir_save_context *ctx,
-                                 const struct maildir_save_conflict *conflict)
-{
-       const char *filename;
-       enum maildir_uidlist_rec_flag flags;
-
-       if (maildir_uidlist_lookup(ctx->mbox->uidlist, conflict->old_uid,
-                                  &flags, &filename) <= 0) {
-               i_error("maildir %s: uid %u update failed: lost filename",
-                       ctx->mbox->box.path, conflict->old_uid);
-               return;
-       }
-       maildir_uidlist_sync_remove(ctx->uidlist_sync_ctx, filename);
-       if (maildir_uidlist_sync_next_uid(ctx->uidlist_sync_ctx, filename,
-                                         conflict->new_uid, 0) < 0) {
-               i_error("maildir %s: uid %u update failed: sync failed",
-                       ctx->mbox->box.path, conflict->old_uid);
-       }
-}
-
-static void maildir_sync_conflicts(struct maildir_save_context *ctx)
-{
-       const struct maildir_save_conflict *conflicts;
-       unsigned int i, count;
-
-       if (!array_is_created(&ctx->conflicts))
-               return;
-
-       conflicts = array_get(&ctx->conflicts, &count);
-       for (i = 0; i < count; i++)
-               maildir_sync_conflict(ctx, &conflicts[i]);
-}
-
 static void
 maildir_save_unlink_files(struct maildir_save_context *ctx)
 {
@@ -905,7 +850,7 @@ int maildir_transaction_save_commit_pre(struct mail_save_context *_ctx)
        i_assert(_ctx->output == NULL);
        i_assert(ctx->last_save_finished);
 
-       if (ctx->files_count == 0 && !array_is_created(&ctx->conflicts))
+       if (ctx->files_count == 0)
                return 0;
 
        sync_flags = MAILDIR_UIDLIST_SYNC_PARTIAL |
@@ -932,7 +877,6 @@ int maildir_transaction_save_commit_pre(struct mail_save_context *_ctx)
                        maildir_transaction_save_rollback(_ctx);
                        return -1;
                }
-               maildir_sync_conflicts(ctx);
        } else if (ret == 0 &&
                   (sync_flags & MAILDIR_UIDLIST_SYNC_TRYLOCK) != 0) {
                ctx->locked = FALSE;
@@ -1006,8 +950,6 @@ void maildir_transaction_save_commit_post(struct mail_save_context *_ctx,
 
        if (ctx->locked)
                maildir_uidlist_unlock(ctx->mbox->uidlist);
-       if (array_is_created(&ctx->conflicts))
-               array_free(&ctx->conflicts);
        pool_unref(&ctx->pool);
 }
 
@@ -1032,7 +974,5 @@ void maildir_transaction_save_rollback(struct mail_save_context *_ctx)
 
        if (ctx->mail != NULL)
                mail_free(&ctx->mail);
-       if (array_is_created(&ctx->conflicts))
-               array_free(&ctx->conflicts);
        pool_unref(&ctx->pool);
 }
index 6525d6eff4244b0e32aab3397da10dbab7a01c2c..34ecd9afb17b5b4ed19b41fe821eecfb16f6dd74 100644 (file)
@@ -117,9 +117,6 @@ int maildir_save_continue(struct mail_save_context *ctx);
 int maildir_save_finish(struct mail_save_context *ctx);
 void maildir_save_cancel(struct mail_save_context *ctx);
 
-void maildir_save_add_conflict(struct mailbox_transaction_context *t,
-                              uint32_t old_uid, uint32_t new_uid);
-
 void maildir_save_add(struct mail_save_context *_ctx, const char *base_fname,
                      bool preserve_filename);
 const char *maildir_save_file_get_path(struct mailbox_transaction_context *t,
index 9d0c9bcdb12b1abcbe80e6aee6438be46962075d..899a974e6425ffe64f7e3d4660cf56fcc6c01498 100644 (file)
@@ -407,7 +407,6 @@ struct mail_vfuncs mbox_mail_vfuncs = {
        index_mail_update_flags,
        index_mail_update_keywords,
        index_mail_update_modseq,
-       index_mail_update_uid,
        NULL,
        index_mail_expunge,
        index_mail_set_cache_corrupted
index 47807b7d968c1013f87b121ea68f6aef5ffc1a71..e0885cf0665ceb1846d4eb04e8cf60500a46010e 100644 (file)
@@ -136,7 +136,6 @@ struct mail_vfuncs raw_mail_vfuncs = {
        index_mail_update_flags,
        index_mail_update_keywords,
        index_mail_update_modseq,
-       index_mail_update_uid,
        NULL,
        index_mail_expunge,
        index_mail_set_cache_corrupted
index 40a66a52707e9913eaeefcd882595f09b8cab99b..9c743f9acc5ceecdd1269e9a2796ebfe5a492683 100644 (file)
@@ -313,7 +313,6 @@ struct mail_vfuncs {
        void (*update_keywords)(struct mail *mail, enum modify_type modify_type,
                                struct mail_keywords *keywords);
        void (*update_modseq)(struct mail *mail, uint64_t min_modseq);
-       void (*update_uid)(struct mail *mail, uint32_t new_uid);
        void (*update_pop3_uidl)(struct mail *mail, const char *uidl);
        void (*expunge)(struct mail *mail);
        void (*set_cache_corrupted)(struct mail *mail,
index ce32672f3455fe50853f2339319a9a309abddefc..4dbfd4348c8df1740843e3e6f96aa567ec24bc79 100644 (file)
@@ -212,8 +212,7 @@ struct mail_transaction_commit_changes {
        /* UIDs assigned to saved messages. Not necessarily ascending. */
        ARRAY_TYPE(seq_range) saved_uids;
 
-       /* number of uid/modseq changes that couldn't be changed as requested */
-       unsigned int ignored_uid_changes;
+       /* number of modseq changes that couldn't be changed as requested */
        unsigned int ignored_modseq_changes;
 };
 
@@ -674,9 +673,6 @@ void mail_update_keywords(struct mail *mail, enum modify_type modify_type,
 /* Update message's modseq to be at least min_modseq. */
 void mail_update_modseq(struct mail *mail, uint64_t min_modseq);
 
-/* Update message's UID. The new UID must not be lower than next_uid at the
-   commit time, otherwise the UID update fails and is just ignored. */
-void mail_update_uid(struct mail *mail, uint32_t new_uid);
 /* Update message's POP3 UIDL (if possible). */
 void mail_update_pop3_uidl(struct mail *mail, const char *uidl);
 /* Expunge this message. Sequence numbers don't change until commit. */
index e376235c8b199ef335baca67294e9b8707fdca9d..c262c84d48b73f28f720851b63dc9eea00e59a06 100644 (file)
@@ -217,13 +217,6 @@ void mail_update_modseq(struct mail *mail, uint64_t min_modseq)
        p->v.update_modseq(mail, min_modseq);
 }
 
-void mail_update_uid(struct mail *mail, uint32_t new_uid)
-{
-       struct mail_private *p = (struct mail_private *)mail;
-
-       p->v.update_uid(mail, new_uid);
-}
-
 void mail_update_pop3_uidl(struct mail *mail, const char *uidl)
 {
        struct mail_private *p = (struct mail_private *)mail;
index c2f69f2b17c843f9e6c147b5f71262c462bc0529..ccf3b3a447d25169eeaa450730e3c7eaf064bf86 100644 (file)
@@ -191,11 +191,6 @@ static void test_mail_update_modseq(struct mail *mail ATTR_UNUSED,
 {
 }
 
-static void test_mail_update_uid(struct mail *mail ATTR_UNUSED,
-                                uint32_t new_uid ATTR_UNUSED)
-{
-}
-
 static void test_mail_expunge(struct mail *mail ATTR_UNUSED)
 {
 }
@@ -232,7 +227,6 @@ struct mail_vfuncs test_mail_vfuncs = {
        test_mail_update_flags,
        test_mail_update_keywords,
        test_mail_update_modseq,
-       test_mail_update_uid,
        NULL,
        test_mail_expunge,
        test_mail_set_cache_corrupted
index edb836fd041fb4241da955a3d58abfce0682b5ed..579f1cd82083489d4fb55b295fe0044369de6764 100644 (file)
@@ -405,7 +405,6 @@ struct mail_vfuncs virtual_mail_vfuncs = {
        index_mail_update_flags,
        index_mail_update_keywords,
        index_mail_update_modseq,
-       index_mail_update_uid,
        virtual_mail_update_pop3_uidl,
        virtual_mail_expunge,
        virtual_mail_set_cache_corrupted