Skip to content

Commit

Permalink
fix: Remove support for MSC3575.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Jan 14, 2025
1 parent c60bfb8 commit 5828561
Show file tree
Hide file tree
Showing 18 changed files with 146 additions and 1,197 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ proptest = { version = "1.5.0", default-features = false, features = ["std"] }
rand = "0.8.5"
reqwest = { version = "0.12.4", default-features = false }
rmp-serde = "1.3.0"
ruma = { git = "https://github.com/ruma/ruma", rev = "b266343136e8470a7d040efc207e16af0c20d374", features = [
ruma = { git = "https://github.com/ruma/ruma", rev = "5c9ef9f425d8f8b330e46d215c683bf799a28d50", features = [
"client-api-c",
"compat-upload-signatures",
"compat-user-id",
Expand All @@ -72,7 +72,7 @@ ruma = { git = "https://github.com/ruma/ruma", rev = "b266343136e8470a7d040efc20
"unstable-msc4140",
"unstable-msc4171",
] }
ruma-common = { git = "https://github.com/ruma/ruma", rev = "b266343136e8470a7d040efc207e16af0c20d374" }
ruma-common = { git = "https://github.com/ruma/ruma", rev = "5c9ef9f425d8f8b330e46d215c683bf799a28d50" }
serde = "1.0.151"
serde_html_form = "0.2.0"
serde_json = "1.0.91"
Expand Down
5 changes: 0 additions & 5 deletions bindings/matrix-sdk-ffi/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1795,15 +1795,13 @@ impl MediaFileHandle {
#[derive(Clone, uniffi::Enum)]
pub enum SlidingSyncVersion {
None,
Proxy { url: String },
Native,
}

impl From<SdkSlidingSyncVersion> for SlidingSyncVersion {
fn from(value: SdkSlidingSyncVersion) -> Self {
match value {
SdkSlidingSyncVersion::None => Self::None,
SdkSlidingSyncVersion::Proxy { url } => Self::Proxy { url: url.to_string() },
SdkSlidingSyncVersion::Native => Self::Native,
}
}
Expand All @@ -1815,9 +1813,6 @@ impl TryFrom<SlidingSyncVersion> for SdkSlidingSyncVersion {
fn try_from(value: SlidingSyncVersion) -> Result<Self, Self::Error> {
Ok(match value {
SlidingSyncVersion::None => Self::None,
SlidingSyncVersion::Proxy { url } => Self::Proxy {
url: Url::parse(&url).map_err(|e| ClientError::Generic { msg: e.to_string() })?,
},
SlidingSyncVersion::Native => Self::Native,
})
}
Expand Down
15 changes: 0 additions & 15 deletions bindings/matrix-sdk-ffi/src/client_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use matrix_sdk::{
};
use ruma::api::error::{DeserializationError, FromHttpResponseError};
use tracing::{debug, error};
use url::Url;
use zeroize::Zeroizing;

use super::{client::Client, RUNTIME};
Expand Down Expand Up @@ -604,22 +603,10 @@ impl ClientBuilder {
inner_builder = inner_builder
.sliding_sync_version_builder(MatrixSlidingSyncVersionBuilder::None)
}
SlidingSyncVersionBuilder::Proxy { url } => {
inner_builder = inner_builder.sliding_sync_version_builder(
MatrixSlidingSyncVersionBuilder::Proxy {
url: Url::parse(&url)
.map_err(|e| ClientBuildError::Generic { message: e.to_string() })?,
},
)
}
SlidingSyncVersionBuilder::Native => {
inner_builder = inner_builder
.sliding_sync_version_builder(MatrixSlidingSyncVersionBuilder::Native)
}
SlidingSyncVersionBuilder::DiscoverProxy => {
inner_builder = inner_builder
.sliding_sync_version_builder(MatrixSlidingSyncVersionBuilder::DiscoverProxy)
}
SlidingSyncVersionBuilder::DiscoverNative => {
inner_builder = inner_builder
.sliding_sync_version_builder(MatrixSlidingSyncVersionBuilder::DiscoverNative)
Expand Down Expand Up @@ -748,8 +735,6 @@ pub struct RequestConfig {
#[derive(Clone, uniffi::Enum)]
pub enum SlidingSyncVersionBuilder {
None,
Proxy { url: String },
Native,
DiscoverProxy,
DiscoverNative,
}
1 change: 0 additions & 1 deletion crates/matrix-sdk-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ ruma = { workspace = true, features = [
"canonical-json",
"unstable-msc2867",
"unstable-msc3381",
"unstable-msc3575",
"unstable-msc4186",
"rand",
] }
Expand Down
11 changes: 5 additions & 6 deletions crates/matrix-sdk-base/src/read_receipts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
//! events ids in both sets. As a matter of fact, we have to manually handle
//! this edge case here. I hope that having an event database will help avoid
//! this kind of workaround here later.
//! - In addition to that, and as noted in the timeline code, it seems that the
//! sliding-sync proxy could return the same event multiple times in a sync
//! - In addition to that, and as noted in the timeline code, it seems that
//! sliding sync could return the same event multiple times in a sync
//! timeline, leading to incorrect results. We have to take that into account
//! by resetting the read counts *every* time we see an event that was the
//! target of the latest active read receipt.
Expand Down Expand Up @@ -241,10 +241,9 @@ impl RoomReadReceipts {
let mut counting_receipts = false;

for event in events {
// The sliding sync proxy sometimes sends the same event multiple times, so it
// can be at the beginning and end of a batch, for instance. In that
// case, just reset every time we see the event matching the
// receipt. NOTE: SS proxy workaround.
// Sliding sync sometimes sends the same event multiple times, so it can be at
// the beginning and end of a batch, for instance. In that case, just reset
// every time we see the event matching the
if let Some(event_id) = event.event_id() {
if event_id == receipt_event_id {
// Bingo! Switch over to the counting state, after resetting the
Expand Down
36 changes: 3 additions & 33 deletions crates/matrix-sdk-base/src/sliding_sync/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! HTTP types for MSC4186 or MSC3585.
//! HTTP types for MSC4186.
//!
//! This module provides unified namings for types from MSC3575 and
//! MSC4186.
//! It's a re-export of the type from Ruma.
/// HTTP types from MSC3575, renamed to match the MSC4186 namings.
pub mod msc3575 {
use ruma::api::client::sync::sync_events::v4;
pub use v4::{Request, Response};

/// HTTP types related to a `Request`.
pub mod request {
pub use super::v4::{
AccountDataConfig as AccountData, ExtensionsConfig as Extensions,
ReceiptsConfig as Receipts, RoomDetailsConfig as RoomDetails, RoomSubscription,
SyncRequestList as List, SyncRequestListFilters as ListFilters,
ToDeviceConfig as ToDevice, TypingConfig as Typing,
};
}

/// HTTP types related to a `Response`.
pub mod response {
pub use super::v4::{
AccountData, Extensions, Receipts, SlidingSyncRoom as Room,
SlidingSyncRoomHero as RoomHero, SyncList as List, ToDevice, Typing,
};
}
}

/// HTTP types from MSC4186.
pub mod msc4186 {
pub use ruma::api::client::sync::sync_events::v5::*;
}

pub use msc4186::*;
pub use ruma::api::client::sync::sync_events::v5::*;
Loading

0 comments on commit 5828561

Please sign in to comment.