]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Fix UID renumbering when GUIDs aren't used
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 10 Nov 2020 22:11:35 +0000 (00:11 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Thu, 12 Nov 2020 15:01:54 +0000 (15:01 +0000)
Mails that have local UIDs won't be in import_uids hash table, so they're
not otherwise being iterated at the end and checked if they need
renumbering.

src/doveadm/dsync/dsync-mailbox-import.c

index b96a56008eaf2b64c6a7719bf9bbc0eb86fbc193..cab057b569bfc553e63bbd004d7150b3f0cb2440 100644 (file)
@@ -2227,7 +2227,7 @@ dsync_mailbox_import_handle_local_mails(struct dsync_mailbox_importer *importer)
        struct hash_iterate_context *iter;
        const char *key;
        void *key2;
-       struct importer_new_mail *mail;
+       struct importer_new_mail *mail, *const *mailp;
 
        if (importer->virtual_all_box != NULL &&
            hash_table_count(importer->import_guids) > 0) {
@@ -2252,6 +2252,13 @@ dsync_mailbox_import_handle_local_mails(struct dsync_mailbox_importer *importer)
                } T_END;
        }
        hash_table_iterate_deinit(&iter);
+       if (!importer->mails_have_guids) {
+               array_foreach(&importer->newmails, mailp) {
+                       mail = *mailp;
+                       if (mail->uid_in_local)
+                               (void)dsync_mailbox_import_handle_mail(importer, mail);
+               }
+       }
 }
 
 int dsync_mailbox_import_changes_finish(struct dsync_mailbox_importer *importer)