Skip to content

Conversation

@Simon-Laux
Copy link
Contributor

@Simon-Laux Simon-Laux commented Nov 12, 2025

This PR implements receiving of pre-message, download of full messages and the new logic for deciding what to fetch when from IMAP.

This is part of #7367


progress:

  • changes to imap loop
  • change download table to work with rfc724_mid instead of msg_id (added db migration for it)
  • add a table for available_full_msgs
  • move download logic from scheduler.rs to download.rs
  • receive_imf
    • implement pre message
    • implement full message (if pre message exists then replace only attachment and change view type)
  • Metadata in pre-message in header as struct (atleast attachment size, so UI can ask for correct size to display on dl button)
  • delete metadata params once message is downloaded
  • re-check logic / self review
  • write tests (recycle old tests that I removed in remove: partial downloads (remove creation of the stub messages) #7373 and write new ones)

specific aspects that should become reality:

  • In receive_imf, the full-message can be handled similarly to Chat-Edit (grep for "ChatEdit" in receive_imf.rs).
  • As opposed to the current download-on-demand, we won't replace the whole msgs row, because this way, it will just work if an edit-message is received, and then later the user requests to download the attachment.
    • Need to change Viewtype, probably metadata params like image size
  • pre-message gets Viewtype::Text in the database until downloaded
  • background_fetch should not download messages with the Chat-Is-Full-Message header.
  • background_fetch: If a large message without Chat-Is-Full-Message header. is received, the UI should be notified via an event.
  • A read receipt should be shown already when the user saw the pre-message. feat: pre messages can now get read receipts #7433

API Changes:

  • rust: change Message.get_filebytes - if message is not downloaded pre message, and metadata is available, then it returns the size that the file has after download, so ui can use this to show download size
  • rust: add Message.get_full_message_viewtype to get view type that message will have after being downloaded.
  • jsonrpc: add full_message_view_type to Message and MessageInfo

@Simon-Laux Simon-Laux force-pushed the simon/sending-pre-message branch 3 times, most recently from 2b900c3 to 305498d Compare November 16, 2025 20:07
@Simon-Laux Simon-Laux force-pushed the simon/receive-pre-messages branch 4 times, most recently from b94964a to ce97ba3 Compare November 23, 2025 02:27
@Simon-Laux Simon-Laux force-pushed the simon/receive-pre-messages branch from cd716c5 to 4c14566 Compare November 26, 2025 14:13
Base automatically changed from simon/sending-pre-message to pre-messages November 26, 2025 14:14
@Simon-Laux Simon-Laux force-pushed the simon/receive-pre-messages branch from 4c14566 to ca6bf65 Compare November 26, 2025 15:09

/// 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.
pub async fn get_filebytes(&self, context: &Context) -> Result<Option<u64>> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe modifying this is not the best idea.
A new property/method might be better and easier to understand.

Like when UIs show attachment size of messages for a storage usage UI, then it would always need to check if it is downloaded yet. Could be confusing with thumbnails which also have their own size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants