feat(protocols): extend functionality of protocol macro

This commit is contained in:
DJMrTV 2025-02-01 19:42:45 +01:00
commit 1679590bf3
6 changed files with 38 additions and 12 deletions

View file

@ -5,11 +5,10 @@ use crate::rmc::response::{ErrorCode, RMCResponse, RMCResponseResult};
use crate::rmc::structures::{string, any, RmcSerialize};
use crate::rmc::structures::any::Any;
pub fn login_ex(name: &str) -> RMCResponseResult{
pub fn login_ex(rmcmessage: &RMCMessage, name: &str) -> RMCResponseResult{
// todo: figure out how the AuthenticationInfo struct works, parse it and validate login info
//return rmcmessage.error_result_with_code(ErrorCode::Core_InvalidArgument);
unreachable!()
return rmcmessage.error_result_with_code(ErrorCode::Core_InvalidArgument);
}
pub fn login_ex_raw_params(rmcmessage: &RMCMessage) -> RMCResponseResult{
@ -35,6 +34,5 @@ pub fn login_ex_raw_params(rmcmessage: &RMCMessage) -> RMCResponseResult{
}
}
//login_ex(&str)
rmcmessage.error_result_with_code(ErrorCode::Authentication_UnderMaintenance)
login_ex(rmcmessage, &str)
}

View file

@ -2,13 +2,14 @@ mod method_login_ex;
use log::{error, info};
use crate::define_protocol;
use crate::nex::account::Account;
use crate::protocols::auth::method_login_ex::{login_ex, login_ex_raw_params};
use crate::rmc::message::RMCMessage;
use crate::rmc::response::{ErrorCode, RMCResponse, RMCResponseResult};
define_protocol!{
10 => {
10<'a>(account: &'a Account) => {
0x02 => login_ex_raw_params
}
}