Skip to content

Commit 8c68528

Browse files
committed
prototype a device-chat
1 parent 077719c commit 8c68528

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

deltachat-ffi/deltachat.h

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2715,6 +2715,42 @@ int dc_chat_is_unpromoted (const dc_chat_t* chat);
27152715
int dc_chat_is_self_talk (const dc_chat_t* chat);
27162716

27172717

2718+
/**
2719+
* Check if a chat is a device-talk.
2720+
* Device-talks contain update information
2721+
* and some hints that are added during the program runs, multi-device etc.
2722+
* The only sender in these chats is usually the contact DC_CONTACT_ID_DEVICE (5).
2723+
*
2724+
* From the ui view, device-talks are not very special,
2725+
* the user can delete and forward messages, archive the chat, set notifications etc.
2726+
*
2727+
* How to create a device-talk and add messages to it:
2728+
* ```
2729+
* device_chat_id = dc_create_chat_by_contact_id(context, DC_CONTACT_ID_DEVICE);
2730+
* dc_send_text_msg(context, device_chat_id, "recent changes ...");
2731+
* ```
2732+
*
2733+
* @memberof dc_chat_t
2734+
* @param chat The chat object.
2735+
* @return 1=chat is device-talk, 0=chat is no device-talk
2736+
*/
2737+
int dc_chat_is_device_talk (const dc_chat_t* chat);
2738+
2739+
2740+
/**
2741+
* Check if messages can be sent to a give chat.
2742+
* This is not true eg. for the deaddrop or for the device-talk, cmp. dc_chat_is_device_talk().
2743+
*
2744+
* Calling dc_send_msg() for these chats will fail
2745+
* and the ui may decide to hide input controls therefore.
2746+
*
2747+
* @memberof dc_chat_t
2748+
* @param chat The chat object.
2749+
* @return 1=chat is writable, 0=chat is not writable
2750+
*/
2751+
int dc_chat_is_writable (const dc_chat_t* chat);
2752+
2753+
27182754
/**
27192755
* Check if a chat is verified. Verified chats contain only verified members
27202756
* and encryption is alwasy enabled. Verified chats are created using
@@ -3370,7 +3406,8 @@ void dc_msg_latefiling_mediasize (dc_msg_t* msg, int width, int hei
33703406

33713407

33723408
#define DC_CONTACT_ID_SELF 1
3373-
#define DC_CONTACT_ID_INFO 2
3409+
#define DC_CONTACT_ID_INFO 2 // centered messages as "member added", used in all chats
3410+
#define DC_CONTACT_ID_DEVICE 5 // messages "update info" in the device-chat
33743411
#define DC_CONTACT_ID_LAST_SPECIAL 9
33753412

33763413

0 commit comments

Comments
 (0)