From: Karl Fleischmann Date: Wed, 1 Feb 2023 17:00:18 +0000 (+0100) Subject: global: Access mail errors directly instead of mailbox errors X-Git-Tag: 2.4.0~2985 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2699441cb7ab82b210c2a111bb08e8ee00ce279e;p=thirdparty%2Fdovecot%2Fcore.git global: Access mail errors directly instead of mailbox errors --- diff --git a/src/doveadm/doveadm-mail-deduplicate.c b/src/doveadm/doveadm-mail-deduplicate.c index f1759fd5c4..c0c18ae153 100644 --- a/src/doveadm/doveadm-mail-deduplicate.c +++ b/src/doveadm/doveadm-mail-deduplicate.c @@ -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, diff --git a/src/doveadm/doveadm-mail-fetch.c b/src/doveadm/doveadm-mail-fetch.c index 98bea6479d..8597476802 100644 --- a/src/doveadm/doveadm-mail-fetch.c +++ b/src/doveadm/doveadm-mail-fetch.c @@ -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; diff --git a/src/doveadm/doveadm-mail-index.c b/src/doveadm/doveadm-mail-index.c index e808debc1d..853e65ed65 100644 --- a/src/doveadm/doveadm-mail-index.c +++ b/src/doveadm/doveadm-mail-index.c @@ -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; } diff --git a/src/doveadm/dsync/dsync-mailbox-import.c b/src/doveadm/dsync/dsync-mailbox-import.c index 8f2b1171aa..07f0733fba 100644 --- a/src/doveadm/dsync/dsync-mailbox-import.c +++ b/src/doveadm/dsync/dsync-mailbox-import.c @@ -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; diff --git a/src/indexer/master-connection.c b/src/indexer/master-connection.c index d3f23c34f3..d3204a95f8 100644 --- a/src/indexer/master-connection.c +++ b/src/indexer/master-connection.c @@ -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; diff --git a/src/plugins/fts/fts-build-mail.c b/src/plugins/fts/fts-build-mail.c index 6e048fc642..804d56979d 100644 --- a/src/plugins/fts/fts-build-mail.c +++ b/src/plugins/fts/fts-build-mail.c @@ -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; } diff --git a/src/plugins/pop3-migration/pop3-migration-plugin.c b/src/plugins/pop3-migration/pop3-migration-plugin.c index 19320bb125..eea1aeac24 100644 --- a/src/plugins/pop3-migration/pop3-migration-plugin.c +++ b/src/plugins/pop3-migration/pop3-migration-plugin.c @@ -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); diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index 5bc673e968..4450fa43fc 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -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,