Commit Graph

5744 Commits

Author SHA1 Message Date
WofWca
56e66047bf refactor: de-indent transaction fns in chat.rs 2026-08-04 13:29:35 +04:00
WofWca
ea01dd2a98 fix: set_draft mutating real messages (race)
The issue has been introduced in
cf33db3dcb
(https://github.com/chatmail/core/pull/2887).

This, again, has to do with a race where the draft message
is sent in another Future after `get_draft` but before `sql.execute`.

Related:
- 07fa9c35ee
  (https://github.com/chatmail/core/pull/6052).
- df4fd82140
  (https://github.com/chatmail/core/pull/6061).
2026-08-04 13:29:35 +04:00
WofWca
a85ce53680 fix: don't send an already sent draft
Calling `send_msg()` with a draft message that was already sent
(by specifying `msg.id`)
would mutate that message in the DB and try to send it again.

Additionally, `prepare_msg_raw` now errors out
if the draft is not present in the database.
Previosuly the `UPDATE` query would simply update 0 rows
and we would proceed with trying to send a message
without having it in the `msgs` table.

The bug has been introduced in cf33db3dcb
(https://github.com/chatmail/core/pull/2887).

Semantically this makes `prepare_msg_raw` API less generic,
narrowing down its `update_msg_id` function only to drafts.
The "update draft" is anyway the only use case so far
for this parameter.
Thus this also removes the ability to specify an ID
that is different from `msg.id`, as was suggested in
https://github.com/chatmail/core/pull/2887#discussion_r767256419.
These IDs were always the same anyway.

Maybe it would make sense to, instead of returning an error
if the draft is already sent or does not exist,
simply upsert a new message without looking at `msg.id`,
as we would do with non-draft `msg.state`s,
but I wasn't sure how CFFI users (DC Android and DC iOS)
would take that.
So for now let's simply return an error instead of messing up the DB.
2026-08-04 13:29:22 +04:00
WofWca
6bd6fa9b5f test: add test_dont_send_sent_draft
Currently failing due to a bug.
2026-08-02 23:31:39 +04:00
Hocuri
dc267fe1fb fix: Don't download pre-message again if it is known already (#8488)
There was a bug in prefetch_should_download() that it made it return
true for pre-messages even when they were already downloaded. This meant
that pre-messages were downloaded from all relays, rather than just one,
wasting internet data.

The fix is in rfc724_mid_download_tried(), which is used by
prefetch_should_download() to determine whether a message was already
downloaded.

---------

Co-authored-by: l <link2xt@testrun.org>
2026-08-01 10:48:24 +00:00
link2xt
62d3f3877f refactor: mark enabled ephemeral timer duration as NonZero
Now the type system ensures that Timer::Enabled
never stores 0 value inside accidentally,
it is impossible to put 0 there without unsafe code.
2026-07-31 23:55:49 +00:00
Hocuri
db13d08f6c feat: Basic multi-relay onboarding (#8444)
If multi-relay onboarding config is set from UIs, automatically add
relays until there are 3 relays. For now, there will be a hardcoded list
of relay candidates.

- We need a list of chatmail relays that we somehow trust, and that
agree to be in the list. Then, we add all of them to the candidate list
(a new SQL table with colums "host" and "last_tried").
- Before going to IMAP IDLE: When there are less than 3 relays, fill it
up with relays from the candidate list. If creating an account fails,
try again with another relay from the list. For each candidate, we need
to remember the last time we tried to add a transport there, and try at
most once a week or so per candidate.
- For now, this will be behind an off-by-default config option, which at
least DC Android will enable when creating a new profile. UIs can then
opt in on their own pace but will likely need to disable it for tests.
- Right now, the backoff times are: Try to add a relay at most once per
hour, and try to add the same relay at most once per week
2026-07-31 13:14:43 +02:00
link2xt
3d50f3c9a3 refactor: do not clean imap_send table on transport change
imap_send table is not unused anymore
and should eventually be deleted.
It only exists for compatibility
and no other SQL statements use it anymore.
2026-07-30 16:54:04 +00:00
holger krekel
35555ca753 api!: remove getPushState() and core's internal tracking of it.
Since https://github.com/deltachat/deltachat-ios/pull/3224 pushstate is not used
(android, desktop etc. never used it, only ios)
2026-07-30 17:32:54 +02:00
holger krekel
0bb3d88bc6 feat: stop requiring XDELTAPUSH capability for push notifications
register device token if XDELTAPUSH IMAP capability is available (current relay setup provides it)
or if "maxsmtprecipients" IMAP metadata key is available (relays since May 2026 provide it),
allowing chatmail relay setups to drop XDELTAPUSH capability marker with the next release
while retaining push notification support.
2026-07-30 17:32:54 +02:00
link2xt
e74ffb6e93 docs: add missing slash to ConnectionSecurity::Starttls doc comment 2026-07-29 23:50:59 +00:00
link2xt
bbcfa5e40e chore: disable "large futures" lint again
The lint is reasonable, but without some work
to bring the future sizes way below the limit,
this lint is frequently triggered in unrelated PRs
that just add some local variables to async functions
or extend some structure that is passed on the stack.
2026-07-29 00:47:39 +00:00
WofWca
7223d7ed74 refactor: un-nest prepare_msg_blob 2026-07-28 12:22:42 +04:00
holger krekel
00e1d00dfa fix: send MDNs to all authentic relays of a contact, not just whatever get_addr() returns. 2026-07-27 21:54:42 +02:00
holger krekel
856ea29c47 feat: reduce unncessary gossipping of keys in group chats
- treat an Autocrypt header as a kind of Autocrypt-Gossip: addr=<self>
  letting it participate in the existing cooperative key gossipping mechanics.

- speed up processing of incoming autocrypt-gossip headers by using
  1 sql commit for N gossip headers instead of the current N commits.
2026-07-27 21:54:42 +02:00
holger krekel
6a07a2b222 feat: send Autocrypt pgp key in MDNs occassionally and when relaylist changes 2026-07-27 21:54:42 +02:00
Jagoda Estera Ślązak
afb1d0dba8 refactor: Unify naming of direct/single/1:1/normal chats (#8442)
Unifies internal naming of single/direct/1:1/normal chats
to match the naming used in the API.

Closes: #8368
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>

---------

Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
2026-07-27 16:31:09 +02:00
Jagoda Estera Ślązak
df4197df56 fix: Don't warn about correct EXIF orientation values. (#8483)
`unwrap_or` is eagerly evaluated,
which caused always printing the WARN log,
even if EXIF orientation value is correct
(and not ignored).

Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
2026-07-27 14:08:14 +00:00
WofWca
9b7b32a536 docs: clarify ChatId::do_set_draft() docs
Related:
- https://github.com/chatmail/core/pull/6212.
- https://github.com/chatmail/core/pull/2887.
2026-07-27 17:18:37 +04:00
Hocuri
682baff1b9 refactor: Remove FolderMeaning and target_folder (#8456)
The `FolderMeaning` and the `target_folder()` function and related code
were needed for the message moving logic. The message moving logic isn't
needed anymore, so, this PR is a first step to remove it.

We only ever look at one folder by now (usually the Inbox folder), so,
any message moving logic isn't needed anymore because we will never
notice a message that is supposed to be moved.

The `target` column of the `imap` table is mostly the same as the
`folder` column now. Except when the message is supposed to be deleted,
then it's an empty string.
2026-07-27 14:53:58 +02:00
link2xt
850ac0831f refactor: use the new regex! macro
It was introduced in regex crate 1.13.0
2026-07-26 13:21:40 +00:00
holger krekel
cd4850668f fix: migrate transports configured on 2.56 to also have a oauth:false flag
also fix test setup to include the oauth:false flag
2026-07-25 15:38:29 +02:00
Hocuri
98a902b2de fix: Re-add oauth2 to serialized structs (#8464)
fix https://github.com/chatmail/core/issues/8463

Followup to https://github.com/chatmail/core/pull/8431: Re-dd `oauth2`
to the two structs that serialized and sent over the wire. This solves
an incompatibility problem where transports could not be synced to older
versions of DC, and profiles could not be transferred, because the
deserializer expected the field to be present.

I now added `#[serde(default)]`, so that with this PR, Delta Chat will
be compatible with both v2.56 and with older versions.
2026-07-25 14:12:06 +02:00
link2xt
234e491172 fix: never merge outer To headers if standard header protection is used 2026-07-24 11:59:59 +00:00
holger krekel
7ec888f48a remove hermes/aco-connexion special casing and simplify/address link2xt comments 2026-07-24 13:22:13 +02:00
holger krekel
eccd5ce03a address link2xt comments 2026-07-24 13:22:13 +02:00
holger krekel
3c171d539b fixup CI failures 2026-07-24 13:22:13 +02:00
holger krekel
0a71e181e4 add nauta.cu, hermes.radio and *.aco-connexion.org legacy options 2026-07-24 13:22:13 +02:00
holger krekel
1ac1917172 api!: remove provider-db handling and provider lookup APIs
BREAKING CHANGE: provider lookup APIs were removed from CFFI and JSON-RPC.

also removes offline provider database code and generated provider data,
provider-specific fields in configure/transport paths, and REPL providerinfo.
2026-07-24 13:22:13 +02:00
B. Petersen
7e257aa25f refactor: use correct variable name 2026-07-24 10:10:55 +02:00
holger krekel
461a328915 api!: remove heartbeat push notifications
Heartbeat notifications are only used on iOS for classic mail servers
but both code and privacy wise (notification server sees IP addresses from those users)
not something we want to support any longer (was discussed with bjoern).
2026-07-24 00:04:14 +02:00
holger krekel
0e4574cd41 feat: read SMTP recipient limit from relay IMAP metadata
Remove is_chatmail flag, and rely on IMAP metadata
advertising the recipients limit (usually 1000),
falling back to 50 (or fewer in some exceptional cases)
just as before when is_chatmail was false.

Also, server metadata is now keyed per transport,
which in the future eases collecting ICE servers
from all relays (instead of just any first relay).
2026-07-22 20:31:50 +02:00
link2xt
bdd9d96844 feat: accept messages from key contacts with forged From address
From address is not used for key contacts
other than as the address to send replies to.
2026-07-21 19:59:32 +00:00
holger krekel
61898b4789 fix: revert 207c2e6e4c because some users reported problems with it 2026-07-21 18:55:22 +02:00
holger krekel
5c1e695237 api!: remove all oauth support and drop DC_LP_AUTH flags
BREAKING CHANGE: removed oauth2 module, dc_get_oauth2_url FFI function, DC_LP_AUTH flags and configured/serverflags, and the oauth2 parameter/field from SMTP/IMAP clients, JSON-RPC interfaces, and CLI tools.

also contains regenerated provider data after dropping oauth in the update script.
2026-07-21 15:55:28 +02:00
link2xt
1721c0316a feat: do not set backup_time in exported databases
backup_time is unused, it is only set, but nobody reads it.
2026-07-21 12:02:39 +00:00
Jagoda Estera Ślązak
85db29bdfb fix: Apply reactions that arrived before the message at later time (#8415)
A new table `pending_reactions` is now used,
to store reactions that arrived before the referenced message.

When receiving a new message, pending_reactions is checked and any
reactions that arrived earlier are applied.

Fixes: #8367

Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
2026-07-20 13:50:05 +00:00
Hocuri
23c216c84b fix: Update last_rcvd_timestamp in migration (#8434)
Fix https://github.com/chatmail/core/issues/8429
2026-07-20 15:17:36 +02:00
Hocuri
d34dd40aa0 feat: Automatically remove oldest unpublished relay in order to make space when the user wants to add more; don't allow more than 5 relays overall (#8428)
Unpublished relays aren't shown in the list of relays anymore, and can't
be deleted manually. Therefore, we want to automatically delete them in
order to make space for more relays when the limit (5) is reached and
the user wants to add another relay.
2026-07-20 15:11:13 +02:00
link2xt
ebd1c20997 fix: do not log errors if full message is not available on any transport
Before this change "Err" case spams the logs with
"Failed to download message rfc724_mid=...: IMAP location for ... post-message is unknown."
logged by every transports when the message is not available on any transport.
2026-07-20 09:50:27 +00:00
Jagoda Estera Ślązak
0c40b52ec8 fix: Un-escape message footer marks in full messages (get_html) (#8427)
Un-escapes footer marks in long plain-text messages when retrieved with
`get_message_html`/`dc_get_msg_html`.

Additionally, makes escaping stricter,
only matching lines starting with `-- ` instead of `--`.

Fixes: #8269

Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
2026-07-20 09:44:14 +02:00
link2xt
aadd11a771 feat(imap): use CAPABILITY response code if LOGIN command returns it
This saves one round trip during connection establishment
if the server returns capabilities in the LOGIN command response already.
2026-07-17 21:36:45 +00:00
iequidoo
e2b67d20fb refactor: Remove GROUP BY c.id from chatlist queries
Not clear why `GROUP BY` was needed -- a chat can't appear in the selected rows multiple times
because we do JOIN on the last message in the chat, there can't be multiple last messages.
2026-07-16 20:03:49 -03:00
iequidoo
0560c13ae5 perf: Add timestamp to msgs_index7 and speed up Chatlist::try_load() (#7848)
This speeds up chatlisting by 3--4 times on my biggest profile, so the difference is visually
noticeable, particularly after dropping disk caches. Before, `msgs_index2` was used which has less
ordering and requires a full scan of `msgs` table.
2026-07-16 20:03:49 -03:00
link2xt
1a24bf612a refactor: label the loop iterating over the candidates
The loop is large, so having an explicit label
makes it easier to understand what the "continue" statement does.
2026-07-16 09:49:41 +00:00
link2xt
492741ac60 fix(imap): do not bubble up errors in IMAP candidate loop
Network errors such as timeouts should not break out of the loop
by bubbling up errors. There may be more candidates to try,
breaking out of the loop skips trying them.
2026-07-16 09:49:41 +00:00
link2xt
d940f96a5c feat: limit the number of published relays instead of all relays 2026-07-15 17:24:58 +00:00
Jagoda Estera Ślązak
5d0e5efc94 feat: Remove hidden relays automatically (#8402)
Automatically remove relays that are hidden (`is_published=0`) and
haven't been used to receive new messages for over 90 days.

Closes: #8384

Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
2026-07-15 12:31:11 +00:00
link2xt
ce2d237ffd refactor: remove unnecessary reference in format string 2026-07-14 11:14:36 +00:00
link2xt
5adf7454ea ci: update Rust to 1.97.0 2026-07-12 13:10:21 +00:00