diff options
| author | Jokler <jokler@protonmail.com> | 2020-09-01 18:14:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-01 18:14:17 +0200 |
| commit | 130cde033795382b70a312846a8f2704a15d11e3 (patch) | |
| tree | 9464e08f4e15906418f40ebef76bc150d3162bbe /src/teamspeak/mod.rs | |
| parent | 161c8ab648036cf0999b248fab4bf57e3a55cb61 (diff) | |
| parent | 1beccb77e57c53051160d664ccbb087835ac015a (diff) | |
| download | pokebot-130cde033795382b70a312846a8f2704a15d11e3.tar.gz pokebot-130cde033795382b70a312846a8f2704a15d11e3.zip | |
Merge pull request #60 from Mavulp/auto-reconnect
Shut down on disconnect
Diffstat (limited to 'src/teamspeak/mod.rs')
| -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 66d973c..fc10116 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, } @@ -104,7 +105,8 @@ impl TeamSpeakConnection { }), ); - Ok(TeamSpeakConnection { conn }) + let id = conn.lock().own_client; + Ok(TeamSpeakConnection { conn, id }) } pub fn send_audio_packet(&self, samples: &[u8]) { @@ -167,6 +169,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; |
