diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 4cd4637f3..e92f30a55 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -559,6 +559,7 @@ pub unsafe extern "C" fn dc_event_get_id(event: *mut dc_event_t) -> libc::c_int EventType::IncomingCallAccepted { .. } => 2560, EventType::OutgoingCallAccepted { .. } => 2570, EventType::CallEnded { .. } => 2580, + EventType::TransportsModified => 2600, #[allow(unreachable_patterns)] #[cfg(test)] _ => unreachable!("This is just to silence a rust_analyzer false-positive"), @@ -593,7 +594,8 @@ pub unsafe extern "C" fn dc_event_get_data1_int(event: *mut dc_event_t) -> libc: | EventType::AccountsBackgroundFetchDone | EventType::ChatlistChanged | EventType::AccountsChanged - | EventType::AccountsItemChanged => 0, + | EventType::AccountsItemChanged + | EventType::TransportsModified => 0, EventType::IncomingReaction { contact_id, .. } | EventType::IncomingWebxdcNotify { contact_id, .. } => contact_id.to_u32() as libc::c_int, EventType::MsgsChanged { chat_id, .. } @@ -681,7 +683,8 @@ pub unsafe extern "C" fn dc_event_get_data2_int(event: *mut dc_event_t) -> libc: | EventType::IncomingCallAccepted { .. } | EventType::OutgoingCallAccepted { .. } | EventType::CallEnded { .. } - | EventType::EventChannelOverflow { .. } => 0, + | EventType::EventChannelOverflow { .. } + | EventType::TransportsModified => 0, EventType::MsgsChanged { msg_id, .. } | EventType::ReactionsChanged { msg_id, .. } | EventType::IncomingReaction { msg_id, .. } @@ -780,7 +783,8 @@ pub unsafe extern "C" fn dc_event_get_data2_str(event: *mut dc_event_t) -> *mut | EventType::AccountsChanged | EventType::AccountsItemChanged | EventType::IncomingCallAccepted { .. } - | EventType::WebxdcRealtimeAdvertisementReceived { .. } => ptr::null_mut(), + | EventType::WebxdcRealtimeAdvertisementReceived { .. } + | EventType::TransportsModified => ptr::null_mut(), EventType::IncomingCall { place_call_info, .. } => { diff --git a/deltachat-jsonrpc/src/api/types/events.rs b/deltachat-jsonrpc/src/api/types/events.rs index f7957e32d..beeee4334 100644 --- a/deltachat-jsonrpc/src/api/types/events.rs +++ b/deltachat-jsonrpc/src/api/types/events.rs @@ -460,6 +460,15 @@ pub enum EventType { /// ID of the chat which the message belongs to. chat_id: u32, }, + + /// One or more transports has changed. + /// + /// This event is used for tests to detect when transport + /// synchronization messages arrives. + /// UIs don't need to use it, it is unlikely + /// that user modifies transports on multiple + /// devices simultaneously. + TransportsModified, } impl From for EventType { @@ -642,6 +651,8 @@ impl From for EventType { msg_id: msg_id.to_u32(), chat_id: chat_id.to_u32(), }, + CoreEventType::TransportsModified => TransportsModified, + #[allow(unreachable_patterns)] #[cfg(test)] _ => unreachable!("This is just to silence a rust_analyzer false-positive"), diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/const.py b/deltachat-rpc-client/src/deltachat_rpc_client/const.py index 03ae2d7b3..cee9536be 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/const.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/const.py @@ -80,6 +80,7 @@ class EventType(str, Enum): CONFIG_SYNCED = "ConfigSynced" WEBXDC_REALTIME_DATA = "WebxdcRealtimeData" WEBXDC_REALTIME_ADVERTISEMENT_RECEIVED = "WebxdcRealtimeAdvertisementReceived" + TRANSPORTS_MODIFIED = "TransportsModified" class ChatId(IntEnum): diff --git a/src/events/payload.rs b/src/events/payload.rs index bf7e1fa35..f2540bce1 100644 --- a/src/events/payload.rs +++ b/src/events/payload.rs @@ -417,6 +417,15 @@ pub enum EventType { chat_id: ChatId, }, + /// One or more transports has changed. + /// + /// This event is used for tests to detect when transport + /// synchronization messages arrives. + /// UIs don't need to use it, it is unlikely + /// that user modifies transports on multiple + /// devices simultaneously. + TransportsModified, + /// Event for using in tests, e.g. as a fence between normally generated events. #[cfg(test)] Test,