diff options
| author | Jokler <jokler@protonmail.com> | 2020-08-11 16:50:02 +0200 |
|---|---|---|
| committer | Jokler <jokler@protonmail.com> | 2020-08-11 16:50:02 +0200 |
| commit | 1beccb77e57c53051160d664ccbb087835ac015a (patch) | |
| tree | bc8d45ec2d036965e11361a7b799941c400cb82a /src/teamspeak | |
| parent | 681950517d511d1c4b8e465f9b9758c027ecd6bf (diff) | |
| download | pokebot-1beccb77e57c53051160d664ccbb087835ac015a.tar.gz pokebot-1beccb77e57c53051160d664ccbb087835ac015a.zip | |
Shut down on disconnect
Diffstat (limited to 'src/teamspeak')
| -rw-r--r-- | src/teamspeak/mod.rs | 8 |
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; |
