Skip to content

Commit c758fcd

Browse files
committed
feat: Don't download group messages unconditionally
There was a comment that group messages should always be downloaded to avoid inconsistent group state, but this is solved by the group consistency algo nowadays in the sense that inconsistent group state won't spread to other members if we send to the group. Moreover, encrypted messages are now always downloaded, and unencrypted chat replies too, and as for ad-hoc groups, `Config::ShowEmails` controls everything.
1 parent 91c0894 commit c758fcd

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

src/imap.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::calls::{create_fallback_ice_servers, create_ice_servers_from_metadata
2727
use crate::chat::{self, ChatId, ChatIdBlocked, add_device_msg};
2828
use crate::chatlist_events;
2929
use crate::config::Config;
30-
use crate::constants::{self, Blocked, Chattype, ShowEmails};
30+
use crate::constants::{self, Blocked, ShowEmails};
3131
use crate::contact::{Contact, ContactId, Modifier, Origin};
3232
use crate::context::Context;
3333
use crate::events::EventType;
@@ -2230,21 +2230,6 @@ pub(crate) fn create_message_id() -> String {
22302230
format!("{}{}", GENERATED_PREFIX, create_id())
22312231
}
22322232

2233-
/// Returns chat by prefetched headers.
2234-
async fn prefetch_get_chat(
2235-
context: &Context,
2236-
headers: &[mailparse::MailHeader<'_>],
2237-
) -> Result<Option<chat::Chat>> {
2238-
let parent = get_prefetch_parent_message(context, headers).await?;
2239-
if let Some(parent) = &parent {
2240-
return Ok(Some(
2241-
chat::Chat::load_from_db(context, parent.get_chat_id()).await?,
2242-
));
2243-
}
2244-
2245-
Ok(None)
2246-
}
2247-
22482233
/// Determines whether the message should be downloaded based on prefetched headers.
22492234
pub(crate) async fn prefetch_should_download(
22502235
context: &Context,
@@ -2263,15 +2248,6 @@ pub(crate) async fn prefetch_should_download(
22632248
// We do not know the Message-ID or the Message-ID is missing (in this case, we create one in
22642249
// the further process).
22652250

2266-
if let Some(chat) = prefetch_get_chat(context, headers).await?
2267-
&& chat.typ == Chattype::Group
2268-
&& !chat.id.is_special()
2269-
{
2270-
// This might be a group command, like removing a group member.
2271-
// We really need to fetch this to avoid inconsistent group state.
2272-
return Ok(true);
2273-
}
2274-
22752251
let maybe_ndn = if let Some(from) = headers.get_header_value(HeaderDef::From_) {
22762252
let from = from.to_ascii_lowercase();
22772253
from.contains("mailer-daemon") || from.contains("mail-daemon")

0 commit comments

Comments
 (0)