Files
client/core/vendor/tsclientlib.patch
T
omar e6464bc4ed feat: checkpoint account-free client workflows and source-matched UI
Preserve accumulated client implementation since v0.1.4, including local identities, multi-server state, chat, administration, audio and streaming controls. Refine official-source layout, original artwork, responsive composer overflow, settings navigation and chat scroll anchoring.

Current verification: Node suite passes; isolated packaged chat and responsive control smokes pass without device capture. Native core is reused, not rebuilt in this pass. Strict whole-screen visual parity remains incomplete; no 1:1 or cross-platform acceptance claim. Local checkpoint only; no release or push.
2026-11-01 19:43:18 +03:00

224 lines
8.2 KiB
Diff

diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -46,10 +46,12 @@
tracing = "0.1"
hickory-net = "0.26"
hickory-resolver = "0.26"
-ts-bookkeeping = { path = "../utils/ts-bookkeeping", version = "0.1" }
-tsproto = { path = "../tsproto", version = "0.2" }
-tsproto-packets = { path = "../utils/tsproto-packets", version = "0.1" }
-tsproto-types = { path = "../utils/tsproto-types", version = "0.1" }
+# TeamsPeach vendoring: the upstream workspace path dependencies are replaced by the
+# same crates pinned to the vendored upstream revision (see ../README.md).
+ts-bookkeeping = { git = "https://github.com/ReSpeak/tsclientlib", rev = "ee3bc6f45a7137db7793ba5593a321df400d53e5" }
+tsproto = { git = "https://github.com/ReSpeak/tsclientlib", rev = "ee3bc6f45a7137db7793ba5593a321df400d53e5" }
+tsproto-packets = { git = "https://github.com/ReSpeak/tsclientlib", rev = "ee3bc6f45a7137db7793ba5593a321df400d53e5" }
+tsproto-types = { git = "https://github.com/ReSpeak/tsclientlib", rev = "ee3bc6f45a7137db7793ba5593a321df400d53e5" }
url = "2"
[dev-dependencies]
diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -253,6 +253,15 @@
NetworkStatsUpdated,
/// A change related to audio.
AudioChange(AudioEvent),
+ /// TeamsPeach patch: a command whose name tsclientlib does not know (e.g. the TeamSpeak 6
+ /// `notifystream*` family). Upstream logs and drops these; they are handed out unparsed so
+ /// the application can read them with
+ /// [`CommandParser`](tsproto_packets::commands::CommandParser).
+ UnknownCommand(InCommandBuf),
+ /// TeamsPeach patch: copy of the content of a command selected by
+ /// [`ConnectOptions::raw_command_tap`], emitted before tsclientlib processes the command.
+ /// Lets the application read arguments the book does not store.
+ RawCommandCopy(Vec<u8>),
}
/// The `Connection` is the main interaction point with this library.
@@ -281,12 +290,17 @@
connection_time: time::OffsetDateTime,
}
+/// TeamsPeach patch: an established connection plus the raw `initserver` command content, so
+/// [`ConnectOptions::raw_command_tap`] can also select `initserver` (it is consumed before the
+/// normal command handling runs).
+type Established = (client::Client, data::Connection, Vec<u8>);
+
enum ConnectionState {
/// The future that resolves to a connection and a boolean if we should reconnect on failure.
///
/// If the `bool` is `false`, the connection will abort on error. Otherwise it will try to
/// connect again on timeout.
- Connecting(future::BoxFuture<'static, Result<(client::Client, data::Connection)>>, bool),
+ Connecting(future::BoxFuture<'static, Result<Established>>, bool),
IdentityLevelIncreasing {
/// We get the improved identity here.
recv: oneshot::Receiver<Identity>,
@@ -391,6 +405,8 @@
log_commands: false,
log_packets: false,
log_udp_packets: false,
+ raw_command_tap: None,
+ automatic_identity_level: true,
}
}
@@ -443,7 +459,7 @@
/// spam unnecessary packets if the internet or server is down.
async fn connect(
options: ConnectOptions, is_reconnect: bool,
- ) -> Result<(client::Client, data::Connection)> {
+ ) -> Result<Established> {
if is_reconnect {
tokio::time::sleep(Duration::from_secs(10)).await;
}
@@ -475,7 +491,7 @@
async fn connect_to(
options: &ConnectOptions, addr: SocketAddr,
- ) -> Result<(client::Client, data::Connection)> {
+ ) -> Result<Established> {
let counter = options.identity.as_ref().unwrap().counter();
let socket = Box::new(
UdpSocket::bind(options.local_address.unwrap_or_else(|| {
@@ -573,7 +589,7 @@
async fn wait_initserver(
mut client: client::Client,
- ) -> Result<(client::Client, data::Connection)> {
+ ) -> Result<Established> {
// Wait until we received the initserver packet.
loop {
let cmd = client
@@ -608,8 +624,9 @@
// Create connection
let data = data::Connection::new(public_key, &initserver);
-
- return Ok((client, data));
+ let raw = cmd.data().packet().content().to_vec();
+
+ return Ok((client, data, raw));
}
Ok(msg) => {
// TODO Save instead of drop
@@ -625,7 +642,7 @@
/// If this returns `None`, the level was increased and we should try
/// connecting again.
fn increase_identity_level(&mut self, needed: u8) -> Result<()> {
- if needed > 20 {
+ if !self.options.automatic_identity_level || needed > 20 {
return Err(Error::IdentityLevel(needed));
}
@@ -1144,7 +1161,11 @@
}
Poll::Ready(Some(Err(e)))
}
- Poll::Ready(Ok((client, book))) => {
+ Poll::Ready(Ok((client, book, initserver))) => {
+ // TeamsPeach patch: raw copy of `initserver` if the tap selects it.
+ if self.options.raw_command_tap.is_some_and(|tap| tap(b"initserver")) {
+ self.stream_items.push_back(Ok(StreamItem::RawCommandCopy(initserver)));
+ }
let con = ConnectedConnection {
client,
cur_return_code: 0,
@@ -1340,9 +1361,21 @@
&mut self, book: &mut data::Connection, stream_items: &mut VecDeque<Result<StreamItem>>,
options: &mut ConnectOptions, cmd: InCommandBuf,
) -> Option<TemporaryDisconnectReason> {
+ // TeamsPeach patch: optional raw copy of selected commands.
+ if let Some(tap) = options.raw_command_tap {
+ let content = cmd.data().packet().content();
+ if tap(CommandParser::new(content).0) {
+ stream_items.push_back(Ok(StreamItem::RawCommandCopy(content.to_vec())));
+ }
+ }
let msg = match InMessage::new(cmd.data().packet().header(), cmd.data().packet().content())
{
Ok(r) => r,
+ // TeamsPeach patch: hand unknown commands to the application instead of dropping them.
+ Err(ts_bookkeeping::messages::ParseError::UnknownCommand(_)) => {
+ stream_items.push_back(Ok(StreamItem::UnknownCommand(cmd)));
+ return None;
+ }
Err(error) => {
warn!(%error, "Failed to parse message");
return None;
@@ -1705,6 +1738,10 @@
log_commands: bool,
log_packets: bool,
log_udp_packets: bool,
+ /// TeamsPeach patch: selects commands (by name) to copy into [`StreamItem::RawCommandCopy`].
+ raw_command_tap: Option<fn(&[u8]) -> bool>,
+ /// Whether the client may automatically perform identity proof-of-work while connecting.
+ automatic_identity_level: bool,
}
impl ConnectOptions {
@@ -1800,6 +1837,12 @@
self
}
+ /// Disable automatic proof-of-work when an application has an explicit bounded identity worker.
+ pub fn automatic_identity_level(mut self, enabled: bool) -> Self {
+ self.automatic_identity_level = enabled;
+ self
+ }
+
/// Check the identity of the server to be equal with the given uid.
///
/// If the public key of the server does not match this uid, the connection will be aborted.
@@ -2001,6 +2044,17 @@
self
}
+ /// TeamsPeach patch: emit [`StreamItem::RawCommandCopy`] for every incoming command whose
+ /// name makes `tap` return `true`.
+ ///
+ /// # Default
+ /// `None`
+ #[inline]
+ pub fn raw_command_tap(mut self, tap: fn(&[u8]) -> bool) -> Self {
+ self.raw_command_tap = Some(tap);
+ self
+ }
+
#[inline]
pub fn get_address(&self) -> &ServerAddress { &self.address }
#[inline]
diff --git a/src/sync.rs b/src/sync.rs
--- a/src/sync.rs
+++ b/src/sync.rs
@@ -15,6 +15,7 @@
use tsproto_packets::packets::InAudioBuf;
#[cfg(feature = "unstable")]
use tsproto_packets::packets::OutCommand;
+use tsproto_packets::packets::InCommandBuf;
use crate::{
events, AudioEvent, DisconnectOptions, Error, InMessage, Result, StreamItem,
@@ -79,6 +80,10 @@
NetworkStatsUpdated,
/// A change related to audio.
AudioChange(AudioEvent),
+ /// TeamsPeach patch: see [`StreamItem::UnknownCommand`](crate::StreamItem::UnknownCommand).
+ UnknownCommand(InCommandBuf),
+ /// TeamsPeach patch: see [`StreamItem::RawCommandCopy`](crate::StreamItem::RawCommandCopy).
+ RawCommandCopy(Vec<u8>),
}
/// A handle for a [`SyncConnection`] which can be sent across threads.
@@ -281,6 +286,8 @@
}
StreamItem::NetworkStatsUpdated => SyncStreamItem::NetworkStatsUpdated,
StreamItem::AudioChange(change) => SyncStreamItem::AudioChange(change),
+ StreamItem::UnknownCommand(cmd) => SyncStreamItem::UnknownCommand(cmd),
+ StreamItem::RawCommandCopy(c) => SyncStreamItem::RawCommandCopy(c),
})),
Some(Err(e)) => Some(Err(e)),
None => {