1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Remove external state for op handlers

This commit is contained in:
NGnius (Graham)
2025-04-06 11:00:37 -04:00
parent b99bbe67e4
commit 4d2ddaeafb
19 changed files with 150 additions and 163 deletions

View File

@@ -12,17 +12,17 @@ use polariton_server::operations::OperationsHandler;
pub fn handler() -> OperationsHandler<crate::UserTy, crate::data::custom::CustomType> {
OperationsHandler::<crate::UserTy, crate::data::custom::CustomType>::new()
.without_state(more_auth::MoreLobbyAuth)
//.without_state(polariton_server::operations::Ack::<33, _>::default()) // get user clan info (this is equivalent to not being in a clan)
.without_state(friend_list::friends_provider()) // TODO friend object parsing Token: 0x0200169C RID: 5788
.without_state(settings::settings_provider()) // TODO save settings persistently
.without_state(polariton_server::operations::Ack::<43, _>::default()) // get my clan info (this is equivalent to not being in a clan)
.without_state(clan_invite::clan_invites_provider())
.without_state(polariton_server::operations::Ack::<19, _>::default()) // get pending platoon invite (this is equivalent to having no pending invite)
.without_state(clan_info::clan_info_provider())
.without_state(search_clan::search_clans_provider())
.without_state(polariton_server::operations::Ack::<52, _>::default()) // validate pending season rewards (this just always needs to be ack-ed)
.without_state(season_rewards::season_rewards_provider())
.without_state(previous_battle_rewards::pending_battle_rewards_provider())
.without_state(platoon_data::platoon_provider())
.add(more_auth::MoreLobbyAuth)
//.add(polariton_server::operations::Ack::<33, _>::default()) // get user clan info (this is equivalent to not being in a clan)
.add(friend_list::friends_provider()) // TODO friend object parsing Token: 0x0200169C RID: 5788
.add(settings::settings_provider()) // TODO save settings persistently
.add(polariton_server::operations::Ack::<43, _>::default()) // get my clan info (this is equivalent to not being in a clan)
.add(clan_invite::clan_invites_provider())
.add(polariton_server::operations::Ack::<19, _>::default()) // get pending platoon invite (this is equivalent to having no pending invite)
.add(clan_info::clan_info_provider())
.add(search_clan::search_clans_provider())
.add(polariton_server::operations::Ack::<52, _>::default()) // validate pending season rewards (this just always needs to be ack-ed)
.add(season_rewards::season_rewards_provider())
.add(previous_battle_rewards::pending_battle_rewards_provider())
.add(platoon_data::platoon_provider())
}

View File

@@ -7,11 +7,10 @@ impl MoreLobbyAuth {
const AUTH_PAYLOAD_KEY: u8 = 245;
}
impl <C> Operation<C> for MoreLobbyAuth {
type State = ();
impl <C: Send + 'static> Operation<C> for MoreLobbyAuth {
type User = crate::UserTy;
fn handle(&self, params: polariton::operation::ParameterTable<C>, _: &mut Self::State, user: &Self::User) -> polariton::operation::OperationResponse<C> {
fn handle(&self, params: polariton::operation::ParameterTable<C>, user: &Self::User) -> polariton::operation::OperationResponse<C> {
let params_dict = params.to_dict();
if let Some(Typed::Str(auth_payload)) = params_dict.get(&Self::AUTH_PAYLOAD_KEY) {
if user.update_with_auth(&auth_payload.string) {