@@ -359,20 +359,25 @@ impl<'a> MimeFactory<'a> {
359
359
}
360
360
}
361
361
362
- async fn should_do_gossip ( & self , context : & Context ) -> Result < bool > {
362
+ async fn should_do_gossip ( & self , context : & Context , multiple_recipients : bool ) -> Result < bool > {
363
363
match & self . loaded {
364
364
Loaded :: Message { chat } => {
365
- // beside key- and member-changes, force a periodic re-gossip.
366
- let gossiped_timestamp = chat . id . get_gossiped_timestamp ( context ) . await ? ;
367
- let gossip_period = context . get_config_i64 ( Config :: GossipPeriod ) . await ? ;
368
- if time ( ) >= gossiped_timestamp + gossip_period {
365
+ let cmd = self . msg . param . get_cmd ( ) ;
366
+ if cmd == SystemMessage :: MemberAddedToGroup
367
+ || cmd == SystemMessage :: SecurejoinMessage
368
+ {
369
369
Ok ( true )
370
+ } else if multiple_recipients {
371
+ // beside key- and member-changes, force a periodic re-gossip.
372
+ let gossiped_timestamp = chat. id . get_gossiped_timestamp ( context) . await ?;
373
+ let gossip_period = context. get_config_i64 ( Config :: GossipPeriod ) . await ?;
374
+ if time ( ) >= gossiped_timestamp + gossip_period {
375
+ Ok ( true )
376
+ } else {
377
+ Ok ( false )
378
+ }
370
379
} else {
371
- let cmd = self . msg . param . get_cmd ( ) ;
372
- // Do gossip in all Securejoin messages not to complicate the code. There's no
373
- // need in gossips in "vg-auth-required" messages f.e., but let them be.
374
- Ok ( cmd == SystemMessage :: MemberAddedToGroup
375
- || cmd == SystemMessage :: SecurejoinMessage )
380
+ Ok ( false )
376
381
}
377
382
}
378
383
Loaded :: Mdn { .. } => Ok ( false ) ,
@@ -698,9 +703,9 @@ impl<'a> MimeFactory<'a> {
698
703
. fold ( message, |message, header| message. header ( header) ) ;
699
704
700
705
// Add gossip headers in chats with multiple recipients
701
- if ( peerstates . len ( ) > 1 || context . get_config_bool ( Config :: BccSelf ) . await ? )
702
- && self . should_do_gossip ( context) . await ?
703
- {
706
+ let multiple_recipients =
707
+ peerstates . len ( ) > 1 || context. get_config_bool ( Config :: BccSelf ) . await ?;
708
+ if self . should_do_gossip ( context , multiple_recipients ) . await ? {
704
709
for peerstate in peerstates. iter ( ) . filter_map ( |( state, _) | state. as_ref ( ) ) {
705
710
if let Some ( header) = peerstate. render_gossip_header ( verified) {
706
711
message = message. header ( Header :: new ( "Autocrypt-Gossip" . into ( ) , header) ) ;
0 commit comments