From 946491fa77eb89686a70275cb000fdccbf5a5143 Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Tue, 6 Sep 2022 09:39:26 -0400 Subject: [PATCH] prevent typing in chat from kicking players fixes #24 --- src/protocol/codec.rs | 2 +- src/protocol/packets/c2s.rs | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/protocol/codec.rs b/src/protocol/codec.rs index 0054372c9..0ce55cc99 100644 --- a/src/protocol/codec.rs +++ b/src/protocol/codec.rs @@ -200,7 +200,7 @@ impl Decoder { .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 { diff --git a/src/protocol/packets/c2s.rs b/src/protocol/packets/c2s.rs index 735183f88..866b5442c 100644 --- a/src/protocol/packets/c2s.rs +++ b/src/protocol/packets/c2s.rs @@ -150,6 +150,27 @@ pub mod play { salt: u64, signature: Vec, signed_preview: bool, + acknowledgement: LastSeenMessageListAcknowledgement, + } + } + + def_struct! { + LastSeenMessageList { + entries: Vec, + } + } + + def_struct! { + LastSeenMessageListEntry { + profile_id: Uuid, + last_signature: Vec, + } + } + + def_struct! { + LastSeenMessageListAcknowledgement { + last_seen: LastSeenMessageList, + last_received: Option } }