Use Auto-Submitted: auto-generated header to identify bots

New `dc_msg_is_bot()` C API and corresponding `Message.is_bot()`
Python API can be used to check if incoming message is sent by a bot,
e.g. to avoid two echo bots replying indefinitely to each other.

"Bot" flag is not set for outgoing messages, but may be set for
BCC-self messages. For now documentation says that `dc_msg_is_bot()`
return value is unspecified for outgoing messages. It can be better
specified later if needed for specific applications, e.g. sharing an
account with a helper bot.
This commit is contained in:
link2xt
2021-06-19 01:11:48 +03:00
parent bf61c16dc1
commit f820671d53
8 changed files with 119 additions and 1 deletions

View File

@@ -60,6 +60,9 @@ pub enum Param {
/// For Messages
WantsMdn = b'r',
/// For Messages: a message with Auto-Submitted header ("bot").
Bot = b'b',
/// For Messages: unset or 0=not forwarded,
/// 1=forwarded from unknown msg_id, >9 forwarded from msg_id
Forwarded = b'a',