From: Ian Jackson Date: Fri, 13 Nov 2020 21:39:15 +0000 (+0000) Subject: shuffle Who nfc X-Git-Tag: otter-0.2.0~520 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=13c714b80c5546eecaf9ed2feaeb9b607188f303;p=otter.git shuffle Who nfc Signed-off-by: Ian Jackson --- diff --git a/src/cmdlistener.rs b/src/cmdlistener.rs index 8d6837a0..2f11c395 100644 --- a/src/cmdlistener.rs +++ b/src/cmdlistener.rs @@ -231,7 +231,8 @@ fn execute_game_insn<'cs, 'igr, 'ig : 'igr>( cs: &'cs CommandStream, ag: &'_ mut AccountsGuard, ig: &'igr mut Unauthorised, InstanceName>, - update: MgmtGameInstruction) + update: MgmtGameInstruction, + who: &impl Display) -> Result ,ME> { type U = ExecuteGameChangeUpdates; @@ -239,7 +240,6 @@ fn execute_game_insn<'cs, 'igr, 'ig : 'igr>( use MgmtGameResponse::*; type Insn = MgmtGameInstruction; type Resp = MgmtGameResponse; - let who = &cs.who; // todo show player nick when it's a player fn tz_from_str(s: &str) -> Timezone { match Timezone::from_str(s) { @@ -523,7 +523,7 @@ fn execute_game_insn<'cs, 'igr, 'ig : 'igr>( #[throws(InternalError)] fn remove_old_players(ag: &AccountsGuard, ig: &mut InstanceGuard, - who: &Who, log: &mut Vec) { + who: &impl Display, log: &mut Vec) { let owner_account = ig.name.account.to_string(); let eacl = EffectiveACL { owner_account: Some(&owner_account), @@ -583,9 +583,10 @@ fn execute_for_game<'cs, 'igr, 'ig : 'igr>( let mut uh = UpdateHandler::from_how(how); let mut responses = Vec::with_capacity(insns.len()); let mut auth = None; + let who = Who; let res = (||{ for insn in insns.drain(0..) { - let (updates, resp, ig) = execute_game_insn(cs, ag, igu, insn)?; + let (updates, resp, ig) = execute_game_insn(cs, ag, igu, insn, &who)?; uh.accumulate(ig, updates)?; responses.push(resp); auth = Some(Authorisation::authorised(&*ig.name));