Skip to content

Commit 3f94638

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 20c845e commit 3f94638

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

src/imap.rs

Lines changed: 1 addition & 24 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;
@@ -2229,21 +2229,6 @@ pub(crate) fn create_message_id() -> String {
22292229
format!("{}{}", GENERATED_PREFIX, create_id())
22302230
}
22312231

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

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

0 commit comments

Comments
 (0)