Commit Graph

10513 Commits

Author SHA1 Message Date
holger krekel
cc229372e4 test: provide complete test isolation by not re-using account addresses
As we are using a dedicated CI relay instance, we don't need to be careful with creating test addresses.
But re-using test addresses in a test running in a single worker can leak events/messages which compromises test isolation.
Instead of encountering random flaky tests because let's just not cache addresses to maximize test isolation.
2026-08-12 22:04:15 +02:00
link2xt
292bd9f58d docs: do not talk about verified chats in securejoin QR-scanning functions
The chat is always going to be encrypted, this is enough.
We actually do mark the contact as verified,
but the meaning of this verification is unclear
and we don't even display it visibly in the chat anymore.
2026-08-12 19:28:32 +00:00
link2xt
998892395a docs: do not refer to is_chat_protected()
is_chat_protected() does not exist anymore.
2026-08-12 19:28:32 +00:00
link2xt
9f5fbcdcae api!: remove deprecated dc_chat_is_protected() 2026-08-12 19:28:32 +00:00
link2xt
d89a972a2c refactor: stop setting chats.protected column explicitly
It is not used anymore and has a default value of 0.
2026-08-12 19:28:32 +00:00
link2xt
ae5b27fb69 refactor: remove MessengerMessage
This value is not used for any logic
except the disappearing messages timer rollback prevention.
It is unlikely that non-chat clients
participate in chats with disappearing messages,
and the case was not tested anyway.
2026-08-12 07:44:38 +00:00
WofWca
1a41e42bda docs(json-rpc): improve reactions_by_contact doc
Sync `reactions_by_contact` with the "backend" struct docs.

Follow-up to bd846c6e43
(https://github.com/chatmail/core/pull/8450).
2026-08-12 01:03:38 +04:00
B. Petersen
c680432c23 fix: filtered reactions are info, not error in device chat
bail!() bubbles up the error until it lands in the device chat,
which is way over the top for a reaction that is filtered out by channel owner.

currently this happens, as arcance chat uses different default reactions.
in the future, this may happen even more often when we allow custom filters,
that may change over time.
2026-08-11 21:49:38 +02:00
Jagoda Estera Ślązak
4623d89528 feat: Add stock strings for being added/removed from group (#8562)
Adds following stock strings:
- You were removed by %1$s.
- You were added by %1$s.

and implicit equivalents:
- You were removed.
- You were added.

Closes: #8419

Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
2026-08-11 18:47:30 +00:00
holger krekel
5ec1d65294 test: move iroh tests into separate module 2026-08-11 18:08:58 +02:00
holger krekel
8df4fe1c17 test: fix flakyness of iroh tests by sending "forever" so that late swarm-joins still make the test work
previously only 10 messages were sent but if joinining did not succeed (due to slow CI sometimes) nothing would be received and the test would hang.

Also cleans up the tests to not set webxdc realtime config (true by default) and restructure helpers to reduce redundant code.
2026-08-11 13:13:03 +02:00
link2xt
c3563f73e4 chore: bump version to 2.59.0-dev 2026-08-11 03:07:37 +00:00
Hocuri
e15820fbd5 chore(release): prepare for 2.58.0 v2.58.0 2026-08-10 20:05:56 +02:00
biørn
68ce93c420 feat: resend pinned state in broadcast channels (#8549)
this PR adds the "message pinned state" to the "reaction state" that is
already sent together with resent channel messages since #8496.
this change is done in the first commit, and in fact only changes few
lines (one can consider to rename "broadcast_reactions.rs" and related
stuff to "broadcast_state.rs" in another PR: i did not to that in this
PR to keep diff and review simple).

moreover, in the second commit ,the "selection of messages to resent" is
changed to keep an additional focus on the pinned messages, so that the
most recent pinned messages are resent as well.

successor of #8496 and #8546
2026-08-10 17:22:29 +00:00
Jagoda Estera Ślązak
fd8c56894a test: Assert log warnings and errors (#8457)
Adds `assert_warn`, `assert_error` and `assert_warns_or_errors`
methods to `TestContext`, that let us assert that
a certain warning or error is logged during the test.
Also asserts test logs should not contain any other
errors or warnings.

Adjusts tests accordingly.

Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
2026-08-10 13:36:09 +00:00
WofWca
97932fda07 fix: improve connectivity HTML if quota info error
Currently if there is an error fetching quota
then the HTML displays something like

```
example.com: Connected
Failed to parse
```

It's not clear that "Failed to parse" only refers to quota info.
2026-08-10 12:55:08 +00:00
holger krekel
cd42efb36d fix!: keep primary transport device-local
Devices no longer implicitely use the From address of sync messages
to determine their primary transport. Receivers have no concept of it and own devices
may disagree on which relay is reachable because of VPN or different networks:

1. Make setting a primary transport (`configured_addr`) a per-device non-synced operation.

2. Transport rows (add/remove/unpublish) keep syncing like before.

3. A device reelects a primary if a sync message unpublished/removed the current primary
   if there is a better candidate.

4. `TransportsModified` event is emitted at most once on an incoming transport sync message.

Users will notice the change in that changing primary transport in settings/advanced/relays
will not synchronize to other devices anymore.
2026-08-10 14:43:28 +02:00
holger krekel
2cacdbfd4b fix: prevent transport de-synchronization because of early fetch cancellation
Came across this while investigating more test_transport_synchronization flakiness,
sometimes missing TransportsModified events or getting a missing configured_addr.
The underlying problem was that stopping IO was triggered immediately during
receiving sync messages, potentially *canceling* the processing of the sync message,
effectively de-syncing the device's view on transports.
2026-08-10 14:20:59 +02:00
holger krekel
67437c946b test: wait for second TRANSPORTS_MODIFIED before asserting configured_addr 2026-08-10 14:20:59 +02:00
holger krekel
6934aa26ae fix: invalidate configured_addr cache before sending transport sync message
Uncaching only after send_sync_transports() could send the sync message
from the old primary address, so other devices never switched.
2026-08-10 14:20:59 +02:00
holger krekel
c3bc26d52f fix: ensure same-second primary transport change propagates correctly
Without the fix, too fast transport changes are ignored at the receiver side.
2026-08-10 14:20:59 +02:00
biørn
805e555a99 fix: multi relay connectivity (#8550)
this PR, created together with @adbenitez, improves the connectivity
state passed to UI, which has changed a lot since multi relay:

- change the algorithm for `get_connectivity()`: this is roughly the
"best" connectivity of all relays now, so if one is connected, we're
already fine. this was discussed widely one to one, and that part
already closes #8554

- the PR adds a test for that, previously, that was untested

- additionally, do not regard unpublished relays in
`get_connectivity()`: e.g. unpublished relays are no longer given to
peers - so if only that is connected, the overall state should not be
"connected". therefore, we just ignore unpublished relays there

- in `get_connectivity_html()`, we continue showing unpublished relays,
however, we tune them down visually and flag them as such

- for the docs, remove the "range for some future use" wording. it was
never used like that, and that future will probably not arrive :)

<img width="320"
src="https://github.com/user-attachments/assets/1805c525-72d1-4197-b865-6e2d6fbc8819"
/>

---------

Co-authored-by: Hocuri <hocuri@gmx.de>
2026-08-09 20:31:16 +00:00
B. Petersen
137ac9a027 updating pinned state only allowed if 'from' is part of the chat 2026-08-07 17:29:34 +02:00
B. Petersen
a7632fe356 do not bubble up errors for unpinnable messages, add a test for handle_pinned_state_from_wire() 2026-08-07 17:29:34 +02:00
B. Petersen
476fbf72e3 add NOT NULL, remove hidden=0 2026-08-07 17:29:34 +02:00
biørn
a6f33d7474 Update src/pinned_messages.rs
Co-authored-by: l <link2xt@testrun.org>
2026-08-07 17:29:34 +02:00
B. Petersen
bd0c0b6b4b feat: add "pinned messages" API 2026-08-07 17:29:34 +02:00
B. Petersen
1247d5da36 use Chat-Broadcast-States: header insted of -Reactions:
the wire format is already prepared to carry information additionally to reactions,
so let the header name reflect that as well.

in practise, we might want to use a `pinned` flag very soon
in case pinned messages got resent in channels.
it makes sense if that flag goes to the message as such,
and not to an extra message.
and then it makes sense to not introduce a new things.

ftr, this is about resending state to other members,
it is not about syncing across devices for the same user.

the code as such is not changed by this PR,
it is only a wording preparation, of a header that is not even visible.
if we semantically put things other than reactions to the wire format,
we may want to move it out of `broadcast_reactions.rs`
2026-08-05 14:32:27 +02:00
biørn
93d9a4be1c feat: allow only default reactions (#8545)
the UIs are currently advised
to only allow the five default reactions in broadcast channels.
this PR ensures that from sending site as well as receiving site.

soon, we probably want to make the possible reactions configurable, this
PR is mainly for some safety until then. once we have an API to change
default reactions, we can also easily test "invalid" reactions on the
receiving side; currently only sending is tested

successor of https://github.com/chatmail/core/pull/8450

---------

Co-authored-by: Jagoda Estera Ślązak <128227338+j-g00da@users.noreply.github.com>
2026-08-05 10:22:19 +02:00
biørn
b13b150997 resend broadcast reactions together with message (#8496)
this PR resends reactions together with channel messages.
2026-08-04 19:24:23 +02:00
biørn
bd846c6e43 broadcast channel reactions (#8450)
this PR adds support for reactions in broadcast channels.

> the idea of broadcast reactions is that they are sent as usual from
subscribers to owner. after some time, the owner broadcasts them to all
subscribers, who only get to see reaction+count, not who-reacted-what

the PR is quite large, but a good share are tests and otherwise many
things are straight forward.

review should be done by-file, not by-commit. to make review easier,
here is a high-level overview:

first a change in the existing internal `Reactions` object was required.
before this PR, `Reactions` had a "contact to reaction map" only, and
the "frequencies map", that are actually mainly needed for UI, were
calculated as needed. with this PR, the "frequencies map" is the field
that always exist, the "contact map" is only available on top of that.
moreover, this PR shifts that part to the core, it was unfortunately in
the bindings before.

with that preparation things done as follows:

1. reactions from broadcast channel subscriber (`Chattype::InBroadcast`)
to broadcast channel owner (`Chattype::OutBroadcast`) are sent as usual,
only change for that step was to allow sending them at all

2. the owner receives reactions and saves them to the existing
`reactions` table as usual. additionally, the changed message is
remembered in `reactions_need_broadcast` table

3. in the IMAP loop, when ~10 minutes have passed, and
`reactions_need_broadcast` contains entries, a single, hidden message
with accumulated reactions is sent. this message may contain reactions
to different messages. for each message, all known reactions are sent as
reaction+count.

4. subscriber receive that message and save the accumulated reactions in
`reactions_broadcasted`

6. `get_message_reactions` is adapted so that `frequencies` are set
independently of who-reacted-what (the old and only field).
who-reacted-what is called `by_contact` now. it is always set for
compatibility reasons, however, it is not exhaustive for subscribers.
in general, UI should work with frequencies, the API itself, however,
has not changed.

other tweaks:

- outgoing channels are muted on creation, and UI shall allow to
unmute/mute them as all other chats. reason is that reactions are
notified, but in many cases not of large interest. this is also what
telegram is doing

- to have an intermediate feedback when reacting, the local state should
include ones own reaction, even if it is not yet broadcasted. for that,
we modify `reactions_broadcasted` using `modify_frequencies()` as needed
when sending an reaction. there are still some situations where the
update may not include ones own reaction, in this case it is added
lately by `refine_frequencies()`, so that `get_message_reactions()`
always contain SELF.
(in a first implementation, we always increased SELF reaction in
refine_frequencies(), however, that was worse and led to SELF counted
twice once the owner sent broadcast)

<details>
<summary>wire format</summary>

wire format is a JSON in the `Broadcast-Reactions:` header.
additionally, `Content-Disposition: reaction` is set to not show the
hidden message on existing devices.

using a header also allows us to broadcast reactions with resent channel
messages (on joining) later.

```
{
  "messages": [
    {
      "id": "12345678",
      "reactions": [
        { "emoji": "👍", "count": 4 },
        { "emoji": "🎉", "count": 2 }
      ]
    },
    {
      "id": "23456789",
      "reactions": []
    }
  ]
}
```

for `id`, the wire format needs to use `rfc724_mid` as `msg_id` are
local only.

</details>

### known issues

- if the channel owner uses multiple devices, broadcasted reaction
updates are sent from each device. the updates are not that big, so that
is probably not a big deal. if it turns out that this is an issue, we
can think about fixes in another PR. might be done by restarting our
10-minute-wait once we see an update from another device

- we cannot set contact_id for DC_EVENT_REACTIONS_CHANGED - but i doubt
it was ever used

### for another pr

- ~~add `Broadcast-Reactions:` header also for resent channel messages,
so that new subscriber do not only get the latest messages, but also
their reactions. for that, the `Broadcast-Reactions:` header can go to
the corresponding message, no need to send extra messages. we would need
to change the sending part to send all reactions for a given message. on
receiving part, we need to make sure, `receive_broadcast_reactions()` is
called when the message actually exist.~~
EDIT: subsequent PR for resending broadcast reactions at
https://github.com/chatmail/core/pull/8496

- add api to allow only a subset of reactions, fiter incoming reactions
before broadcasting

### misc.

ui pr: https://github.com/deltachat/deltachat-ios/pull/3225 and
https://github.com/deltachat/deltachat-android/pull/4560 , which both
were tested successfully with this core PR already. desktop is meant to
be done once this is merged

---------

Co-authored-by: l <link2xt@testrun.org>
2026-08-04 18:54:17 +02:00
Hocuri
547d22a3e3 test: Add test for unencrypted headers (#8538)
This adds a test for the unencrypted headers, because
https://github.com/chatmail/core/pull/8345/ changes how these are
rendered, and so far we didn't have any tests for them.
2026-08-04 11:57:57 +00:00
link2xt
7990e17859 refactor(mimefactory): separate rendering of message payload and sendable 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.
2026-08-04 11:57:57 +00:00
Hocuri
487d33f4d7 clippy 2026-08-04 11:47:26 +02:00
Hocuri
e45667b547 test: Make the test check for the exact set of recipients 2026-08-04 11:47:26 +02:00
Hocuri
5eab324751 test: Add test_bcc_self 2026-08-04 11:47:26 +02:00
holger krekel
15387690c8 follow link2xt review comments 2026-08-04 11:47:26 +02:00
holger krekel
ba35814d34 fix: recognize self addresses in various places (instead of just the "primary") 2026-08-04 11:47:26 +02:00
link2xt
2ac217ddd4 feat: send messages to 5 relays instead of the newest 3 ones
Otherwise users may add up to 5 relays, but 2 oldest relays
are actually ignored.

Having the maximum number of published relays
and the number of relays used the same between all clients
makes the order of relays in the key irrelevant.
We may even remove sorting by `add_timestamp`
from `get_all_self_addrs()` in the future.
2026-08-03 14:04:15 +00:00
link2xt
8e60ed7d89 perf: Box::pin iroh::endpoint::Builder::bind
It is has a size of 13k and increases the size of all futures calling it as a result,
while only being used for initialization.
2026-08-03 13:54:49 +00:00
link2xt
fab974f31e feat: collect ICE servers from all relays 2026-08-03 13:38:40 +00:00
dependabot[bot]
154e47dace chore(cargo): bump libc from 0.2.186 to 0.2.189
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.186 to 0.2.189.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.189/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.186...0.2.189)

---
updated-dependencies:
- dependency-name: libc
  dependency-version: 0.2.189
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-02 18:40:19 +00:00
link2xt
99d202a973 api(ffi): store reference-counted Context in dc_chatlist_t 2026-08-02 17:22:56 +00:00
link2xt
ae02b6dcfc api!: remove dc_chatlist_get_context()
This API is dangerous because returned pointer
is only valid until the chatlist is freed,
and may accidentally be passed into dc_context_unref().
2026-08-02 17:22:56 +00:00
link2xt
e1f5858fa3 api(ffi): store reference-counted Context in dc_contact_t 2026-08-02 17:22:56 +00:00
link2xt
abfc1b9a76 api(ffi): store reference-counted Context in dc_msg_t
The change is similar to the change done to dc_chat_t
in b5acbaa31c
2026-08-02 17:22:56 +00:00
dependabot[bot]
77d2d037f2 chore(cargo): bump thiserror from 2.0.18 to 2.0.19
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 2.0.18 to 2.0.19.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/2.0.18...2.0.19)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-version: 2.0.19
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-02 17:10:27 +00:00
link2xt
057d6c0c5e refactor: reduce the scope of unsafe in dc_context_unref() 2026-08-02 17:09:56 +00:00
dependabot[bot]
21e08d7e95 chore(cargo): bump serde from 1.0.228 to 1.0.229
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.228 to 1.0.229.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.228...v1.0.229)

---
updated-dependencies:
- dependency-name: serde
  dependency-version: 1.0.229
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-02 04:13:46 +00:00
dependabot[bot]
03c1ea9942 chore(cargo): bump anyhow from 1.0.103 to 1.0.104
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.103 to 1.0.104.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.103...1.0.104)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-version: 1.0.104
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-02 04:13:27 +00:00