Skip to content

Commit 64c651f

Browse files
committed
docs: clarify CALL events
1 parent 1cc7ce6 commit 64c651f

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

deltachat-ffi/deltachat.h

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,8 +1233,9 @@ uint32_t dc_init_webxdc_integration (dc_context_t* context, uint32_t c
12331233
* callee's other devices receive #DC_EVENT_CALL_ENDED and have a "Cancelled Call",
12341234
*
12351235
* - callee is already in a call:
1236-
* in this case, UI may decide to show a notification instead of ringing.
1237-
* otherwise, this is same as timeout
1236+
* what to do depends on the capabilities of UI to handle calls.
1237+
* if UI cannot handle multiple calls, an easy approach would be to decline the new call automatically
1238+
* and make that visble to the user in the call, e.g. by a notification
12381239
*
12391240
* - timeout:
12401241
* after 1 minute without action,
@@ -1252,6 +1253,13 @@ uint32_t dc_init_webxdc_integration (dc_context_t* context, uint32_t c
12521253
* - callee ends the call using dc_end_call():
12531254
* caller receives #DC_EVENT_CALL_ENDED
12541255
*
1256+
* Contact request handling:
1257+
*
1258+
* - placing or accepting calls implies accepting contact requests
1259+
*
1260+
* - ending a call does not accept a contact request;
1261+
* instead, the call will timeout on all affected devices.
1262+
*
12551263
* Note, that the events are for updating the call screen,
12561264
* possible status messages are added and updated as usual, including the known events.
12571265
* In the UI, the sorted chatlist is used as an overview about calls as well as messages.
@@ -1279,6 +1287,7 @@ uint32_t dc_place_outgoing_call (dc_context_t* context, uint32_t ch
12791287
* either #DC_EVENT_OUTGOING_CALL_ACCEPTED or #DC_EVENT_INCOMING_CALL_ACCEPTED.
12801288
*
12811289
* If the call is already accepted or ended, nothing happens.
1290+
* If the chat is a contact request, it is accepted implicitly.
12821291
*
12831292
* @memberof dc_context_t
12841293
* @param context The context object.
@@ -1299,7 +1308,12 @@ uint32_t dc_place_outgoing_call (dc_context_t* context, uint32_t ch
12991308
* Unaccepted calls ended by the callee are a "decline".
13001309
* If the call was accepted, this is a "hangup".
13011310
*
1302-
* All participant devices get informed about the ended call via #DC_EVENT_CALL_ENDED.
1311+
* All participant devices get informed about the ended call via #DC_EVENT_CALL_ENDED unless they are contact requests.
1312+
* For contact requests, the call times out on all other affected devices.
1313+
*
1314+
* If the message ID is wrong or does not exist for whatever reasons, nothing happends.
1315+
* Therefore, and for resilience, UI should remove the call UI directly when calling
1316+
* this function and not only on the event.
13031317
*
13041318
* If the call is already ended, nothing happens.
13051319
*
@@ -5714,6 +5728,18 @@ int64_t dc_lot_get_timestamp (const dc_lot_t* lot);
57145728

57155729
/**
57165730
* Message indicating an incoming or outgoing call.
5731+
*
5732+
* These messages are created by dc_place_outgoing_call()
5733+
* and should be rendered by UI similar to text messages,
5734+
* maybe with some "phone icon" at the side.
5735+
*
5736+
* The message text is updated as needed
5737+
* and UI will be informed via #DC_EVENT_MSGS_CHANGED as usual.
5738+
*
5739+
* Do not start ringing when seeing this message;
5740+
* the mesage may belong e.g. to an old missed call.
5741+
*
5742+
* Instead, ringing should start on the event #DC_EVENT_INCOMING_CALL
57175743
*/
57185744
#define DC_MSG_CALL 71
57195745

@@ -6725,7 +6751,8 @@ void dc_event_unref(dc_event_t* event);
67256751
*
67266752
* Together with this event,
67276753
* a message of type #DC_MSG_CALL is added to the corresponding chat;
6728-
* this message is announced and updated by the usual even as #DC_EVENT_MSGS_CHANGED.
6754+
* this message is announced and updated by the usual event as #DC_EVENT_MSGS_CHANGED,
6755+
* there is usually no need to take care of this message from any of the CALL events.
67296756
*
67306757
* If user takes action, dc_accept_incoming_call() or dc_end_call() should be called.
67316758
*
@@ -6741,8 +6768,7 @@ void dc_event_unref(dc_event_t* event);
67416768
* The callee accepted an incoming call on this or another device using dc_accept_incoming_call().
67426769
* The caller gets the event #DC_EVENT_OUTGOING_CALL_ACCEPTED at the same time.
67436770
*
6744-
* The event is sent unconditionally when the corresponding message is received.
6745-
* UI should only take action in case call UI was opened before, otherwise the event should be ignored.
6771+
* UI usually only takes action in case call UI was opened before, otherwise the event should be ignored.
67466772
*
67476773
* @param data1 (int) msg_id ID of the message referring to the call
67486774
*/
@@ -6751,20 +6777,18 @@ void dc_event_unref(dc_event_t* event);
67516777
/**
67526778
* A call placed using dc_place_outgoing_call() was accepted by the callee using dc_accept_incoming_call().
67536779
*
6754-
* The event is sent unconditionally when the corresponding message is received.
6755-
* UI should only take action in case call UI was opened before, otherwise the event should be ignored.
6780+
* UI usually only takes action in case call UI was opened before, otherwise the event should be ignored.
67566781
*
67576782
* @param data1 (int) msg_id ID of the message referring to the call
67586783
* @param data2 (char*) accept_call_info, text passed to dc_accept_incoming_call()
67596784
*/
67606785
#define DC_EVENT_OUTGOING_CALL_ACCEPTED 2570
67616786

67626787
/**
6763-
* An incoming or outgoing call was ended using dc_end_call().
6788+
* An incoming or outgoing call was ended using dc_end_call() on this or another device, by caller or callee.
67646789
* Moreover, the event is sent when the call was not accepted within 1 minute timeout.
67656790
*
6766-
* The event is sent unconditionally when the corresponding message is received.
6767-
* UI should only take action in case call UI was opened before, otherwise the event should be ignored.
6791+
* UI usually only takes action in case call UI was opened before, otherwise the event should be ignored.
67686792
*
67696793
* @param data1 (int) msg_id ID of the message referring to the call
67706794
*/

0 commit comments

Comments
 (0)