From b44dbe7372639cceba24a6f596859b9753bf4c14 Mon Sep 17 00:00:00 2001 From: Aron Heinecke Date: Fri, 10 Sep 2021 19:09:42 +0200 Subject: [PATCH] Add teamspeak nickname config Closes #2 --- credentials.example.toml | 2 ++ src/main.rs | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/credentials.example.toml b/credentials.example.toml index 4a875c8..897f51b 100644 --- a/credentials.example.toml +++ b/credentials.example.toml @@ -6,6 +6,8 @@ teamspeak_server = "IP:PORT" # NO tsdns teamspeak_identity = "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITsC/50CIA8M5nmDBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI" # join channel ID teamspeak_channel = 1 +# teamspeak nickname +teamspeak_name = "voice bridge" # logging stuff, 0-3 verbose = 1 # currently unused diff --git a/src/main.rs b/src/main.rs index 2639f9d..b636c4c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,6 +39,7 @@ struct Config { teamspeak_server: String, teamspeak_identity: String, teamspeak_channel: i32, + teamspeak_name: Option, /// default 0 verbose: i32, /// default 1.0 @@ -171,11 +172,15 @@ async fn main() -> Result<()> { let con_id = ConnectionId(0); // configure teamspeak client - let con_config = Connection::build(config.teamspeak_server) + let mut con_config = Connection::build(config.teamspeak_server) .log_commands(config.verbose >= 1) .log_packets(config.verbose >= 2) .log_udp_packets(config.verbose >= 3); + if let Some(name) = config.teamspeak_name { + con_config = con_config.name(name); + } + // teamspeak: Optionally set the key of this client, otherwise a new key is generated. let id = Identity::new_from_str(&config.teamspeak_identity).expect("Can't load identity!"); let con_config = con_config.identity(id);