anonymous calls
This commit is contained in:
parent
309342b730
commit
8747657999
12 changed files with 712 additions and 39 deletions
|
|
@ -273,12 +273,6 @@ impl ClientConnection {
|
|||
return;
|
||||
}
|
||||
|
||||
// Handle ping
|
||||
if cv.is_type(CommunicationType::ping) {
|
||||
self.handle_ping(cv).await;
|
||||
return;
|
||||
}
|
||||
log_in!(PrintType::Client, "{}", &cv.to_json().to_string());
|
||||
// Handle client status changes
|
||||
if cv.is_type(CommunicationType::client_changed) {
|
||||
self.handle_client_changed(cv).await;
|
||||
|
|
@ -504,7 +498,11 @@ impl ClientConnection {
|
|||
.unwrap()
|
||||
.has_admin()
|
||||
{
|
||||
call.get_caller(user_id).await.unwrap().set_timeout(untill);
|
||||
call.get_caller(user_id)
|
||||
.await
|
||||
.unwrap()
|
||||
.set_timeout(untill)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -543,12 +541,14 @@ impl ClientConnection {
|
|||
)
|
||||
.unwrap();
|
||||
let enable = cv
|
||||
.get_data(DataTypes::enable)
|
||||
.get_data(DataTypes::enabled)
|
||||
.unwrap_or(&JsonValue::Null)
|
||||
.as_bool()
|
||||
.unwrap_or(false);
|
||||
.unwrap_or(true);
|
||||
|
||||
let call = call_manager::get_call(call_id).await;
|
||||
|
||||
let mut short_link = None;
|
||||
if let Some(call) = call {
|
||||
if call
|
||||
.get_caller(self.get_user_id().await)
|
||||
|
|
@ -558,7 +558,17 @@ impl ClientConnection {
|
|||
{
|
||||
call.set_anonymous_joining(enable).await;
|
||||
}
|
||||
short_link = call.get_short_link().await;
|
||||
}
|
||||
let mut response_cv =
|
||||
CommunicationValue::new(CommunicationType::call_set_anonymous_joining)
|
||||
.with_id(cv.get_id())
|
||||
.add_data(DataTypes::call_id, JsonValue::String(call_id.to_string()))
|
||||
.add_data(DataTypes::enabled, JsonValue::Boolean(enable));
|
||||
if let Some(short_link) = short_link {
|
||||
response_cv = response_cv.add_data(DataTypes::link, JsonValue::String(short_link));
|
||||
}
|
||||
self.send_message(&response_cv).await;
|
||||
}
|
||||
|
||||
/// Forward message to Iota
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ use crate::calls::call_group::CallGroup;
|
|||
use crate::calls::call_manager;
|
||||
use crate::get_private_key;
|
||||
use crate::get_public_key;
|
||||
use crate::log;
|
||||
use crate::log_err;
|
||||
use crate::log_in;
|
||||
use crate::log_out;
|
||||
|
|
@ -514,22 +513,22 @@ impl IotaConnection {
|
|||
for call in calls {
|
||||
for inviter in call.members.read().await.iter() {
|
||||
let call_self = call.get_caller(receiver_id).await.unwrap();
|
||||
let admin = call_self.has_admin();
|
||||
let inviter_id = inviter.user_id;
|
||||
let timeout = *call_self.timeout.read().await;
|
||||
|
||||
let mut call_obj = JsonValue::new_object();
|
||||
let _ = call_obj.insert("call_id", JsonValue::String(call.call_id.to_string()));
|
||||
if timeout > 0 {
|
||||
let _ = call_obj.insert("timeout", JsonValue::from(timeout));
|
||||
}
|
||||
if admin {
|
||||
let _ = call_obj.insert("admin", JsonValue::Boolean(admin));
|
||||
}
|
||||
|
||||
if let Some(call_ids) = invites.get_mut(&inviter_id) {
|
||||
let mut call_obj = JsonValue::new_object();
|
||||
let _ = call_obj.insert("call_id", JsonValue::String(call.call_id.to_string()));
|
||||
let timeout = *call_self.timeout.read().await;
|
||||
if timeout > 0 {
|
||||
let _ = call_obj.insert("timeout", JsonValue::from(timeout));
|
||||
}
|
||||
call_ids.push(call_obj);
|
||||
} else {
|
||||
let mut call_obj = JsonValue::new_object();
|
||||
let _ = call_obj.insert("call_id", JsonValue::String(call.call_id.to_string()));
|
||||
let timeout = *call_self.timeout.read().await;
|
||||
if timeout > 0 {
|
||||
let _ = call_obj.insert("timeout", JsonValue::from(timeout));
|
||||
}
|
||||
invites.insert(inviter_id, vec![call_obj]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
use super::{client_connection::ClientConnection, iota_connection::IotaConnection, rho_manager};
|
||||
use crate::omega::omega_connection::OmegaConnection;
|
||||
use crate::util::logger::PrintType;
|
||||
use crate::{
|
||||
data::{
|
||||
communication::{CommunicationType, CommunicationValue, DataTypes},
|
||||
user::UserStatus,
|
||||
},
|
||||
log,
|
||||
use crate::data::{
|
||||
communication::{CommunicationType, CommunicationValue, DataTypes},
|
||||
user::UserStatus,
|
||||
};
|
||||
use crate::omega::omega_connection::OmegaConnection;
|
||||
use json::{JsonValue, number::Number};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
Loading…
Reference in a new issue