Element messages to back to websocket

This commit is contained in:
2025-02-25 19:52:42 +01:00
parent b91b1ba096
commit 53186d2e24
3 changed files with 60 additions and 3 deletions

View File

@ -1,5 +1,32 @@
use crate::sync_client::SyncClientID;
use crate::user::{APIClientID, UserID};
use ruma::api::client::sync::sync_events::v3::{GlobalAccountData, Presence, Rooms, ToDevice};
use ruma::api::client::sync::sync_events::DeviceLists;
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct SyncEvent {
/// Updates to rooms.
#[serde(default, skip_serializing_if = "Rooms::is_empty")]
pub rooms: Rooms,
/// Updates to the presence status of other users.
#[serde(default, skip_serializing_if = "Presence::is_empty")]
pub presence: Presence,
/// The global private data created by this user.
#[serde(default, skip_serializing_if = "GlobalAccountData::is_empty")]
pub account_data: GlobalAccountData,
/// Messages sent directly between devices.
#[serde(default, skip_serializing_if = "ToDevice::is_empty")]
pub to_device: ToDevice,
/// Information on E2E device updates.
///
/// Only present on an incremental sync.
#[serde(default, skip_serializing_if = "DeviceLists::is_empty")]
pub device_lists: DeviceLists,
}
/// Broadcast messages
#[derive(Debug, Clone)]
@ -14,4 +41,6 @@ pub enum BroadcastMessage {
StartSyncTaskForUser(UserID),
/// Stop a client with a given client ID
StopSyncClient(SyncClientID),
/// Propagate a new sync event
SyncEvent(UserID, SyncEvent),
}