1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-01-30 14:03:00 +00:00
comunicapiv3/src/helpers/calls_helper.rs

29 lines
848 B
Rust

//! # Calls helper
//!
//! @author Pierre Hubert
use crate::controllers::rtc_relay_controller;
use crate::data::config::conf;
use crate::data::conversation::Conversation;
/// Check out whether a conversation can make a call or not
pub fn can_have_call(conv: &Conversation) -> bool {
if let Some(conf) = &conf().rtc_relay {
return conv.members.len() > 1
&& conf.max_users_per_calls >= conv.members.len() as u64
&& rtc_relay_controller::is_connected();
}
false
}
/// Check out whether a conversation is allowed to make video calls or not
pub fn can_have_video_calls(conv: &Conversation) -> bool {
if let Some(conf) = &conf().rtc_relay {
return can_have_call(conv)
&& conf.allow_video
&& conf.max_users_per_video_calls >= conv.members.len() as u64;
}
false
}