Skip to content

Commit

Permalink
adjust to ruma api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
toger5 committed Jun 11, 2024
1 parent d035eb1 commit 5e3efbe
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 32 deletions.
86 changes: 68 additions & 18 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ once_cell = "1.16.0"
pin-project-lite = "0.2.9"
rand = "0.8.5"
reqwest = { version = "0.12.4", default-features = false }
ruma = { git = "https://github.com/ruma/ruma", rev = "75e8829bec0b7bc5332860e1fb2df658d5c71d66", features = [
ruma = { git = "https://github.com/toger5/ruma/", rev = "61b2e3c1304e394e7ab11b83de5a3520fea61740", features = [
"client-api-c",
"compat-upload-signatures",
"compat-user-id",
Expand Down
2 changes: 1 addition & 1 deletion bindings/matrix-sdk-ffi/src/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl Room {

/// Returns a Vec of userId's that participate in the room call.
///
/// matrix_rtc memberships with application "m.call" and scope "m.room" are
/// MatrixRTC memberships with application "m.call" and scope "m.room" are
/// considered. A user can occur twice if they join with two devices.
/// convert to a set depending if the different users are required or the
/// amount of sessions.
Expand Down
25 changes: 13 additions & 12 deletions crates/matrix-sdk-base/src/rooms/normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use ruma::events::AnySyncTimelineEvent;
use ruma::{
api::client::sync::sync_events::v3::RoomSummary as RumaSummary,
events::{
call::member::Membership,
call::member::MembershipData,
ignored_user_list::IgnoredUserListEventContent,
receipt::{Receipt, ReceiptThread, ReceiptType},
room::{
Expand Down Expand Up @@ -462,7 +462,7 @@ impl Room {

/// Returns a Vec of userId's that participate in the room call.
///
/// matrix_rtc memberships with application "m.call" and scope "m.room" are
/// MatrixRTC memberships with application "m.call" and scope "m.room" are
/// considered. A user can occur twice if they join with two devices.
/// convert to a set depending if the different users are required or the
/// amount of sessions.
Expand Down Expand Up @@ -1289,7 +1289,7 @@ impl RoomInfo {
/// associated UserId's in this room.
///
/// The vector is ordered by oldest membership to newest.
fn active_matrix_rtc_memberships(&self) -> Vec<(OwnedUserId, &Membership)> {
fn active_matrix_rtc_memberships(&self) -> Vec<(OwnedUserId, MembershipData<'_>)> {
let mut v = self
.base_info
.rtc_member
Expand All @@ -1304,7 +1304,7 @@ impl RoomInfo {
})
.flatten()
.collect::<Vec<_>>();
v.sort_by_key(|(_, m)| m.created_ts);
v.sort_by_key(|(_, m)| m.created_ts());
v
}

Expand All @@ -1313,7 +1313,7 @@ impl RoomInfo {
/// returns Memberships with application "m.call" and scope "m.room".
///
/// The vector is ordered by oldest membership user to newest.
fn active_room_call_memberships(&self) -> Vec<(OwnedUserId, &Membership)> {
fn active_room_call_memberships(&self) -> Vec<(OwnedUserId, MembershipData<'_>)> {
self.active_matrix_rtc_memberships()
.into_iter()
.filter(|(_user_id, m)| m.is_room_call())
Expand Down Expand Up @@ -1484,9 +1484,10 @@ mod tests {
use ruma::{
api::client::sync::sync_events::v3::RoomSummary as RumaSummary,
events::{
call::member::{
Application, CallApplicationContent, CallMemberEventContent, Focus, LivekitFocus,
Membership, MembershipInit, OriginalSyncCallMemberEvent,
call::{
focus::{Focus, LivekitFocus},
Application, CallApplicationContent, CallMemberEventContent, LegacyMembershipData,
MembershipInit, OriginalSyncCallMemberEvent,
},
room::{
canonical_alias::RoomCanonicalAliasEventContent,
Expand Down Expand Up @@ -2341,11 +2342,11 @@ mod tests {
}

fn call_member_state_event(
memberships: Vec<Membership>,
memberships: Vec<LegacyMembershipData>,
ev_id: &str,
user_id: &UserId,
) -> AnySyncStateEvent {
let content = CallMemberEventContent::new(memberships);
let content = CallMemberEventContent::new_legacy(memberships);

AnySyncStateEvent::CallMember(SyncStateEvent::Original(OriginalSyncCallMemberEvent {
content,
Expand All @@ -2363,7 +2364,7 @@ mod tests {
device_id: &str,
membership_id: &str,
minutes_ago: u32,
) -> Membership {
) -> LegacyMembershipData {
let application = Application::Call(CallApplicationContent::new(
"my_call_id_1".to_owned(),
ruma::events::call::member::CallScope::Room,
Expand All @@ -2374,7 +2375,7 @@ mod tests {
))];

assign!(
Membership::from(MembershipInit {
LegacyMembershipData::from(MembershipInit {
application,
device_id: device_id.to_owned(),
expires: Duration::from_millis(3_600_000),
Expand Down

0 comments on commit 5e3efbe

Please sign in to comment.