Skip to content

Commit 79e966d

Browse files
committed
Allow to assign partial downloads to encrypted chats
1 parent 9ac2347 commit 79e966d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/receive_imf.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@ pub(crate) async fn receive_imf_inner(
491491
} else if let Some(parent) = &parent_message {
492492
if let Some((chat_id, chat_id_blocked)) =
493493
// Try to assign to a chat based on In-Reply-To/References.
494-
lookup_chat_by_reply(context, &mime_parser, parent).await?
494+
lookup_chat_by_reply(context, &mime_parser, parent, &is_partial_download)
495+
.await?
495496
{
496497
// Try to assign to a chat based on In-Reply-To/References.
497498
ChatAssignment::ExistingChat {
@@ -517,7 +518,7 @@ pub(crate) async fn receive_imf_inner(
517518
} else if let Some(parent) = &parent_message {
518519
if let Some((chat_id, chat_id_blocked)) =
519520
// Try to assign to a chat based on In-Reply-To/References.
520-
lookup_chat_by_reply(context, &mime_parser, parent).await?
521+
lookup_chat_by_reply(context, &mime_parser, parent, &is_partial_download).await?
521522
{
522523
// Try to assign to a chat based on In-Reply-To/References.
523524
ChatAssignment::ExistingChat {
@@ -2277,6 +2278,7 @@ async fn lookup_chat_by_reply(
22772278
context: &Context,
22782279
mime_parser: &MimeMessage,
22792280
parent: &Message,
2281+
is_partial_download: &Option<u32>,
22802282
) -> Result<Option<(ChatId, Blocked)>> {
22812283
debug_assert!(mime_parser.get_chat_group_id().is_none());
22822284

@@ -2300,7 +2302,10 @@ async fn lookup_chat_by_reply(
23002302
}
23012303

23022304
// Do not assign unencrypted messages to encrypted chats.
2303-
if parent_chat.is_encrypted(context).await? && !mime_parser.was_encrypted() {
2305+
if is_partial_download.is_none()
2306+
&& parent_chat.is_encrypted(context).await?
2307+
&& !mime_parser.was_encrypted()
2308+
{
23042309
return Ok(None);
23052310
}
23062311

0 commit comments

Comments
 (0)