diff --git a/deltachat-jsonrpc/src/api/types/events.rs b/deltachat-jsonrpc/src/api/types/events.rs index 9377c0b125..d957f82e9f 100644 --- a/deltachat-jsonrpc/src/api/types/events.rs +++ b/deltachat-jsonrpc/src/api/types/events.rs @@ -425,6 +425,8 @@ pub enum EventType { IncomingCall { /// ID of the info message referring to the call. msg_id: u32, + /// ID of the chat which the message belongs to. + chat_id: u32, /// User-defined info as passed to place_outgoing_call() place_call_info: String, /// True if incoming call is a video call. @@ -436,12 +438,16 @@ pub enum EventType { IncomingCallAccepted { /// ID of the info message referring to the call. msg_id: u32, + /// ID of the chat which the message belongs to. + chat_id: u32, }, /// Outgoing call accepted. OutgoingCallAccepted { /// ID of the info message referring to the call. msg_id: u32, + /// ID of the chat which the message belongs to. + chat_id: u32, /// User-defined info passed to dc_accept_incoming_call( accept_call_info: String, }, @@ -450,6 +456,8 @@ pub enum EventType { CallEnded { /// ID of the info message referring to the call. msg_id: u32, + /// ID of the chat which the message belongs to. + chat_id: u32, }, } @@ -607,25 +615,31 @@ impl From for EventType { CoreEventType::AccountsItemChanged => AccountsItemChanged, CoreEventType::IncomingCall { msg_id, + chat_id, place_call_info, has_video, } => IncomingCall { msg_id: msg_id.to_u32(), + chat_id: chat_id.to_u32(), place_call_info, has_video, }, - CoreEventType::IncomingCallAccepted { msg_id } => IncomingCallAccepted { + CoreEventType::IncomingCallAccepted { msg_id, chat_id } => IncomingCallAccepted { msg_id: msg_id.to_u32(), + chat_id: chat_id.to_u32(), }, CoreEventType::OutgoingCallAccepted { msg_id, + chat_id, accept_call_info, } => OutgoingCallAccepted { msg_id: msg_id.to_u32(), + chat_id: chat_id.to_u32(), accept_call_info, }, - CoreEventType::CallEnded { msg_id } => CallEnded { + CoreEventType::CallEnded { msg_id, chat_id } => CallEnded { msg_id: msg_id.to_u32(), + chat_id: chat_id.to_u32(), }, #[allow(unreachable_patterns)] #[cfg(test)] diff --git a/src/calls.rs b/src/calls.rs index 9454a91d30..3110529999 100644 --- a/src/calls.rs +++ b/src/calls.rs @@ -236,6 +236,7 @@ impl Context { msg.id = send_msg(self, call.msg.chat_id, &mut msg).await?; self.emit_event(EventType::IncomingCallAccepted { msg_id: call.msg.id, + chat_id: call.msg.chat_id, }); self.emit_msgs_changed(call.msg.chat_id, call_id); Ok(()) @@ -274,6 +275,7 @@ impl Context { self.emit_event(EventType::CallEnded { msg_id: call.msg.id, + chat_id: call.msg.chat_id, }); self.emit_msgs_changed(call.msg.chat_id, call_id); Ok(()) @@ -297,6 +299,7 @@ impl Context { context.emit_msgs_changed(call.msg.chat_id, call_id); context.emit_event(EventType::CallEnded { msg_id: call.msg.id, + chat_id: call.msg.chat_id, }); } Ok(()) @@ -327,6 +330,7 @@ impl Context { }; self.emit_event(EventType::IncomingCall { msg_id: call.msg.id, + chat_id: call.msg.chat_id, place_call_info: call.place_call_info.to_string(), has_video, }); @@ -355,6 +359,7 @@ impl Context { if call.is_incoming() { self.emit_event(EventType::IncomingCallAccepted { msg_id: call.msg.id, + chat_id: call.msg.chat_id, }); } else { let accept_call_info = mime_message @@ -362,6 +367,7 @@ impl Context { .unwrap_or_default(); self.emit_event(EventType::OutgoingCallAccepted { msg_id: call.msg.id, + chat_id: call.msg.chat_id, accept_call_info: accept_call_info.to_string(), }); } @@ -401,6 +407,7 @@ impl Context { self.emit_msgs_changed(call.msg.chat_id, call_id); self.emit_event(EventType::CallEnded { msg_id: call.msg.id, + chat_id: call.msg.chat_id, }); } _ => {} diff --git a/src/calls/calls_tests.rs b/src/calls/calls_tests.rs index c87c58629e..24cb189d84 100644 --- a/src/calls/calls_tests.rs +++ b/src/calls/calls_tests.rs @@ -135,6 +135,7 @@ async fn accept_call() -> Result { ev, EventType::OutgoingCallAccepted { msg_id: alice_call.id, + chat_id: alice_call.chat_id, accept_call_info: ACCEPT_INFO.to_string() } ); diff --git a/src/events/payload.rs b/src/events/payload.rs index 60ff63ba09..bf7e1fa35e 100644 --- a/src/events/payload.rs +++ b/src/events/payload.rs @@ -383,6 +383,8 @@ pub enum EventType { IncomingCall { /// ID of the message referring to the call. msg_id: MsgId, + /// ID of the chat which the message belongs to. + chat_id: ChatId, /// User-defined info as passed to place_outgoing_call() place_call_info: String, /// True if incoming call is a video call. @@ -393,12 +395,16 @@ pub enum EventType { IncomingCallAccepted { /// ID of the message referring to the call. msg_id: MsgId, + /// ID of the chat which the message belongs to. + chat_id: ChatId, }, /// Outgoing call accepted. OutgoingCallAccepted { /// ID of the message referring to the call. msg_id: MsgId, + /// ID of the chat which the message belongs to. + chat_id: ChatId, /// User-defined info as passed to accept_incoming_call() accept_call_info: String, }, @@ -407,6 +413,8 @@ pub enum EventType { CallEnded { /// ID of the message referring to the call. msg_id: MsgId, + /// ID of the chat which the message belongs to. + chat_id: ChatId, }, /// Event for using in tests, e.g. as a fence between normally generated events.