Call Kicking and Timeouting, basics of anonymous calls
This commit is contained in:
parent
494e08241c
commit
309342b730
5 changed files with 159 additions and 22 deletions
|
|
@ -9,6 +9,7 @@ pub struct CallGroup {
|
|||
pub call_id: Uuid,
|
||||
pub members: RwLock<Vec<Arc<Caller>>>,
|
||||
pub show: RwLock<bool>,
|
||||
pub anonymous_joining: RwLock<bool>,
|
||||
}
|
||||
|
||||
impl CallGroup {
|
||||
|
|
@ -17,6 +18,27 @@ impl CallGroup {
|
|||
call_id,
|
||||
members: RwLock::new(vec![user]),
|
||||
show: RwLock::new(true),
|
||||
anonymous_joining: RwLock::new(false),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_caller(&self, user_id: i64) -> Option<Arc<Caller>> {
|
||||
self.members
|
||||
.read()
|
||||
.await
|
||||
.iter()
|
||||
.find(|caller| caller.user_id == user_id)
|
||||
.cloned()
|
||||
}
|
||||
|
||||
pub async fn set_anonymous_joining(&self, enable: bool) {
|
||||
*self.anonymous_joining.write().await = enable;
|
||||
}
|
||||
|
||||
pub async fn remove_caller(&self, user_id: i64) {
|
||||
self.members
|
||||
.write()
|
||||
.await
|
||||
.retain(|caller| caller.user_id != user_id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue