Skip to content

refactor(mimefactory): separate rendering of message payload and sendable message#8345

Draft
link2xt wants to merge 1 commit into
link2xt/location-streaming-fixesfrom
link2xt/last_added_location_timestamp
Draft

refactor(mimefactory): separate rendering of message payload and sendable message#8345
link2xt wants to merge 1 commit into
link2xt/location-streaming-fixesfrom
link2xt/last_added_location_timestamp

Conversation

@link2xt

@link2xt link2xt commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

This change separates rendering into two separate steps:

  1. Rendering of the message payload without the From, Date and Autocrypt headers.
  2. Adding the From, Date and Autocrypt headers and possibly encrypting the message.

The goal is to have serializable result of the first step
that can be persisted in the database and sent later with any email address.
This way it will be possible to send queued messages over any relay.

This will make it possible not to remove all messages from the queue
when the sending relay is changed.
Currently changing configured_addr deletes everything from smtp table.

This change is however only a refactoring and does not implement any features.


This is a refactoring PR in preparation for automatic relay failover.

As a side effect it also makes possible to change the Date of the message for #8112 if we decide on this approach (unlikely).

Serializable mail is currently called mimefactory::QueuedMail. Everything except the public keys is trivially serializable, public keys should likely be serialized as recipient fingerprints rather than as OpenPGP certificates.

I also noticed that we likely can remove the concept of "hidden headers" which are headers that are sent on the mulipart/mixed level of unencrypted messages. They are used to send Chat-Edit headers and avatars in unencrypted messages. Sending avatars in unencrypted messages is not useful because they are not displayed anyway. And we can decide to make it impossible to edit and delete unencrypted messages. I have not changed anything in this PR, however, hidden headers work as before.

Based on #8351

@link2xt link2xt changed the title fix: replace last_added_location_id with last_added_location_timestamp MimeFactory refactoring and fixes Jun 18, 2026
@link2xt link2xt force-pushed the link2xt/last_added_location_timestamp branch 4 times, most recently from 45102bc to 1956c42 Compare June 18, 2026 18:00
@link2xt link2xt marked this pull request as ready for review June 19, 2026 01:33
@link2xt link2xt marked this pull request as draft June 19, 2026 01:33
@link2xt link2xt force-pushed the link2xt/last_added_location_timestamp branch 3 times, most recently from 5f3c57c to f9c33de Compare June 20, 2026 01:02
@link2xt link2xt force-pushed the link2xt/last_added_location_timestamp branch from f9c33de to e314fc0 Compare June 20, 2026 04:25
@link2xt link2xt changed the base branch from main to link2xt/location-streaming-fixes June 20, 2026 04:26
@link2xt link2xt force-pushed the link2xt/location-streaming-fixes branch from 3d4610c to b1b0e3f Compare June 20, 2026 04:29
@link2xt link2xt force-pushed the link2xt/last_added_location_timestamp branch 2 times, most recently from ce43887 to 6abd90c Compare June 20, 2026 19:48
@link2xt link2xt changed the title MimeFactory refactoring and fixes MimeFactory refactoring Jun 20, 2026
@link2xt link2xt force-pushed the link2xt/last_added_location_timestamp branch from 6abd90c to e350dd6 Compare June 20, 2026 20:01
@link2xt link2xt changed the base branch from link2xt/location-streaming-fixes to main June 20, 2026 20:02
@link2xt link2xt force-pushed the link2xt/last_added_location_timestamp branch 3 times, most recently from a18ab11 to 2e20218 Compare June 20, 2026 20:38
@link2xt link2xt force-pushed the link2xt/last_added_location_timestamp branch 5 times, most recently from a39da96 to 1c19dd8 Compare June 22, 2026 10:07
@link2xt link2xt changed the base branch from main to link2xt/location-streaming-fixes June 22, 2026 10:08
@link2xt link2xt changed the title MimeFactory refactoring refactor(mimefactory): separate rendering of message payload and sendable message Jun 22, 2026
…able message

This change separates rendering into two separate steps:
1. Rendering of the message payload without the From, Date and Autocrypt headers.
2. Adding the From, Date and Autocrypt headers and possibly encrypting the message.

The goal is to have serializable result of the first step
that can be persisted in the database and sent later with any email address.
This way it will be possible to send queued messages over any relay.

This will make it possible not to remove all messages from the queue
when the sending relay is changed.
Currently changing `configured_addr` deletes everything from `smtp` table.

This change is however only a refactoring and does not implement any features.
@link2xt link2xt force-pushed the link2xt/last_added_location_timestamp branch from 1c19dd8 to efe7d0f Compare June 22, 2026 10:10
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.

1 participant