mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
fix: make should_do_gossip() return true even if we send securejoin only to Alice
This commit is contained in:
@@ -359,20 +359,25 @@ impl<'a> MimeFactory<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn should_do_gossip(&self, context: &Context) -> Result<bool> {
|
async fn should_do_gossip(&self, context: &Context, multiple_recipients: bool) -> Result<bool> {
|
||||||
match &self.loaded {
|
match &self.loaded {
|
||||||
Loaded::Message { chat } => {
|
Loaded::Message { chat } => {
|
||||||
// beside key- and member-changes, force a periodic re-gossip.
|
let cmd = self.msg.param.get_cmd();
|
||||||
let gossiped_timestamp = chat.id.get_gossiped_timestamp(context).await?;
|
if cmd == SystemMessage::MemberAddedToGroup
|
||||||
let gossip_period = context.get_config_i64(Config::GossipPeriod).await?;
|
|| cmd == SystemMessage::SecurejoinMessage
|
||||||
if time() >= gossiped_timestamp + gossip_period {
|
{
|
||||||
Ok(true)
|
Ok(true)
|
||||||
|
} else if multiple_recipients {
|
||||||
|
// beside key- and member-changes, force a periodic re-gossip.
|
||||||
|
let gossiped_timestamp = chat.id.get_gossiped_timestamp(context).await?;
|
||||||
|
let gossip_period = context.get_config_i64(Config::GossipPeriod).await?;
|
||||||
|
if time() >= gossiped_timestamp + gossip_period {
|
||||||
|
Ok(true)
|
||||||
|
} else {
|
||||||
|
Ok(false)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let cmd = self.msg.param.get_cmd();
|
Ok(false)
|
||||||
// Do gossip in all Securejoin messages not to complicate the code. There's no
|
|
||||||
// need in gossips in "vg-auth-required" messages f.e., but let them be.
|
|
||||||
Ok(cmd == SystemMessage::MemberAddedToGroup
|
|
||||||
|| cmd == SystemMessage::SecurejoinMessage)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loaded::Mdn { .. } => Ok(false),
|
Loaded::Mdn { .. } => Ok(false),
|
||||||
@@ -698,9 +703,9 @@ impl<'a> MimeFactory<'a> {
|
|||||||
.fold(message, |message, header| message.header(header));
|
.fold(message, |message, header| message.header(header));
|
||||||
|
|
||||||
// Add gossip headers in chats with multiple recipients
|
// Add gossip headers in chats with multiple recipients
|
||||||
if (peerstates.len() > 1 || context.get_config_bool(Config::BccSelf).await?)
|
let multiple_recipients =
|
||||||
&& self.should_do_gossip(context).await?
|
peerstates.len() > 1 || context.get_config_bool(Config::BccSelf).await?;
|
||||||
{
|
if self.should_do_gossip(context, multiple_recipients).await? {
|
||||||
for peerstate in peerstates.iter().filter_map(|(state, _)| state.as_ref()) {
|
for peerstate in peerstates.iter().filter_map(|(state, _)| state.as_ref()) {
|
||||||
if let Some(header) = peerstate.render_gossip_header(verified) {
|
if let Some(header) = peerstate.render_gossip_header(verified) {
|
||||||
message = message.header(Header::new("Autocrypt-Gossip".into(), header));
|
message = message.header(Header::new("Autocrypt-Gossip".into(), header));
|
||||||
|
|||||||
Reference in New Issue
Block a user