1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-07-17 20:58:05 +00:00

Can check whether a conversation is having a call or not

This commit is contained in:
2021-02-10 18:14:17 +01:00
parent 74b74fe76b
commit 5194a389af
2 changed files with 21 additions and 2 deletions

@ -43,6 +43,25 @@ pub fn get_config(r: &mut UserWsRequestHandler) -> RequestResult {
r.internal_error(ExecError::boxed_new("Missing calls configuration!"))
}
/// Check out whether a conversation is having a call or not
pub fn is_conversation_having_call(conv_id: &ConvID) -> bool {
let mut found = false;
let res = user_ws_controller::foreach_connection(|f| {
if found || f.is_having_call_with_conversation(conv_id) {
found = true;
}
Ok(())
});
if let Err(e) = res {
eprintln!("Failed to check if a conversation is having call! Conversation: {} / Error: {:#?}", conv_id, e);
}
found
}
/// Join a call
pub fn join_call(r: &mut UserWsRequestHandler) -> RequestResult {
let conv_id = r.post_conv_id("convID")?;