From 428ef11157d2dc0b15bc83736ab87011df79f43e Mon Sep 17 00:00:00 2001 From: link2xt Date: Tue, 15 Nov 2022 17:19:32 +0300 Subject: [PATCH] Add IMAP UIDs to message info (#3755) --- CHANGELOG.md | 1 + src/message.rs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d82a9a0af..4d410ef85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Changes - add `configured_inbox_folder` to account info #3748 - `dc_delete_contact()` hides contacts if referenced #3751 +- add IMAP UIDs to message info #3755 ### Fixes - improve IMAP logging, in particular fix incorrect "IMAP IDLE protocol diff --git a/src/message.rs b/src/message.rs index d9e2a2558..600bbc8f1 100644 --- a/src/message.rs +++ b/src/message.rs @@ -1122,6 +1122,28 @@ pub async fn get_msg_info(context: &Context, msg_id: MsgId) -> Result { } if !msg.rfc724_mid.is_empty() { ret += &format!("\nMessage-ID: {}", msg.rfc724_mid); + + let server_uids = context + .sql + .query_map( + "SELECT folder, uid FROM imap WHERE rfc724_mid=?", + paramsv![msg.rfc724_mid], + |row| { + let folder: String = row.get("folder")?; + let uid: u32 = row.get("uid")?; + Ok((folder, uid)) + }, + |rows| { + rows.collect::, _>>() + .map_err(Into::into) + }, + ) + .await?; + + for (folder, uid) in server_uids { + // Format as RFC 5092 relative IMAP URL. + ret += &format!("\n", folder, uid); + } } let hop_info: Option = context .sql