cleaned up code, condensed code and fixed a couple of things
This commit is contained in:
parent
40ca10651f
commit
38bcad37bd
10 changed files with 178 additions and 95 deletions
|
|
@ -2,7 +2,8 @@ use std::io::Cursor;
|
|||
use log::{error, info};
|
||||
use crate::rmc::message::RMCMessage;
|
||||
use crate::rmc::response::{ErrorCode, RMCResponse, RMCResponseResult};
|
||||
use crate::rmc::structures::{string, any};
|
||||
use crate::rmc::structures::{string, any, RmcSerialize};
|
||||
use crate::rmc::structures::any::Any;
|
||||
|
||||
pub fn login_ex(name: &str) -> RMCResponseResult{
|
||||
// todo: figure out how the AuthenticationInfo struct works, parse it and validate login info
|
||||
|
|
@ -14,12 +15,12 @@ pub fn login_ex(name: &str) -> RMCResponseResult{
|
|||
pub fn login_ex_raw_params(rmcmessage: &RMCMessage) -> RMCResponseResult{
|
||||
let mut reader = Cursor::new(&rmcmessage.rest_of_data);
|
||||
|
||||
let Ok(str) = string::read(&mut reader) else {
|
||||
let Ok(str) = String::deserialize(&mut reader) else {
|
||||
error!("error reading packet");
|
||||
return rmcmessage.error_result_with_code(ErrorCode::Core_InvalidArgument);
|
||||
};
|
||||
|
||||
let Ok(any) = any::read(&mut reader) else {
|
||||
let Ok(any) = Any::deserialize(&mut reader) else {
|
||||
error!("error reading packet");
|
||||
return rmcmessage.error_result_with_code(ErrorCode::Core_InvalidArgument);
|
||||
};
|
||||
|
|
@ -35,5 +36,5 @@ pub fn login_ex_raw_params(rmcmessage: &RMCMessage) -> RMCResponseResult{
|
|||
}
|
||||
|
||||
//login_ex(&str)
|
||||
rmcmessage.error_result_with_code(ErrorCode::Core_AccessDenied)
|
||||
rmcmessage.error_result_with_code(ErrorCode::Authentication_UnderMaintenance)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue