From 9a522b0f7bff2109224e3d83c0203351b319ac4d Mon Sep 17 00:00:00 2001 From: WofWca Date: Tue, 17 Dec 2024 14:37:57 +0400 Subject: [PATCH] improvement: add `IncomingWebxdcNotify.chat_id` See discussion: https://github.com/deltachat/deltachat-desktop/pull/4400#discussion_r1885138760 --- deltachat-jsonrpc/src/api/types/events.rs | 3 +++ src/events/payload.rs | 3 +++ src/webxdc.rs | 1 + 3 files changed, 7 insertions(+) diff --git a/deltachat-jsonrpc/src/api/types/events.rs b/deltachat-jsonrpc/src/api/types/events.rs index 9fdf876989..35e1c46ad9 100644 --- a/deltachat-jsonrpc/src/api/types/events.rs +++ b/deltachat-jsonrpc/src/api/types/events.rs @@ -109,6 +109,7 @@ pub enum EventType { /// Incoming webxdc info or summary update, should be notified. #[serde(rename_all = "camelCase")] IncomingWebxdcNotify { + chat_id: u32, contact_id: u32, msg_id: u32, text: String, @@ -343,11 +344,13 @@ impl From for EventType { reaction: reaction.as_str().to_string(), }, CoreEventType::IncomingWebxdcNotify { + chat_id, contact_id, msg_id, text, href, } => IncomingWebxdcNotify { + chat_id: chat_id.to_u32(), contact_id: contact_id.to_u32(), msg_id: msg_id.to_u32(), text, diff --git a/src/events/payload.rs b/src/events/payload.rs index 796320322c..b781f403d6 100644 --- a/src/events/payload.rs +++ b/src/events/payload.rs @@ -109,6 +109,9 @@ pub enum EventType { /// A webxdc wants an info message or a changed summary to be notified. IncomingWebxdcNotify { + /// ID of the chat which the message belongs to. + chat_id: ChatId, + /// ID of the contact sending. contact_id: ContactId, diff --git a/src/webxdc.rs b/src/webxdc.rs index 5477a1bd70..0829933008 100644 --- a/src/webxdc.rs +++ b/src/webxdc.rs @@ -421,6 +421,7 @@ impl Context { notify_list.get(&self_addr).or_else(|| notify_list.get("*")) { self.emit_event(EventType::IncomingWebxdcNotify { + chat_id: instance.chat_id, contact_id: from_id, msg_id: notify_msg_id, text: notify_text.clone(),