@@ -2715,6 +2715,42 @@ int dc_chat_is_unpromoted (const dc_chat_t* chat);
2715
2715
int dc_chat_is_self_talk (const dc_chat_t * chat );
2716
2716
2717
2717
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
+
2718
2754
/**
2719
2755
* Check if a chat is verified. Verified chats contain only verified members
2720
2756
* 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
3370
3406
3371
3407
3372
3408
#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
3374
3411
#define DC_CONTACT_ID_LAST_SPECIAL 9
3375
3412
3376
3413
0 commit comments