Skip to content

Commit

Permalink
feat(sdk): Add sliding_sync::Version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Aug 26, 2024
1 parent be13388 commit f0100f5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions crates/matrix-sdk/src/sliding_sync/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,42 @@ use imbl::Vector;
use matrix_sdk_base::{sliding_sync::http, sync::SyncResponse, PreviousEventsProvider};
use ruma::{events::AnyToDeviceEvent, serde::Raw, OwnedRoomId};
use tracing::error;
use url::Url;

use super::{SlidingSync, SlidingSyncBuilder};
use crate::{Client, Result, SlidingSyncRoom};

/// A sliding sync version.
#[derive(Clone, Debug)]
pub enum Version {
/// No version. Useful to represent that sliding sync is disable for
/// example, and that the version is unknown.
None,

/// Use the version of the sliding sync proxy, i.e. MSC3575.
Proxy {
/// URL to the proxy.
url: Url,
},

/// Use the version of the sliding sync implementation inside Synapse, i.e.
/// Simplified MSC3575.
Native,
}

impl Version {
pub(crate) fn is_native(&self) -> bool {
matches!(self, Self::Native)
}

pub(crate) fn overriding_url(&self) -> Option<&Url> {
match self {
Self::Proxy { url } => Some(url),
_ => None,
}
}
}

impl Client {
/// Create a [`SlidingSyncBuilder`] tied to this client, with the given
/// identifier.
Expand Down

0 comments on commit f0100f5

Please sign in to comment.