Module deltachat::ephemeral

source ·
Expand description

Ephemeral messages.

Ephemeral messages are messages that have an Ephemeral-Timer header attached to them, which specifies time in seconds after which the message should be deleted both from the device and from the server. The timer is started when the message is marked as seen, which usually happens when its contents is displayed on device screen.

Each chat, including 1:1, group chats and “saved messages” chat, has its own ephemeral timer setting, which is applied to all messages sent to the chat. The setting is synchronized to all the devices participating in the chat by applying the timer value from all received messages, including BCC-self ones, to the chat. This way the setting is eventually synchronized among all participants.

When user changes ephemeral timer setting for the chat, a system message is automatically sent to update the setting for all participants. This allows changing the setting for a chat like any group chat setting, e.g. name and avatar, without the need to write an actual message.

Device settings

In addition to per-chat ephemeral message setting, each device has two global user-configured settings that complement per-chat settings: delete_device_after and delete_server_after. These settings are not synchronized among devices and apply to all messages known to the device, including messages sent or received before configuring the setting.

delete_device_after configures the maximum time device is storing the messages locally. delete_server_after configures the time after which device will delete the messages it knows about from the server.

How messages are deleted

When Delta Chat deletes the message locally, it moves the message to the trash chat and removes actual message contents. Messages in the trash chat are called “tombstones” and track the Message-ID to prevent accidental redownloading of the message from the server, e.g. in case of UID validity change.

Vice versa, when Delta Chat deletes the message from the server, it removes IMAP folder and UID row from the imap table, but keeps the message in the msgs table.

Delta Chat eventually removes tombstones from the msgs table, leaving no trace of the message, when it thinks there are no more copies of the message stored on the server, i.e. when there is no corresponding imap table entry. This is done in the prune_tombstones() procedure during housekeeping.

When messages are deleted

The ephemeral_loop task schedules the next due running of delete_expired_messages which in turn emits MsgsChanged events when deleting local messages to make UIs reload displayed messages.

Server deletion happens by updating the imap table based on the database entries which are expired either according to their ephemeral message timers or global delete_server_after setting.


  • Ephemeral timer value.