Add teamspeak nickname config

Closes #2
This commit is contained in:
Aron Heinecke 2021-09-10 19:09:42 +02:00
parent 602f4605bc
commit b44dbe7372
2 changed files with 8 additions and 1 deletions

View file

@ -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

View file

@ -39,6 +39,7 @@ struct Config {
teamspeak_server: String,
teamspeak_identity: String,
teamspeak_channel: i32,
teamspeak_name: Option<String>,
/// 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);