]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Access mail errors directly instead of mailbox errors
authorKarl Fleischmann <karl.fleischmann@open-xchange.com>
Wed, 1 Feb 2023 17:00:18 +0000 (18:00 +0100)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Thu, 9 Feb 2023 19:00:52 +0000 (19:00 +0000)
src/doveadm/doveadm-mail-deduplicate.c
src/doveadm/doveadm-mail-fetch.c
src/doveadm/doveadm-mail-index.c
src/doveadm/dsync/dsync-mailbox-import.c
src/indexer/master-connection.c
src/plugins/fts/fts-build-mail.c
src/plugins/pop3-migration/pop3-migration-plugin.c
src/plugins/quota/quota.c

index f1759fd5c4e634a8c55473b56e095e389d9413f3..c0c18ae153bf41e5169b861a0f42739207484b96 100644 (file)
@@ -39,7 +39,7 @@ cmd_deduplicate_box(struct doveadm_mail_cmd_context *_ctx,
        while (doveadm_mail_iter_next(iter, &mail)) {
                if (ctx->by_msgid) {
                        if (mail_get_first_header(mail, "Message-ID", &key) < 0) {
-                               errstr = mailbox_get_last_internal_error(mail->box, &error);
+                               errstr = mail_get_last_internal_error(mail, &error);
                                if (error == MAIL_ERROR_NOTFOUND)
                                        continue;
                                e_error(ctx->ctx.cctx->event,
@@ -51,7 +51,7 @@ cmd_deduplicate_box(struct doveadm_mail_cmd_context *_ctx,
                        }
                } else {
                        if (mail_get_special(mail, MAIL_FETCH_GUID, &key) < 0) {
-                               errstr = mailbox_get_last_internal_error(mail->box, &error);
+                               errstr = mail_get_last_internal_error(mail, &error);
                                if (error == MAIL_ERROR_NOTFOUND)
                                        continue;
                                e_error(ctx->ctx.cctx->event,
index 98bea6479dd683b64b8dc8cabe7af8cac41bc03b..85974768028736cfc3350c62e218bd8862c8f070 100644 (file)
@@ -638,7 +638,7 @@ static int cmd_fetch_mail(struct fetch_cmd_context *ctx)
                                field->name, mailbox_get_vname(mail->box),
                                mail->uid,
                                ctx->print_error != NULL ? ctx->print_error :
-                               mailbox_get_last_internal_error(mail->box, NULL));
+                               mail_get_last_internal_error(mail, NULL));
                        doveadm_mail_failed_mailbox(&ctx->ctx, mail->box);
                        ctx->print_error = NULL;
                        ret = -1;
index e808debc1d8dd2b4d9ac678146db02c3ba4e0197..853e65ed65d77b37e526d4b70b5ae493235e3936 100644 (file)
@@ -83,7 +83,7 @@ static int cmd_index_box_precache(struct doveadm_mail_cmd_context *dctx,
                        e_error(event,
                                "Mailbox %s: Precache for UID=%u failed: %s",
                                mailbox_get_vname(box), mail->uid,
-                               mailbox_get_last_internal_error(box, NULL));
+                               mail_get_last_internal_error(mail, NULL));
                        ret = -1;
                        break;
                }
index 8f2b1171aabd038ac3ea02ec3ed48ce787a6a636..07f0733fba6104de88784b5d981c09651f519855 100644 (file)
@@ -1930,7 +1930,7 @@ dsync_mailbox_import_local_uid(struct dsync_mailbox_importer *importer,
        /* NOTE: Errors are logged, but they don't cause the entire import
           to fail. */
        if (dsync_mail_fill(mail, TRUE, dmail_r, &error_field) < 0) {
-               errstr = mailbox_get_last_internal_error(mail->box, &error);
+               errstr = mail_get_last_internal_error(mail, &error);
                if (error == MAIL_ERROR_EXPUNGED)
                        return 0;
 
index d3f23c34f30c574f2bf010ecc87acf1577925b21..d3204a95f8c61f79060afe4bd617ca4e016783a5 100644 (file)
@@ -120,7 +120,7 @@ index_mailbox_precache(struct master_connection *conn, struct mailbox *box)
                if (mail_precache(mail) < 0) {
                        e_error(index_event, "Precache for UID=%u failed: %s%s",
                                mail->uid,
-                               mailbox_get_last_internal_error(box, NULL),
+                               mail_get_last_internal_error(mail, NULL),
                                get_attempt_error(counter, first_uid, last_uid));
                        ret = -1;
                        break;
index 6e048fc6422510821790003b5f3f110f9c7d5ff4..804d56979d801f5ecc92c6e2d89e1522119a04a5 100644 (file)
@@ -591,7 +591,7 @@ fts_build_mail_real(struct fts_backend_update_context *update_ctx,
                if (mail->expunged)
                        return 0;
                mail_set_critical(mail, "Failed to read stream: %s",
-                       mailbox_get_last_internal_error(mail->box, NULL));
+                       mail_get_last_internal_error(mail, NULL));
                return -1;
        }
 
index 19320bb12516d3e6c58fda3bc363f4a6044772d3..eea1aeac24a1aee2ab6593a9f86f8be1c4506f76 100644 (file)
@@ -271,7 +271,7 @@ get_hdr_sha1(struct mail *mail, unsigned char sha1_r[STATIC_ARRAY SHA1_RESULTLEN
        int ret;
 
        if (mail_get_hdr_stream(mail, NULL, &input) < 0) {
-               errstr = mailbox_get_last_internal_error(mail->box, &error);
+               errstr = mail_get_last_internal_error(mail, &error);
                e_error(event,
                        "pop3_migration: Failed to get header for msg %u: %s",
                        mail->seq, errstr);
@@ -311,7 +311,7 @@ get_hdr_sha1(struct mail *mail, unsigned char sha1_r[STATIC_ARRAY SHA1_RESULTLEN
           (and/or RETR) and we'll parse the header ourself from it. This
           should work around any similar bugs in all IMAP/POP3 servers. */
        if (mail_get_stream_because(mail, NULL, NULL, "pop3-migration", &input) < 0) {
-               errstr = mailbox_get_last_internal_error(mail->box, &error);
+               errstr = mail_get_last_internal_error(mail, &error);
                e_error(event,
                        "pop3_migration: Failed to get body for msg %u: %s",
                        mail->seq, errstr);
index 5bc673e968cc3015bde0da9f6689615072784953..4450fa43fc88ac8fe40a568b82399d91d4dfedfb 100644 (file)
@@ -1351,7 +1351,7 @@ enum quota_alloc_result quota_try_alloc(struct quota_transaction_context *ctx,
 
        if (quota_get_mail_size(ctx, mail, &size) < 0) {
                enum mail_error err;
-               error = mailbox_get_last_internal_error(mail->box, &err);
+               error = mail_get_last_internal_error(mail, &err);
 
                if (err == MAIL_ERROR_EXPUNGED) {
                        /* mail being copied was already expunged. it'll fail,