mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 01:46:34 +03:00
feat: add call ringing API (#6650)
this PR adds a "ringing" api that can be used for calls later. see deltachat.h for details about the API; jsonrpc is left out until things are settled for the needs of android/iOS UI using this PR already successfully are https://github.com/deltachat/deltachat-ios/pull/2638 and https://github.com/deltachat/deltachat-android/pull/3785 ; the "payload" passed forth and back is optimised for https://github.com/deltachat/calls-webapp --------- Co-authored-by: l <link2xt@testrun.org>
This commit is contained in:
@@ -1000,12 +1000,16 @@ pub(crate) async fn receive_imf_inner(
|
||||
}
|
||||
}
|
||||
|
||||
if received_msg.hidden {
|
||||
if mime_parser.is_system_message == SystemMessage::IncomingCall {
|
||||
context.handle_call_msg(&mime_parser, insert_msg_id).await?;
|
||||
} else if received_msg.hidden {
|
||||
// No need to emit an event about the changed message
|
||||
} else if let Some(replace_chat_id) = replace_chat_id {
|
||||
context.emit_msgs_changed_without_msg_id(replace_chat_id);
|
||||
} else if !chat_id.is_trash() {
|
||||
let fresh = received_msg.state == MessageState::InFresh;
|
||||
let fresh = received_msg.state == MessageState::InFresh
|
||||
&& mime_parser.is_system_message != SystemMessage::CallAccepted
|
||||
&& mime_parser.is_system_message != SystemMessage::CallEnded;
|
||||
for msg_id in &received_msg.msg_ids {
|
||||
chat_id.emit_msg_event(context, *msg_id, mime_parser.incoming && fresh);
|
||||
}
|
||||
@@ -1998,6 +2002,22 @@ async fn add_parts(
|
||||
|
||||
handle_edit_delete(context, mime_parser, from_id).await?;
|
||||
|
||||
if mime_parser.is_system_message == SystemMessage::CallAccepted
|
||||
|| mime_parser.is_system_message == SystemMessage::CallEnded
|
||||
{
|
||||
if let Some(field) = mime_parser.get_header(HeaderDef::InReplyTo) {
|
||||
if let Some(call) =
|
||||
message::get_by_rfc724_mids(context, &parse_message_ids(field)).await?
|
||||
{
|
||||
context.handle_call_msg(mime_parser, call.get_id()).await?;
|
||||
} else {
|
||||
warn!(context, "Call: Cannot load parent.")
|
||||
}
|
||||
} else {
|
||||
warn!(context, "Call: Not a reply.")
|
||||
}
|
||||
}
|
||||
|
||||
let hidden = mime_parser.parts.iter().all(|part| part.is_reaction);
|
||||
let mut parts = mime_parser.parts.iter().peekable();
|
||||
while let Some(part) = parts.next() {
|
||||
|
||||
Reference in New Issue
Block a user