From 2bcfbe99fa63e96e5b279dd4d45a9b0048087b2a Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 15 Jun 2026 00:30:21 +0200 Subject: [PATCH] fix: do not abort IMAP connection if setting the push token fails With madmail 2.2.2 from https://github.com/themadorg/madmail/releases/download/v2.2.2/madmail-linux-amd64 using IMAP command SETMETADATA to set /private/devicetoken returns error "A0003 BAD command not supported". With this change connection is not aborted anymore and the error is logged like this: src/scheduler.rs:458: Transport 1: Failed to register push token: SETMETADATA command failed: bad response: code: None, info: Some("command not supported"). madmail 2.2.2 however fails to select the INBOX afterwards and the following command `A0004 SELECT "INBOX"` results in `* BAD command not supported` response. Fixes https://github.com/chatmail/core/issues/8334 --- src/scheduler.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/scheduler.rs b/src/scheduler.rs index c336bbb29..ca1c7e590 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -454,10 +454,12 @@ async fn inbox_fetch_idle(ctx: &Context, imap: &mut Imap, mut session: Session) .update_metadata(ctx) .await .context("update_metadata")?; - session - .register_token(ctx) - .await - .context("Failed to register push token")?; + if let Err(err) = session.register_token(ctx).await { + warn!( + ctx, + "Transport {transport_id}: Failed to register push token: {err:#}." + ); + } let session = fetch_idle(ctx, imap, session).await?; Ok(session)