mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56:30 +03:00
feat: add IncomingCallAccepted.from_this_device
This commit is contained in:
@@ -6755,6 +6755,7 @@ void dc_event_unref(dc_event_t* event);
|
|||||||
* UI usually only takes action in case call UI was opened before, otherwise the event should be ignored.
|
* UI usually only takes action in case call UI was opened before, otherwise the event should be ignored.
|
||||||
*
|
*
|
||||||
* @param data1 (int) msg_id ID of the message referring to the call
|
* @param data1 (int) msg_id ID of the message referring to the call
|
||||||
|
* @param data2 (int) 1 if the call was accepted from this device (process).
|
||||||
*/
|
*/
|
||||||
#define DC_EVENT_INCOMING_CALL_ACCEPTED 2560
|
#define DC_EVENT_INCOMING_CALL_ACCEPTED 2560
|
||||||
|
|
||||||
|
|||||||
@@ -680,7 +680,6 @@ pub unsafe extern "C" fn dc_event_get_data2_int(event: *mut dc_event_t) -> libc:
|
|||||||
| EventType::ChatModified(_)
|
| EventType::ChatModified(_)
|
||||||
| EventType::ChatDeleted { .. }
|
| EventType::ChatDeleted { .. }
|
||||||
| EventType::WebxdcRealtimeAdvertisementReceived { .. }
|
| EventType::WebxdcRealtimeAdvertisementReceived { .. }
|
||||||
| EventType::IncomingCallAccepted { .. }
|
|
||||||
| EventType::OutgoingCallAccepted { .. }
|
| EventType::OutgoingCallAccepted { .. }
|
||||||
| EventType::CallEnded { .. }
|
| EventType::CallEnded { .. }
|
||||||
| EventType::EventChannelOverflow { .. }
|
| EventType::EventChannelOverflow { .. }
|
||||||
@@ -703,6 +702,9 @@ pub unsafe extern "C" fn dc_event_get_data2_int(event: *mut dc_event_t) -> libc:
|
|||||||
} => status_update_serial.to_u32() as libc::c_int,
|
} => status_update_serial.to_u32() as libc::c_int,
|
||||||
EventType::WebxdcRealtimeData { data, .. } => data.len() as libc::c_int,
|
EventType::WebxdcRealtimeData { data, .. } => data.len() as libc::c_int,
|
||||||
EventType::IncomingCall { has_video, .. } => *has_video as libc::c_int,
|
EventType::IncomingCall { has_video, .. } => *has_video as libc::c_int,
|
||||||
|
EventType::IncomingCallAccepted {
|
||||||
|
from_this_device, ..
|
||||||
|
} => *from_this_device as libc::c_int,
|
||||||
|
|
||||||
#[allow(unreachable_patterns)]
|
#[allow(unreachable_patterns)]
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -441,6 +441,8 @@ pub enum EventType {
|
|||||||
msg_id: u32,
|
msg_id: u32,
|
||||||
/// ID of the chat which the message belongs to.
|
/// ID of the chat which the message belongs to.
|
||||||
chat_id: u32,
|
chat_id: u32,
|
||||||
|
/// The call was accepted from this device (process).
|
||||||
|
from_this_device: bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Outgoing call accepted.
|
/// Outgoing call accepted.
|
||||||
@@ -634,9 +636,14 @@ impl From<CoreEventType> for EventType {
|
|||||||
place_call_info,
|
place_call_info,
|
||||||
has_video,
|
has_video,
|
||||||
},
|
},
|
||||||
CoreEventType::IncomingCallAccepted { msg_id, chat_id } => IncomingCallAccepted {
|
CoreEventType::IncomingCallAccepted {
|
||||||
|
msg_id,
|
||||||
|
chat_id,
|
||||||
|
from_this_device,
|
||||||
|
} => IncomingCallAccepted {
|
||||||
msg_id: msg_id.to_u32(),
|
msg_id: msg_id.to_u32(),
|
||||||
chat_id: chat_id.to_u32(),
|
chat_id: chat_id.to_u32(),
|
||||||
|
from_this_device,
|
||||||
},
|
},
|
||||||
CoreEventType::OutgoingCallAccepted {
|
CoreEventType::OutgoingCallAccepted {
|
||||||
msg_id,
|
msg_id,
|
||||||
|
|||||||
@@ -266,6 +266,7 @@ impl Context {
|
|||||||
self.emit_event(EventType::IncomingCallAccepted {
|
self.emit_event(EventType::IncomingCallAccepted {
|
||||||
msg_id: call.msg.id,
|
msg_id: call.msg.id,
|
||||||
chat_id: call.msg.chat_id,
|
chat_id: call.msg.chat_id,
|
||||||
|
from_this_device: true,
|
||||||
});
|
});
|
||||||
self.emit_msgs_changed(call.msg.chat_id, call_id);
|
self.emit_msgs_changed(call.msg.chat_id, call_id);
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -432,6 +433,7 @@ impl Context {
|
|||||||
self.emit_event(EventType::IncomingCallAccepted {
|
self.emit_event(EventType::IncomingCallAccepted {
|
||||||
msg_id: call.msg.id,
|
msg_id: call.msg.id,
|
||||||
chat_id: call.msg.chat_id,
|
chat_id: call.msg.chat_id,
|
||||||
|
from_this_device: false,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let accept_call_info = mime_message
|
let accept_call_info = mime_message
|
||||||
|
|||||||
@@ -129,7 +129,15 @@ async fn accept_call() -> Result<CallSetup> {
|
|||||||
);
|
);
|
||||||
assert_text(&bob, bob_call.id, "Incoming video call").await?;
|
assert_text(&bob, bob_call.id, "Incoming video call").await?;
|
||||||
bob.evtracker
|
bob.evtracker
|
||||||
.get_matching(|evt| matches!(evt, EventType::IncomingCallAccepted { .. }))
|
.get_matching(|evt| {
|
||||||
|
matches!(
|
||||||
|
evt,
|
||||||
|
EventType::IncomingCallAccepted {
|
||||||
|
from_this_device: true,
|
||||||
|
..
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
.await;
|
.await;
|
||||||
let sent2 = bob.pop_sent_msg().await;
|
let sent2 = bob.pop_sent_msg().await;
|
||||||
let info = bob
|
let info = bob
|
||||||
@@ -143,7 +151,15 @@ async fn accept_call() -> Result<CallSetup> {
|
|||||||
bob2.recv_msg_trash(&sent2).await;
|
bob2.recv_msg_trash(&sent2).await;
|
||||||
assert_text(&bob, bob_call.id, "Incoming video call").await?;
|
assert_text(&bob, bob_call.id, "Incoming video call").await?;
|
||||||
bob2.evtracker
|
bob2.evtracker
|
||||||
.get_matching(|evt| matches!(evt, EventType::IncomingCallAccepted { .. }))
|
.get_matching(|evt| {
|
||||||
|
matches!(
|
||||||
|
evt,
|
||||||
|
EventType::IncomingCallAccepted {
|
||||||
|
from_this_device: false,
|
||||||
|
..
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
.await;
|
.await;
|
||||||
let info = bob2
|
let info = bob2
|
||||||
.load_call_by_id(bob2_call.id)
|
.load_call_by_id(bob2_call.id)
|
||||||
|
|||||||
@@ -397,6 +397,8 @@ pub enum EventType {
|
|||||||
msg_id: MsgId,
|
msg_id: MsgId,
|
||||||
/// ID of the chat which the message belongs to.
|
/// ID of the chat which the message belongs to.
|
||||||
chat_id: ChatId,
|
chat_id: ChatId,
|
||||||
|
/// The call was accepted from this device (process).
|
||||||
|
from_this_device: bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Outgoing call accepted.
|
/// Outgoing call accepted.
|
||||||
|
|||||||
Reference in New Issue
Block a user