diff --git a/rnex-core/src/nex/user.rs b/rnex-core/src/nex/user.rs index 44721ed..9670c78 100644 --- a/rnex-core/src/nex/user.rs +++ b/rnex-core/src/nex/user.rs @@ -11,9 +11,6 @@ use rnex_core::prudp::station_url::UrlOptions::{ use rnex_core::rmc::protocols::matchmake::{ Matchmake, RawMatchmake, RawMatchmakeInfo, RemoteMatchmake, }; -use rnex_core::rmc::protocols::util::{ - Utility, RawUtility, RawUtilityInfo, RemoteUtility, -}; use rnex_core::rmc::protocols::matchmake_ext::{ MatchmakeExt, RawMatchmakeExt, RawMatchmakeExtInfo, RemoteMatchmakeExt, }; @@ -29,6 +26,7 @@ use rnex_core::rmc::protocols::notifications::notification_types::{ }; use rnex_core::rmc::protocols::ranking::{Ranking, RawRanking, RawRankingInfo, RemoteRanking}; use rnex_core::rmc::protocols::secure::{RawSecure, RawSecureInfo, RemoteSecure, Secure}; +use rnex_core::rmc::protocols::util::{RawUtility, RawUtilityInfo, RemoteUtility, Utility}; use rnex_core::rmc::response::ErrorCode; use rnex_core::rmc::structures::any::Any; use rnex_core::rmc::structures::matchmake::{ @@ -513,6 +511,36 @@ impl MatchmakeExtension for User { Ok(sess.session.session_key.clone()) } + + async fn auto_matchmake_with_search_criteria_postpone( + &self, + criteria: Vec, + gathering: Any, + join_message: String, + ) -> Result { + let session: MatchmakeSession = gathering + .try_get() + .map(|v| v.ok()) + .flatten() + .ok_or(ErrorCode::Core_InvalidArgument)?; + + let session = self + .auto_matchmake_with_param_postpone(AutoMatchmakeParam { + matchmake_session: session, + additional_participants: vec![], + gid_for_participation_check: 0, + auto_matchmake_option: 0, + join_message, + participation_count: 0, + search_criteria: criteria, + target_gids: vec![], + }) + .await?; + + let any = Any::new(&session).map_err(|_| ErrorCode::Core_SystemError)?; + + Ok(any) + } } impl Matchmake for User { @@ -772,9 +800,9 @@ fn fetch_team_votes(fest_id: u32) -> Result, ErrorCode> { }) } -impl Utility for User{ - async fn acquire_nex_unique_id(&self) -> Result{ - return Ok(rand::random()) +impl Utility for User { + async fn acquire_nex_unique_id(&self) -> Result { + return Ok(rand::random()); } } diff --git a/rnex-core/src/rmc/protocols/matchmake_extension.rs b/rnex-core/src/rmc/protocols/matchmake_extension.rs index 6bc8ac5..190dd94 100644 --- a/rnex-core/src/rmc/protocols/matchmake_extension.rs +++ b/rnex-core/src/rmc/protocols/matchmake_extension.rs @@ -6,6 +6,7 @@ use rnex_core::rmc::structures::matchmake::{ use crate::rmc::protocols::notifications::NotificationEvent; use crate::rmc::structures::any::Any; +use crate::rmc::structures::matchmake::MatchmakeSessionSearchCriteria; #[rmc_proto(109)] pub trait MatchmakeExtension { @@ -35,6 +36,13 @@ pub trait MatchmakeExtension { &self, ty: i32, ) -> Result, ErrorCode>; + #[method_id(15)] + async fn auto_matchmake_with_search_criteria_postpone( + &self, + criteria: Vec, + gathering: Any, + join_msg: String, + ) -> Result; #[method_id(30)] async fn join_matchmake_session_ex( diff --git a/rnex-core/src/rmc/structures/matchmake.rs b/rnex-core/src/rmc/structures/matchmake.rs index 2e8a2ef..b4d3c5c 100644 --- a/rnex-core/src/rmc/structures/matchmake.rs +++ b/rnex-core/src/rmc/structures/matchmake.rs @@ -30,7 +30,7 @@ pub struct MatchmakeParam { cfg_if! { if #[cfg(feature = "v3-5-0")]{ - #[derive(RmcSerialize, Debug, Clone, Default)] + #[derive(RmcSerialize, Debug, Clone, Default, PartialEq)] #[rmc_struct(3)] pub struct MatchmakeSession { //inherits from