feat(ffi): Expose active_service_members_count in the room infos

This commit is contained in:
Jorge Martín
2026-04-22 13:19:22 +02:00
committed by Jorge Martin Espinosa
parent 60eab6344c
commit 5cc1dca7fa
4 changed files with 14 additions and 0 deletions

View File

@@ -2191,6 +2191,8 @@ async fn notification_handler(
.iter()
.map(ToString::to_string)
.collect(),
active_service_members_count: room.active_service_members().await.unwrap_or_default().len()
as u64,
is_encrypted: Some(room.encryption_state().is_encrypted()),
is_direct,
is_space: room.is_space(),

View File

@@ -49,6 +49,7 @@ pub struct NotificationRoomInfo {
pub topic: Option<String>,
pub join_rule: Option<JoinRule>,
pub joined_members_count: u64,
pub active_service_members_count: u64,
pub service_members: Vec<String>,
pub is_encrypted: Option<bool>,
pub is_direct: bool,
@@ -108,6 +109,7 @@ impl NotificationItem {
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,
active_service_members_count: item.active_service_members_count,
is_encrypted: item.is_room_encrypted,
is_direct: item.is_direct_message_room,
is_space: item.is_space,

View File

@@ -87,6 +87,7 @@ pub struct RoomInfo {
active_members_count: u64,
invited_members_count: u64,
joined_members_count: u64,
active_service_members_count: u64,
service_members: Vec<String>,
highlight_count: u64,
notification_count: u64,
@@ -145,6 +146,9 @@ impl RoomInfo {
.ok()
.map(|p| RoomPowerLevels::new(p, room.own_user_id().to_owned()));
let active_service_members_count =
room.active_service_members().await.unwrap_or_default().len() as u64;
Ok(Self {
id: room.room_id().to_string(),
encryption_state: room.encryption_state(),
@@ -180,6 +184,7 @@ impl RoomInfo {
active_members_count: room.active_members_count(),
invited_members_count: room.invited_members_count(),
joined_members_count: room.joined_members_count(),
active_service_members_count,
service_members: room
.service_members()
.iter()

View File

@@ -941,6 +941,7 @@ pub struct NotificationItem {
pub joined_members_count: u64,
/// Number of service members in the room.
pub service_members: Vec<String>,
pub active_service_members_count: u64,
/// Is the room a space?
pub is_space: bool,
@@ -1032,6 +1033,9 @@ impl NotificationItem {
.map(ToString::to_string)
.collect_vec();
let active_service_members_count =
room.active_service_members().await.unwrap_or_default().len() as u64;
let item = NotificationItem {
event,
raw_event,
@@ -1051,6 +1055,7 @@ impl NotificationItem {
.ok(),
joined_members_count: room.joined_members_count(),
service_members,
active_service_members_count,
is_space: room.is_space(),
is_noisy,
has_mention,