Skip to content

Commit 0487c21

Browse files
committed
refactor: Adapt to removal of EventContent in Ruma
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
1 parent 3bc73c7 commit 0487c21

File tree

17 files changed

+43
-41
lines changed

17 files changed

+43
-41
lines changed

bindings/matrix-sdk-crypto-ffi/src/responses.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use ruma::{
2727
to_device::send_event_to_device::v3::Response as ToDeviceResponse,
2828
},
2929
assign,
30-
events::EventContent,
30+
events::MessageLikeEventContent,
3131
OwnedTransactionId, UserId,
3232
};
3333
use serde_json::json;

bindings/matrix-sdk-ffi/src/timeline/msg_like.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use std::{collections::HashMap, sync::Arc};
1616

1717
use matrix_sdk::crypto::types::events::UtdCause;
18-
use ruma::events::{room::MediaSource as RumaMediaSource, EventContent};
18+
use ruma::events::{room::MediaSource as RumaMediaSource, MessageLikeEventContent};
1919

2020
use super::{
2121
content::Reaction,

crates/matrix-sdk-base/src/room/create.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use ruma::{
1717
events::{
1818
macros::EventContent,
1919
room::create::{PreviousRoom, RoomCreateEventContent},
20-
EmptyStateKey, RedactContent, RedactedStateEventContent,
20+
EmptyStateKey, RedactContent, RedactedStateEventContent, StateEventType,
2121
},
2222
room::RoomType,
2323
OwnedUserId, RoomVersionId,
@@ -100,6 +100,10 @@ pub type RedactedRoomCreateWithCreatorEventContent = RoomCreateWithCreatorEventC
100100

101101
impl RedactedStateEventContent for RedactedRoomCreateWithCreatorEventContent {
102102
type StateKey = EmptyStateKey;
103+
104+
fn event_type(&self) -> StateEventType {
105+
StateEventType::RoomCreate
106+
}
103107
}
104108

105109
impl RedactContent for RoomCreateWithCreatorEventContent {

crates/matrix-sdk-base/src/store/migration_helpers.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use ruma::{
3535
tombstone::RoomTombstoneEventContent,
3636
topic::RoomTopicEventContent,
3737
},
38-
EmptyStateKey, EventContent, RedactContent, StateEventContent, StateEventType,
38+
EmptyStateKey, RedactContent, StateEventContent, StateEventType,
3939
},
4040
OwnedRoomId, OwnedUserId, RoomId,
4141
};
@@ -222,18 +222,14 @@ struct RoomNameEventContentV1 {
222222
name: Option<String>,
223223
}
224224

225-
impl EventContent for RoomNameEventContentV1 {
226-
type EventType = StateEventType;
225+
impl StateEventContent for RoomNameEventContentV1 {
226+
type StateKey = EmptyStateKey;
227227

228-
fn event_type(&self) -> Self::EventType {
228+
fn event_type(&self) -> StateEventType {
229229
StateEventType::RoomName
230230
}
231231
}
232232

233-
impl StateEventContent for RoomNameEventContentV1 {
234-
type StateKey = EmptyStateKey;
235-
}
236-
237233
impl RedactContent for RoomNameEventContentV1 {
238234
type Redacted = RedactedRoomNameEventContent;
239235

crates/matrix-sdk-base/src/store/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ impl StateChanges {
614614
where
615615
C: StaticEventContent + StaticStateEventContent + RedactContent,
616616
C::Redacted: RedactedStateEventContent,
617-
C::PossiblyRedacted: DeserializeOwned,
617+
C::PossiblyRedacted: StaticEventContent + DeserializeOwned,
618618
C::StateKey: Borrow<K>,
619619
K: AsRef<str> + ?Sized,
620620
{

crates/matrix-sdk-base/src/store/send_queue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use as_variant::as_variant;
2020
use ruma::{
2121
events::{
2222
room::{message::RoomMessageEventContent, MediaSource},
23-
AnyMessageLikeEventContent, EventContent as _, RawExt as _,
23+
AnyMessageLikeEventContent, MessageLikeEventContent as _, RawExt as _,
2424
},
2525
serde::Raw,
2626
MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedEventId, OwnedTransactionId, OwnedUserId,
@@ -63,7 +63,7 @@ impl SerializableEventContent {
6363
/// Convert a [`SerializableEventContent`] back into a
6464
/// [`AnyMessageLikeEventContent`].
6565
pub fn deserialize(&self) -> Result<AnyMessageLikeEventContent, serde_json::Error> {
66-
self.event.deserialize_with_type(self.event_type.clone().into())
66+
self.event.deserialize_with_type(&self.event_type)
6767
}
6868

6969
/// Returns the raw event content along with its type.

crates/matrix-sdk-crypto/src/secret_storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use ruma::{
3636
},
3737
secret::SecretEncryptedData,
3838
},
39-
EventContent, GlobalAccountDataEventType,
39+
GlobalAccountDataEventContent, GlobalAccountDataEventType,
4040
},
4141
serde::Base64,
4242
UInt,

crates/matrix-sdk-crypto/src/types/events/to_device.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use ruma::{
2323
request::ToDeviceKeyVerificationRequestEvent, start::ToDeviceKeyVerificationStartEvent,
2424
},
2525
secret::request::{SecretName, ToDeviceSecretRequestEvent},
26-
EventContent, ToDeviceEventType,
26+
ToDeviceEventContent, ToDeviceEventType,
2727
},
2828
serde::Raw,
2929
OwnedUserId, UserId,

crates/matrix-sdk-crypto/src/types/requests/to_device.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use std::{collections::BTreeMap, iter};
1616

1717
use ruma::{
18-
events::{AnyToDeviceEventContent, EventContent, ToDeviceEventType},
18+
events::{AnyToDeviceEventContent, ToDeviceEventContent, ToDeviceEventType},
1919
serde::Raw,
2020
to_device::DeviceIdOrAllDevices,
2121
OwnedDeviceId, OwnedTransactionId, OwnedUserId, TransactionId, UserId,

crates/matrix-sdk-ui/src/timeline/event_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use ruma::{
3232
Relation, RoomMessageEventContent, RoomMessageEventContentWithoutRelation,
3333
},
3434
AnyMessageLikeEventContent, AnySyncMessageLikeEvent, AnySyncStateEvent,
35-
AnySyncTimelineEvent, EventContent, FullStateEventContent, MessageLikeEventType,
35+
AnySyncTimelineEvent, FullStateEventContent, MessageLikeEventContent, MessageLikeEventType,
3636
StateEventType, SyncStateEvent,
3737
},
3838
serde::Raw,

0 commit comments

Comments
 (0)