Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
0110d6d
fix python lint errors
Simon-Laux Oct 31, 2025
e7751ce
receive pre-mesages, start with changes to imap loop.
Simon-Laux Nov 9, 2025
31a91d2
simplify code a bit
Simon-Laux Nov 12, 2025
c928c4b
refactor: move download code from `scheduler.rs` to `download.rs`, also
Simon-Laux Nov 12, 2025
6985536
`MAX_FETCH_MSG_SIZE` is no longer unused
Simon-Laux Nov 12, 2025
45de7cd
Parse if it is a pre-message or full-message
Simon-Laux Nov 14, 2025
fa063da
start with receiving logic
Simon-Laux Nov 14, 2025
a5d9ed2
get rid of `MsgId::get_by_rfc724_mid` because it was a duplicate of
Simon-Laux Nov 14, 2025
511d4d2
docs: add hint to `MimeMessage::from_bytes` stating that it has
Simon-Laux Nov 16, 2025
38e2745
receiving full message
Simon-Laux Nov 16, 2025
07a8d2f
send and receive `attachment_size` and set viewtype to text in
Simon-Laux Nov 16, 2025
c260576
metadata as struct in pre-message in header. And fill params that we can
Simon-Laux Nov 22, 2025
7f3d2f5
api: jsonrpc: add `full_message_view_type` to `Message` and
Simon-Laux Nov 22, 2025
ea511d4
apply clippy suggestion
Simon-Laux Nov 22, 2025
ce7e62e
make PreMsgMetadata.to_header_value not consume self/PreMsgMetadata
Simon-Laux Nov 22, 2025
f5577d9
add api to merge params
Simon-Laux Nov 23, 2025
ca6bf65
on download full message: merge new params into old params and remove
Simon-Laux Nov 23, 2025
b9a4c43
move tests to `src/tests/pre_messages.rs`
Simon-Laux Nov 29, 2025
f1f9868
dynamically allocate test attachment bytes
Simon-Laux Nov 30, 2025
01cee7e
fix detection of pre-messages. (it looked for the ChatFullMessageId
Simon-Laux Nov 30, 2025
59b55e3
fix setting dl state to avaiable on pre-messages
Simon-Laux Nov 30, 2025
91e8f67
fix: save pre message with rfc724_mid of full message als disable
Simon-Laux Nov 30, 2025
d361eeb
add some receiving tests and update test todo for premessage metadata
Simon-Laux Nov 30, 2025
5230aba
test: process full message before pre-message
Simon-Laux Nov 30, 2025
99610b2
test receive normal message
Simon-Laux Nov 30, 2025
15fa49b
some serialization tests for PreMsgMetadata
Simon-Laux Nov 30, 2025
6042d17
remove outdated todo comment
Simon-Laux Nov 30, 2025
9cff662
test that pre-message contains message text
Simon-Laux Nov 30, 2025
1ae1a34
PreMsgMetadata: test_build_from_file_msg and test_build_from_file_msg
Simon-Laux Nov 30, 2025
b5629e9
test: test_receive_pre_message_image
Simon-Laux Nov 30, 2025
156d5b8
Test receiving the full message after receiving an edit after receiving
Simon-Laux Nov 30, 2025
957e967
test_reaction_on_pre_message
Simon-Laux Nov 30, 2025
4bbe0c1
test_full_download_after_trashed
Simon-Laux Nov 30, 2025
59ca831
test_webxdc_update_for_not_downloaded_instance
Simon-Laux Nov 30, 2025
477e2ee
simplify fake webxdc generation in
Simon-Laux Nov 30, 2025
5e499d8
test_markseen_pre_msg
Simon-Laux Nov 30, 2025
9803b30
test_pre_msg_can_start_chat and test_full_msg_can_start_chat
Simon-Laux Nov 30, 2025
0934daf
test_download_later_keeps_message_order
Simon-Laux Nov 30, 2025
d70bfcd
test_chatlist_event_on_full_msg_download
Simon-Laux Nov 30, 2025
ad429a8
fix download not working
Simon-Laux Dec 2, 2025
5ebcc71
log splitting into pre-message
Simon-Laux Dec 2, 2025
4a4d4bd
add pre-message info to text when loading from db. this can be disabled
Simon-Laux Dec 3, 2025
b497927
update `download_limit` documentation
Simon-Laux Dec 3, 2025
9e63bdb
more logging: log size of pre and post messages
Simon-Laux Dec 3, 2025
33ae135
rename full message to Post-Message
Simon-Laux Dec 3, 2025
23cd8a6
split up the pre-message tests into multiple files
Simon-Laux Dec 3, 2025
6b476c9
dedup test code by extracting code to create test messages into util
Simon-Laux Dec 3, 2025
62ec9a4
remove post_message_view_type from api, now it is only used internally
Simon-Laux Dec 3, 2025
2a3d5a3
remove `hide_pre_message_metadata_text` config option, as there
Simon-Laux Dec 3, 2025
e013cee
Update src/download.rs
Simon-Laux Dec 3, 2025
921ae6d
resolve comment
Simon-Laux Dec 3, 2025
2b44fff
use `parse_message_id` instead of removing `<>`parenthesis it manually
Simon-Laux Dec 3, 2025
326072d
fix available_post_msgs gets no entries
Simon-Laux Dec 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions deltachat-ffi/deltachat.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,11 @@ char* dc_get_blobdir (const dc_context_t* context);
* 0=use IMAP IDLE if the server supports it.
* This is a developer option used for testing polling used as an IDLE fallback.
* - `download_limit` = Messages up to this number of bytes are downloaded automatically.
* For larger messages, only the header is downloaded and a placeholder is shown.
* For messages with large attachements, two messages are sent:
* a Pre-Message containing metadata and a Post-Message containing the attachment.
* Pre-Messages are always downloaded and show a placeholder message
* These messages can be downloaded fully using dc_download_full_msg() later.
* The limit is compared against raw message sizes, including headers.
* The actually used limit may be corrected
* to not mess up with non-delivery-reports or read-receipts.
* Post-Messages are automatically downloaded if they are smaller than the download_limit.
* 0=no limit (default).
* Changes affect future messages only.
* - `protect_autocrypt` = Enable Header Protection for Autocrypt header.
Expand Down Expand Up @@ -4283,7 +4283,8 @@ char* dc_msg_get_webxdc_info (const dc_msg_t* msg);

/**
* Get the size of the file. Returns the size of the file associated with a
* message, if applicable.
* message, if applicable.
* If message is a pre-message, then this returns size of the to be downloaded file.
*
* Typically, this is used to show the size of document files, e.g. a PDF.
*
Expand Down
2 changes: 2 additions & 0 deletions deltachat-jsonrpc/src/api/types/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ pub struct MessageObject {

file: Option<String>,
file_mime: Option<String>,
/// Returns the size of the file in bytes, if applicable.
/// If message is a pre-message, then this returns size of the to be downloaded file.
file_bytes: u64,
file_name: Option<String>,

Expand Down
2 changes: 1 addition & 1 deletion deltachat-rpc-client/tests/test_something.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import pytest

from deltachat_rpc_client import Contact, EventType, Message, events
from deltachat_rpc_client.const import DownloadState, MessageState
from deltachat_rpc_client.const import MessageState
from deltachat_rpc_client.pytestplugin import E2EE_INFO_MSGS
from deltachat_rpc_client.rpc import JsonRpcError

Expand Down
33 changes: 27 additions & 6 deletions src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::time::Duration;
use anyhow::{Context as _, Result, anyhow, bail, ensure};
use chrono::TimeZone;
use deltachat_contact_tools::{ContactAddress, sanitize_bidi_characters, sanitize_single_line};
use humansize::{BINARY, format_size};
use mail_builder::mime::MimePart;
use serde::{Deserialize, Serialize};
use strum_macros::EnumIter;
Expand Down Expand Up @@ -2735,10 +2736,10 @@ async fn prepare_send_msg(
Ok(row_ids)
}

/// Renders the message or Full-Message and Pre-Message.
/// Renders the Message or splits it into Post-Message and Pre-Message.
///
/// Pre-Message is a small message with metadata which announces a larger Full-Message.
/// Full messages are not downloaded in the background.
/// Pre-Message is a small message with metadata which announces a larger Post-Message.
/// Post-Messages are not downloaded in the background.
///
/// If pre-message is not nessesary this returns a normal message instead.
async fn render_mime_message_and_pre_message(
Expand All @@ -2755,9 +2756,14 @@ async fn render_mime_message_and_pre_message(
> PRE_MSG_ATTACHMENT_SIZE_THRESHOLD;

if needs_pre_message {
let mut mimefactory_full_msg = mimefactory.clone();
mimefactory_full_msg.set_as_full_message();
let rendered_msg = mimefactory_full_msg.render(context).await?;
info!(
context,
"Message is large and will be split into a pre- and a post-message.",
);

let mut mimefactory_post_msg = mimefactory.clone();
mimefactory_post_msg.set_as_post_message();
let rendered_msg = mimefactory_post_msg.render(context).await?;

let mut mimefactory_pre_msg = mimefactory;
mimefactory_pre_msg.set_as_pre_message_for(&rendered_msg);
Expand Down Expand Up @@ -2861,6 +2867,21 @@ pub(crate) async fn create_send_msg_jobs(context: &Context, msg: &mut Message) -
}
}?;

if let (post_msg, Some(pre_msg)) = (&rendered_msg, &rendered_pre_msg) {
info!(
context,
"Message Sizes: Pre-Message {}; Post-Message: {}",
format_size(pre_msg.message.len(), BINARY),
format_size(post_msg.message.len(), BINARY)
);
} else {
info!(
context,
"Message will be sent as normal message (no pre- and post message). Size: {}",
format_size(rendered_msg.message.len(), BINARY)
);
}

if needs_encryption && !rendered_msg.is_encrypted {
/* unrecoverable */
message::set_msg_failed(
Expand Down
15 changes: 7 additions & 8 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ impl Context {
convert_folder_meaning(self, folder_meaning).await?
{
connection
.fetch_move_delete(self, &mut session, &watch_folder, folder_meaning)
.fetch_move_delete(self, &mut session, true, &watch_folder, folder_meaning)
.await?;
}
}
Expand All @@ -605,6 +605,12 @@ impl Context {
warn!(self, "Failed to update quota: {err:#}.");
}
}

// OPTIONAL TODO: if time left start downloading messages
// while (msg = download_when_normal_starts) {
// if not time_left {break;}
// connection.download_message(msg) }
// }
}

info!(
Expand Down Expand Up @@ -1061,13 +1067,6 @@ impl Context {
.await?
.to_string(),
);
res.insert(
"fail_on_receiving_full_msg",
self.sql
.get_raw_config("fail_on_receiving_full_msg")
.await?
.unwrap_or_default(),
);

let elapsed = time_elapsed(&self.creation_time);
res.insert("uptime", duration_to_str(elapsed));
Expand Down
2 changes: 1 addition & 1 deletion src/context/context_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ async fn test_get_info_completeness() {
"encrypted_device_token",
"stats_last_update",
"stats_last_old_contact_id",
"simulate_receive_imf_error",
"simulate_receive_imf_error", // only used in tests
];
let t = TestContext::new().await;
let info = t.get_info().await.unwrap();
Expand Down
Loading
Loading