From 5287a3de404ae2c8e38b73c696f3671fee59c205 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 31 Jul 2021 18:17:33 +0300 Subject: [PATCH] dc_receive_imf: avoid cloning rfc724_mid String --- src/dc_receive_imf.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index 578f91ca2..269167b4d 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -104,6 +104,10 @@ pub(crate) async fn dc_receive_imf_inner( // client that relies in the SMTP server to generate one. // true eg. for the Webmailer used in all-inkl-KAS dc_create_incoming_rfc724_mid(&mime_parser)); + info!( + context, + "received message {} has Message-Id: {}", server_uid, rfc724_mid + ); // check, if the mail is already in our database - if so, just update the folder/uid // (if the mail was moved around) and finish. (we may get a mail twice eg. if it is @@ -171,7 +175,7 @@ pub(crate) async fn dc_receive_imf_inner( server_folder, server_uid, &to_ids, - &rfc724_mid, + rfc724_mid, &mut sent_timestamp, from_id, &mut hidden, @@ -282,11 +286,6 @@ pub(crate) async fn dc_receive_imf_inner( } } - info!( - context, - "received message {} has Message-Id: {}", server_uid, rfc724_mid - ); - if let Some(create_event_to_send) = create_event_to_send { for (chat_id, msg_id) in created_db_entries { let event = match create_event_to_send { @@ -360,7 +359,7 @@ async fn add_parts( server_folder: &str, server_uid: u32, to_ids: &ContactIds, - rfc724_mid: &str, + rfc724_mid: String, sent_timestamp: &mut i64, from_id: u32, hidden: &mut bool, @@ -938,9 +937,6 @@ async fn add_parts( let is_hidden = *hidden; let chat_id = chat_id; - // TODO: can this clone be avoided? - let rfc724_mid = rfc724_mid.to_string(); - let mut is_hidden = is_hidden; let mut ids = Vec::with_capacity(parts.len());