aboutsummaryrefslogtreecommitdiffstats
path: root/src/teamspeak/mod.rs
diff options
context:
space:
mode:
authorJokler <jokler@protonmail.com>2020-08-11 16:50:02 +0200
committerJokler <jokler@protonmail.com>2020-08-11 16:50:02 +0200
commit1beccb77e57c53051160d664ccbb087835ac015a (patch)
treebc8d45ec2d036965e11361a7b799941c400cb82a /src/teamspeak/mod.rs
parent681950517d511d1c4b8e465f9b9758c027ecd6bf (diff)
downloadpokebot-1beccb77e57c53051160d664ccbb087835ac015a.tar.gz
pokebot-1beccb77e57c53051160d664ccbb087835ac015a.zip
Shut down on disconnect
Diffstat (limited to 'src/teamspeak/mod.rs')
-rw-r--r--src/teamspeak/mod.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/teamspeak/mod.rs b/src/teamspeak/mod.rs
index b53d1d0..dfff368 100644
--- a/src/teamspeak/mod.rs
+++ b/src/teamspeak/mod.rs
@@ -19,6 +19,7 @@ mod bbcode;
pub use bbcode::*;
pub struct TeamSpeakConnection {
+ id: ClientId,
conn: Connection,
}
@@ -106,7 +107,8 @@ impl TeamSpeakConnection {
}),
);
- Ok(TeamSpeakConnection { conn })
+ let id = conn.lock().own_client;
+ Ok(TeamSpeakConnection { conn, id })
}
pub fn send_audio_packet(&self, samples: &[u8]) {
@@ -169,6 +171,10 @@ impl TeamSpeakConnection {
.channel
}
+ pub fn my_id(&self) -> ClientId {
+ self.id
+ }
+
pub fn user_count(&self, channel: ChannelId) -> u32 {
let conn = self.conn.lock();
let mut count = 0;