@@ -405,8 +405,11 @@ pub(crate) async fn receive_imf_inner(
405405 received_msg = None ;
406406 }
407407
408- let verified_encryption =
409- has_verified_encryption ( context, & mime_parser, from_id, & to_ids) . await ?;
408+ let verified_encryption = has_verified_encryption ( & mime_parser, from_id) ?;
409+
410+ if verified_encryption == VerifiedEncryption :: Verified {
411+ mark_recipients_as_verified ( context, from_id, & to_ids, & mime_parser) . await ?;
412+ }
410413
411414 if verified_encryption == VerifiedEncryption :: Verified
412415 && mime_parser. get_header ( HeaderDef :: ChatVerified ) . is_some ( )
@@ -3059,23 +3062,12 @@ async fn update_verified_keys(
30593062/// Checks whether the message is allowed to appear in a protected chat.
30603063///
30613064/// This means that it is encrypted and signed with a verified key.
3062- ///
3063- /// Also propagates gossiped keys to verified if needed.
3064- async fn has_verified_encryption (
3065- context : & Context ,
3065+ fn has_verified_encryption (
30663066 mimeparser : & MimeMessage ,
30673067 from_id : ContactId ,
3068- to_ids : & [ ContactId ] ,
30693068) -> Result < VerifiedEncryption > {
30703069 use VerifiedEncryption :: * ;
30713070
3072- // We do not need to check if we are verified with ourself.
3073- let to_ids = to_ids
3074- . iter ( )
3075- . copied ( )
3076- . filter ( |id| * id != ContactId :: SELF )
3077- . collect :: < Vec < ContactId > > ( ) ;
3078-
30793071 if !mimeparser. was_encrypted ( ) {
30803072 return Ok ( NotVerified ( "This message is not encrypted" . to_string ( ) ) ) ;
30813073 } ;
@@ -3104,21 +3096,24 @@ async fn has_verified_encryption(
31043096 }
31053097 }
31063098
3107- mark_recipients_as_verified ( context, from_id, to_ids, mimeparser) . await ?;
31083099 Ok ( Verified )
31093100}
31103101
31113102async fn mark_recipients_as_verified (
31123103 context : & Context ,
31133104 from_id : ContactId ,
3114- to_ids : Vec < ContactId > ,
3105+ to_ids : & [ ContactId ] ,
31153106 mimeparser : & MimeMessage ,
31163107) -> Result < ( ) > {
31173108 if mimeparser. get_header ( HeaderDef :: ChatVerified ) . is_none ( ) {
31183109 return Ok ( ( ) ) ;
31193110 }
31203111 let contact = Contact :: get_by_id ( context, from_id) . await ?;
3121- for id in to_ids {
3112+ for & id in to_ids {
3113+ if id == ContactId :: SELF {
3114+ continue ;
3115+ }
3116+
31223117 let Some ( ( to_addr, is_verified) ) = context
31233118 . sql
31243119 . query_row_optional (
0 commit comments