diff --git a/rnex-protocols/mm-protos/src/matchmake.rs b/rnex-protocols/mm-protos/src/matchmake.rs index d18adea..39c8886 100644 --- a/rnex-protocols/mm-protos/src/matchmake.rs +++ b/rnex-protocols/mm-protos/src/matchmake.rs @@ -150,6 +150,15 @@ pub struct MatchmakeBlockListParam { option_flag: u32, } +#[derive(RmcSerialize, Debug, Clone)] +#[rmc_struct(0)] +pub struct ParticipantDetails { + pub participant: PID, + pub name: String, + pub message: String, + pub participants: u16, +} + cfg_if! { if #[cfg(feature = "v3-10-22")] { #[derive(RmcSerialize, Debug, Clone)] @@ -200,6 +209,8 @@ pub mod gathering_flags { pub trait Matchmake { #[method_id(2)] async fn unregister_gathering(&self, gid: u32) -> Result; + #[method_id(15)] + async fn get_detailed_participants(&self, gid: u32) -> Result, ErrorCode>; #[method_id(21)] async fn find_by_single_id(&self, gid: u32) -> Result<(bool, Any), ErrorCode>; #[method_id(41)] diff --git a/rnex-server-nex-modules/rnex-mm/src/user.rs b/rnex-server-nex-modules/rnex-mm/src/user.rs index e8fb748..2e2f380 100644 --- a/rnex-server-nex-modules/rnex-mm/src/user.rs +++ b/rnex-server-nex-modules/rnex-mm/src/user.rs @@ -6,12 +6,11 @@ use rnex_mm_protos::{ LocalMatchMakingProtocol, RemoteMatchMakingClientProtocol, matchmake::{ AutoMatchmakeParam, CreateMatchmakeSessionParam, Gathering, JoinMatchmakeSessionParam, - Matchmake, MatchmakeSession, MatchmakeSessionSearchCriteria, + Matchmake, MatchmakeSession, MatchmakeSessionSearchCriteria, ParticipantDetails, }, matchmake_ext::MatchmakeExt, matchmake_extension::MatchmakeExtension, - nat_traversal::NatTraversal, - nat_traversal::RemoteNatTraversalConsole, + nat_traversal::{NatTraversal, RemoteNatTraversalConsole}, notifications::{ NotificationEvent, RemoteNotification, notification_types::{END_GATHERING, REQUEST_JOIN_GATHERING}, @@ -633,6 +632,28 @@ impl Matchmake for MatchmakeUser { Ok(()) } + + async fn get_detailed_participants(&self, gid: u32) -> Result, ErrorCode> { + let session = self.matchmake_manager.get_session(gid).await?; + let session = session.lock().await; + + let mut participant_details = Vec::with_capacity(session.connected_players.len()); + + for player_weak in &session.connected_players { + let Some(player) = player_weak.upgrade() else { + continue; + }; + + participant_details.push(ParticipantDetails { + participant: player.base.pid, + name: "test".to_string(), + message: String::new(), + participants: 1, + }); + } + + Ok(participant_details) + } } impl MatchmakeExt for MatchmakeUser {