From f03444bf093d6f42ba638d2d9345e8c883c817a9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 18 Nov 2020 22:08:00 +0000 Subject: [PATCH] omg it works again! Signed-off-by: Ian Jackson --- demo/test.table.toml | 13 ++++++------- src/bin/otter.rs | 5 ++++- src/cmdlistener.rs | 4 ++-- src/commands.rs | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/demo/test.table.toml b/demo/test.table.toml index ed537087..c11b01af 100644 --- a/demo/test.table.toml +++ b/demo/test.table.toml @@ -9,11 +9,10 @@ timezone = "Europe/London" [[players]] account_glob = "server:*" -#nick = "alice" -#access = "FixedToken" -#token = "kmqAKPwK4TfReFjMor8MJhdRPBcwIBpe" +# USER=rustcargo target/debug/otter --config ~ian/Rustup/Game/server/server.toml --account server: reset --reset-table ~ian/Rustup/Game/server/demo/test.table.toml dummy ~ian/Rustup/Game/server/demo/test.game.toml -#[[players]] -#nick = "bob" -#access = "FixedToken" -#token = "ccg9kzoTh758QrVE1xMY7BQWB36dNJTx" +# USER=rustcargo target/debug/otter --config ~ian/Rustup/Game/server/server.toml --super --fixed-token kmqAKPwK4TfReFjMor8MJhdRPBcwIBpe --account server:alice --game-name-account server: join-game dummy + +# USER=rustcargo target/debug/otter --config ~ian/Rustup/Game/server/server.toml --account server: library-list wikimedia \* + +# USER=rustcargo target/debug/otter --config ~ian/Rustup/Game/server/server.toml --account server: library-add dummy wikimedia chess-\* diff --git a/src/bin/otter.rs b/src/bin/otter.rs index ce0390b7..09683820 100644 --- a/src/bin/otter.rs +++ b/src/bin/otter.rs @@ -415,8 +415,11 @@ impl DerefMut for ConnForGame { impl ConnForGame { #[throws(AE)] fn join_game(&mut self, ma: &MainOpts) { + let nick = ma.nick.clone() + .or_else(|| Some(ma.account.default_nick())); + let insns = vec![ - MGI::JoinGame { details: MgmtPlayerDetails { nick: ma.nick.clone() } }, + MGI::JoinGame { details: MgmtPlayerDetails { nick } }, ]; let resp = self.alter_game(insns, None)?; diff --git a/src/cmdlistener.rs b/src/cmdlistener.rs index 1bcce648..ae4049f0 100644 --- a/src/cmdlistener.rs +++ b/src/cmdlistener.rs @@ -310,9 +310,9 @@ fn execute_game_insn<'cs, 'igr, 'ig : 'igr>( let account = &cs.current_account()?.notional_account; let (arecord, acctid) = ag.lookup(account)?; let (ig, auth) = cs.check_acl(ag, ig, PCH::Instance, &[TP::Play])?; - let nick = nick.ok_or(ME::ParameterMissing)?; + let nick = nick.ok_or(ME::MustSpecifyNick)?; let logentry = LogEntry { - html: Html(format!("{} ({}) joined the game", + html: Html(format!("{} [{}] joined the game", &nick, &account)), }; let timezone = &arecord.timezone diff --git a/src/commands.rs b/src/commands.rs index bbe1e89f..589b0faf 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -151,8 +151,8 @@ pub enum MgmtError { ParseFailed(String), AuthorisationError, SuperuserAuthorisationRequired, - ParameterMissing, SpecifyAccount, + MustSpecifyNick, AlreadyExists, NickCollision, GameBeingDestroyed, -- 2.30.2