better prompt text
This commit is contained in:
+1
-19
@@ -141,24 +141,6 @@ struct Connection {
|
||||
events: CbSender<Event>,
|
||||
}
|
||||
|
||||
impl Connection {
|
||||
// this is where last minute processing happens
|
||||
// use it to modify outgoing messages, update subs, serialize in some way...
|
||||
fn send(&self, msg: RpcMessage) -> Result<(), Error> {
|
||||
let msg = match msg {
|
||||
RpcMessage::InstanceState(v) => RpcMessage::InstanceState(v.redact(self.id)),
|
||||
RpcMessage::AccountInstances(v) =>
|
||||
RpcMessage::AccountInstances(v.into_iter().map(|i| i.redact(self.id)).collect()),
|
||||
RpcMessage::GameState(v) => RpcMessage::GameState(v.redact(self.id)),
|
||||
_ => msg,
|
||||
};
|
||||
|
||||
self.ws.send(msg).unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
// we unwrap everything in here cause really
|
||||
// we don't care if this panics
|
||||
// it's run in a thread so it's supposed to bail
|
||||
@@ -178,7 +160,7 @@ impl Handler for Connection {
|
||||
},
|
||||
Err(e) => {
|
||||
warn!("{:?}", e);
|
||||
self.send(RpcMessage::Error(e.to_string())).unwrap();
|
||||
self.ws.send(RpcMessage::Error(e.to_string())).unwrap();
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -50,6 +50,16 @@ impl User for Anonymous {
|
||||
_ => (),
|
||||
};
|
||||
|
||||
// last minute redactions and processing
|
||||
// this happens after the state setting as we need to keep
|
||||
// all the skills to prevent forfeiting
|
||||
let msg = match msg {
|
||||
RpcMessage::InstanceState(v) => RpcMessage::InstanceState(v.redact(self.id)),
|
||||
RpcMessage::GameState(v) => RpcMessage::GameState(v.redact(self.id)),
|
||||
_ => msg,
|
||||
};
|
||||
|
||||
|
||||
self.ws.send(msg)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -79,6 +79,15 @@ impl User for Authenticated {
|
||||
_ => (),
|
||||
};
|
||||
|
||||
// last minute processing
|
||||
let msg = match msg {
|
||||
RpcMessage::InstanceState(v) => RpcMessage::InstanceState(v.redact(self.id)),
|
||||
RpcMessage::AccountInstances(v) =>
|
||||
RpcMessage::AccountInstances(v.into_iter().map(|i| i.redact(self.id)).collect()),
|
||||
RpcMessage::GameState(v) => RpcMessage::GameState(v.redact(self.id)),
|
||||
_ => msg,
|
||||
};
|
||||
|
||||
self.ws.send(msg)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user