Initial voice chat
This commit is contained in:
@@ -175,6 +175,7 @@ impl Server {
|
||||
client.send(types::message::ServerMessage::Authenticated {
|
||||
uuid,
|
||||
indicators: self.indicators.lock().unwrap().clone(),
|
||||
voice_chat: self.voice.lock().unwrap().get_connections(),
|
||||
}),
|
||||
)?;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ pub mod handshake {
|
||||
}
|
||||
|
||||
pub mod message {
|
||||
use std::collections::HashMap;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
@@ -110,6 +112,7 @@ pub mod message {
|
||||
Authenticated {
|
||||
uuid: Author,
|
||||
indicators: Vec<IndicatorContext>,
|
||||
voice_chat: HashMap<String, HashMap<String, u16>>,
|
||||
},
|
||||
|
||||
TempMessage {
|
||||
|
||||
+4
-7
@@ -46,16 +46,13 @@ impl Voice {
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Check if a user exists in a channel
|
||||
pub fn check(&self, channel_id: &str, user_id: &str) -> Option<u16> {
|
||||
self.connections
|
||||
.get(channel_id)
|
||||
.and_then(|users| users.get(user_id).copied())
|
||||
}
|
||||
|
||||
pub fn find_user(&self, user_id: &str) -> Option<(&String, u16)> {
|
||||
self.connections
|
||||
.iter()
|
||||
.find_map(|(channel_id, users)| users.get(user_id).map(|v| (channel_id, *v)))
|
||||
}
|
||||
|
||||
pub fn get_connections(&self) -> HashMap<String, HashMap<String, u16>> {
|
||||
self.connections.clone()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user