Update definition for ChatMessage and CommandExecution (#30)

* Update ChatMessage definition, prevent typing in chat from kicking players

fixes #24

* Update definition for CommandExecution
This commit is contained in:
Carson McManus 2022-09-07 14:21:20 -04:00 committed by GitHub
parent ce02b50623
commit 2b3794da7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 4 deletions

View file

@ -200,7 +200,10 @@ impl<R: AsyncRead + Unpin> Decoder<R> {
.context("decoding packet after decompressing")?;
ensure!(
decompressed.is_empty(),
"packet contents were not read completely"
format!(
"packet contents were not read completely, {} remaining bytes",
decompressed.len()
)
);
packet
} else {

View file

@ -122,9 +122,16 @@ pub mod play {
}
}
def_struct! {
MessageAcknowledgmentList {
entries: Vec<MessageAcknowledgmentEntry>,
}
}
def_struct! {
MessageAcknowledgment {
entry: Option<MessageAcknowledgmentEntry>,
last_seen: MessageAcknowledgmentList,
last_received: Option<MessageAcknowledgmentEntry>,
}
}
@ -135,11 +142,21 @@ pub mod play {
}
}
def_struct! {
ArgumentSignatureEntry {
name: BoundedString<0, 16>,
signature: Vec<u8>,
}
}
def_struct! {
CommandExecution {
command: String, // TODO: bounded?
// TODO: timestamp, arg signatures
command: BoundedString<0, 256>,
timestamp: u64,
salt: u64,
arg_sig: Vec<ArgumentSignatureEntry>,
signed_preview: bool,
acknowledgement: MessageAcknowledgment,
}
}
@ -150,6 +167,7 @@ pub mod play {
salt: u64,
signature: Vec<u8>,
signed_preview: bool,
acknowledgement: MessageAcknowledgment,
}
}