feat(ffi): Expose ffi::NotificationRoomInfo::service_members

This is needed in some clients to know if a direct room is a DM or not
This commit is contained in:
Jorge Martín
2026-04-21 09:48:45 +02:00
committed by Jorge Martin Espinosa
parent a2bbc33920
commit e507eaabf6
4 changed files with 21 additions and 0 deletions
+3
View File
@@ -44,6 +44,9 @@ All notable changes to this project will be documented in this file.
### Features
- Expose `ffi::NotificationRoomInfo::service_members` so clients can use the list of service
members to calculate if a room is a DM from the notification info.
([#6474](https://github.com/matrix-org/matrix-rust-sdk/pull/6474))
- Enable `experimental-push-secrets` feature by default.
([#6473](https://github.com/matrix-org/matrix-rust-sdk/pull/6394))
- Add new high-level search helpers `RoomSearchIterator` and `GlobalSearchIterator` to perform
+6
View File
@@ -2174,6 +2174,12 @@ async fn notification_handler(
topic: room.topic(),
join_rule: room.join_rule().map(TryInto::try_into).transpose().ok().flatten(),
joined_members_count: room.joined_members_count(),
service_members: room
.service_members()
.unwrap_or_default()
.iter()
.map(ToString::to_string)
.collect(),
is_encrypted: Some(room.encryption_state().is_encrypted()),
is_direct,
is_space: room.is_space(),
@@ -49,6 +49,7 @@ pub struct NotificationRoomInfo {
pub topic: Option<String>,
pub join_rule: Option<JoinRule>,
pub joined_members_count: u64,
pub service_members: Vec<String>,
pub is_encrypted: Option<bool>,
pub is_direct: bool,
pub is_space: bool,
@@ -106,6 +107,7 @@ impl NotificationItem {
topic: item.room_topic,
join_rule: item.room_join_rule.map(TryInto::try_into).transpose().ok().flatten(),
joined_members_count: item.joined_members_count,
service_members: item.service_members,
is_encrypted: item.is_room_encrypted,
is_direct: item.is_direct_message_room,
is_space: item.is_space,
@@ -20,6 +20,7 @@ use std::{
};
use futures_util::{StreamExt as _, pin_mut};
use itertools::Itertools;
use matrix_sdk::{
Client, ClientBuildError, SlidingSyncList, SlidingSyncMode, room::Room, sleep::sleep,
};
@@ -938,6 +939,8 @@ pub struct NotificationItem {
pub is_direct_message_room: bool,
/// Numbers of members who joined the room.
pub joined_members_count: u64,
/// Number of service members in the room.
pub service_members: Vec<String>,
/// Is the room a space?
pub is_space: bool,
@@ -1022,6 +1025,12 @@ impl NotificationItem {
let is_noisy = push_actions.map(|actions| actions.iter().any(|a| a.sound().is_some()));
let has_mention = push_actions.map(|actions| actions.iter().any(|a| a.is_highlight()));
let thread_id = event.thread_id().clone();
let service_members = room
.service_members()
.unwrap_or_default()
.iter()
.map(ToString::to_string)
.collect_vec();
let item = NotificationItem {
event,
@@ -1041,6 +1050,7 @@ impl NotificationItem {
.map(|state| state.is_encrypted())
.ok(),
joined_members_count: room.joined_members_count(),
service_members,
is_space: room.is_space(),
is_noisy,
has_mention,