@@ -335,13 +335,7 @@ pub(crate) async fn receive_imf_inner(
335335 & mime_parser. recipients ,
336336 & mime_parser. gossiped_keys ,
337337 & [ ] , // TODO use To fingerprints
338- if !mime_parser. incoming {
339- Origin :: OutgoingTo
340- } else if incoming_origin. is_known ( ) {
341- Origin :: IncomingTo
342- } else {
343- Origin :: IncomingUnknownTo
344- } ,
338+ Origin :: Hidden
345339 )
346340 . await ?;
347341
@@ -354,8 +348,14 @@ pub(crate) async fn receive_imf_inner(
354348 lookup_pgp_contacts_by_address_list ( context, & mime_parser. past_members , & past_members_fingerprints, chat_id)
355349 . await ?;
356350 } else {
357- // TODO: lookup by fingerprints if they are available.
358- past_ids = vec ! [ None ; mime_parser. past_members. len( ) ] ;
351+ past_ids = add_or_lookup_pgp_contacts_by_address_list (
352+ context,
353+ & mime_parser. past_members ,
354+ & mime_parser. gossiped_keys ,
355+ & past_members_fingerprints,
356+ Origin :: Hidden
357+ )
358+ . await ?;
359359 }
360360 } else {
361361 if pgp_to_ids. len ( ) == 1
@@ -3176,17 +3176,22 @@ async fn add_or_lookup_pgp_contacts_by_address_list(
31763176 origin : Origin ,
31773177) -> Result < Vec < Option < ContactId > > > {
31783178 let mut contact_ids = Vec :: new ( ) ;
3179+ let mut fingerprint_iter = fingerprints. iter ( ) ;
31793180 for info in address_list {
31803181 let addr = & info. addr ;
31813182 if !may_be_valid_addr ( addr) {
31823183 contact_ids. push ( None ) ;
31833184 continue ;
31843185 }
3185- let Some ( key) = gossiped_keys. get ( addr) else {
3186+ let fingerprint: String = if let Some ( fp) = fingerprint_iter. next ( ) {
3187+ // Iterator has not ran out of fingerprints yet.
3188+ fp. hex ( )
3189+ } else if let Some ( key) = gossiped_keys. get ( addr) {
3190+ key. dc_fingerprint ( ) . hex ( )
3191+ } else {
31863192 contact_ids. push ( None ) ;
31873193 continue ;
31883194 } ;
3189- let fingerprint = key. dc_fingerprint ( ) . hex ( ) ;
31903195 let display_name = info. display_name . as_deref ( ) ;
31913196 if let Ok ( addr) = ContactAddress :: new ( addr) {
31923197 let ( contact_id, _) = Contact :: add_or_lookup_ex (
@@ -3279,6 +3284,8 @@ async fn lookup_pgp_contacts_by_address_list(
32793284 fingerprints : & [ Fingerprint ] ,
32803285 chat_id : ChatId ,
32813286) -> Result < Vec < Option < ContactId > > > {
3287+ // TODO: create a contact with a given fingerprint
3288+ // if fingerprint is available.
32823289 let mut contact_ids = Vec :: new ( ) ;
32833290 for info in address_list {
32843291 let addr = & info. addr ;
0 commit comments