Files
chatmail-core/deltachat-rpc-client
Hocuri 961cacd795 fix: Correctly delete unneeded messages on the server; Remove "Delete Messages from Server" (delete_server_after) config option (#8240)
Fix https://github.com/chatmail/core/issues/8195
Supersedes https://github.com/chatmail/core/pull/8217

The most interesting change is in `delete_expired_imap_messages()`
because there, messages are marked for deletion on single-device
chatmail profiles.

The logic in `delete_expired_imap_messages()` was wrong before, and
pre-messages were not deleted at all. This is fixed by also querying
`pre_rfc724_mid` in addition to `rfc724_mid` from the `msgs` table.
In order not to make the SQL statement too complex, I split it into two.

WRT tests:
- `test_immediate_autodelete()` tests the auto-deletion;
`test_imap_autodelete_fully_downloaded_msg()` tests that even for a
message that is split into pre- and post-message, both messages are
deleted.
- A lot of tests test that if bcc_self is on, messages are not
auto-deleted. E.g. `test_one_account_send_bcc_setting()` and
`test_markseen_message_and_mdn()` relies on the fact that messages stay
on the server when bcc_self is on.
- Unfortunately, it is not possible to test that messages are only
deleted for chatmail servers, because we don't have any tests that use a
non-chatmail server.
2026-05-22 16:45:50 +00:00
..

Delta Chat RPC python client

RPC client connects to standalone Delta Chat RPC server deltachat-rpc-server and provides asynchronous interface to it. rpc.start() performs a health-check RPC call to verify the server started successfully and will raise an error if startup fails (e.g. if the accounts directory could not be used).

Getting started

To use Delta Chat RPC client, first build a deltachat-rpc-server with cargo build -p deltachat-rpc-server or download a prebuilt release. Install it anywhere in your PATH.

Create a virtual environment if you don't have one already and activate it.

$ python -m venv env
$ . env/bin/activate

Install deltachat-rpc-client from source:

$ cd deltachat-rpc-client
$ pip install .

Testing

  1. Build deltachat-rpc-server with cargo build -p deltachat-rpc-server.
  2. Install tox pip install -U tox
  3. Run CHATMAIL_DOMAIN=ci-chatmail.testrun.org PATH="../target/debug:$PATH" tox.

Additional arguments to tox are passed to pytest, e.g. tox -- -s does not capture test output.

Activating current checkout of deltachat-rpc-client and -server for development

Go to root repository directory and run:

$ scripts/make-rpc-testenv.sh 
$ source venv/bin/activate 

Using in REPL

Setup a development environment:

$ tox --devenv env
$ . env/bin/activate
$ python
>>> from deltachat_rpc_client import *
>>> rpc = Rpc()
>>> rpc.start()
>>> dc = DeltaChat(rpc)
>>> system_info = dc.get_system_info()
>>> system_info["level"]
'awesome'
>>> rpc.close()