mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-25 01:02:20 -04:00
ffi: expose sliding sync extension enabling
This commit is contained in:
committed by
Benjamin Kampmann
parent
8f17b6c38d
commit
826b2874ec
@@ -693,6 +693,10 @@ impl SlidingSync {
|
||||
self.inner.pop_view(&name).map(|inner| Arc::new(SlidingSyncView { inner }))
|
||||
}
|
||||
|
||||
pub fn add_common_extensions(&self) {
|
||||
self.inner.add_common_extensions();
|
||||
}
|
||||
|
||||
pub fn sync(&self) -> Arc<StoppableSpawn> {
|
||||
let inner = self.inner.clone();
|
||||
let client = self.client.clone();
|
||||
@@ -791,6 +795,37 @@ impl SlidingSyncBuilder {
|
||||
Arc::new(builder)
|
||||
}
|
||||
|
||||
pub fn without_e2ee_extension(self: Arc<Self>) -> Arc<Self> {
|
||||
let mut builder = unwrap_or_clone_arc(self);
|
||||
builder.inner = builder.inner.without_e2ee_extension();
|
||||
Arc::new(builder)
|
||||
}
|
||||
|
||||
pub fn without_to_device_extension(self: Arc<Self>) -> Arc<Self> {
|
||||
let mut builder = unwrap_or_clone_arc(self);
|
||||
builder.inner = builder.inner.without_to_device_extension();
|
||||
Arc::new(builder)
|
||||
}
|
||||
|
||||
pub fn without_account_data_extension(self: Arc<Self>) -> Arc<Self> {
|
||||
let mut builder = unwrap_or_clone_arc(self);
|
||||
builder.inner = builder.inner.without_account_data_extension();
|
||||
Arc::new(builder)
|
||||
}
|
||||
|
||||
pub fn without_receipt_extension(self: Arc<Self>) -> Arc<Self> {
|
||||
let mut builder = unwrap_or_clone_arc(self);
|
||||
builder.inner = builder.inner.without_receipt_extension();
|
||||
Arc::new(builder)
|
||||
}
|
||||
|
||||
pub fn without_typing_extension(self: Arc<Self>) -> Arc<Self> {
|
||||
let mut builder = unwrap_or_clone_arc(self);
|
||||
builder.inner = builder.inner.without_typing_extension();
|
||||
Arc::new(builder)
|
||||
}
|
||||
|
||||
|
||||
pub fn with_all_extensions(self: Arc<Self>) -> Arc<Self> {
|
||||
let mut builder = unwrap_or_clone_arc(self);
|
||||
builder.inner = builder.inner.with_all_extensions();
|
||||
|
||||
@@ -796,6 +796,27 @@ impl SlidingSync {
|
||||
}
|
||||
}
|
||||
|
||||
/// Add the common extensions if not already configured
|
||||
pub fn add_common_extensions(&self) {
|
||||
let mut lock = self
|
||||
.extensions
|
||||
.lock()
|
||||
.unwrap();
|
||||
let mut cfg = lock.get_or_insert_with(Default::default);
|
||||
if cfg.to_device.is_none() {
|
||||
cfg.to_device = Some(assign!(ToDeviceConfig::default(), {enabled : Some(true)}));
|
||||
}
|
||||
|
||||
if cfg.e2ee.is_none() {
|
||||
cfg.e2ee = Some(assign!(E2EEConfig::default(), {enabled : Some(true)}));
|
||||
}
|
||||
|
||||
if cfg.account_data.is_none() {
|
||||
cfg.account_data =
|
||||
Some(assign!(AccountDataConfig::default(), {enabled : Some(true)}));
|
||||
}
|
||||
}
|
||||
|
||||
/// Lookup a specific room
|
||||
pub fn get_room(&self, room_id: OwnedRoomId) -> Option<SlidingSyncRoom> {
|
||||
self.rooms.lock_ref().get(&room_id).cloned()
|
||||
|
||||
Reference in New Issue
Block a user