(fix): call invite stuff
This commit is contained in:
parent
9323daa34a
commit
5eed0033c1
5 changed files with 20 additions and 15 deletions
|
|
@ -341,10 +341,7 @@ impl AnonymousClientConnection {
|
||||||
|
|
||||||
/// Handle call invite
|
/// Handle call invite
|
||||||
async fn handle_call_invite(self: Arc<Self>, cv: CommunicationValue) {
|
async fn handle_call_invite(self: Arc<Self>, cv: CommunicationValue) {
|
||||||
let receiver_id: i64 = cv
|
let receiver_id: i64 = cv.get_data(DataType::ReceiverId).as_number().unwrap_or(0) as i64;
|
||||||
.get_data(DataType::ReceiverId)
|
|
||||||
.as_signed_number()
|
|
||||||
.unwrap_or(0) as i64;
|
|
||||||
if receiver_id == 0 {
|
if receiver_id == 0 {
|
||||||
self.send_error_response(&cv.get_id(), CommunicationType::ErrorNoUserId)
|
self.send_error_response(&cv.get_id(), CommunicationType::ErrorNoUserId)
|
||||||
.await;
|
.await;
|
||||||
|
|
@ -438,9 +435,12 @@ impl AnonymousClientConnection {
|
||||||
.add_typed_default(DataType::CallId, DataValue::Str(call_id.to_string()))
|
.add_typed_default(DataType::CallId, DataValue::Str(call_id.to_string()))
|
||||||
.add_typed_default(
|
.add_typed_default(
|
||||||
DataType::ReceiverId,
|
DataType::ReceiverId,
|
||||||
DataValue::Str(receiver_id.to_string()),
|
DataValue::SignedNumber(receiver_id.into()),
|
||||||
)
|
)
|
||||||
.add_typed_default(DataType::SenderId, DataValue::Str(sender_id.to_string()));
|
.add_typed_default(
|
||||||
|
DataType::SenderId,
|
||||||
|
DataValue::SignedNumber(sender_id.into()),
|
||||||
|
);
|
||||||
|
|
||||||
target_rho.message_to_client(forward).await;
|
target_rho.message_to_client(forward).await;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -283,10 +283,9 @@ impl OmegaConnection {
|
||||||
let host_public_key = load_public_key_bundle("./omega.mpkb")
|
let host_public_key = load_public_key_bundle("./omega.mpkb")
|
||||||
.map_err(|e| format!("Failed to load omega.mpkb: {}", e))?;
|
.map_err(|e| format!("Failed to load omega.mpkb: {}", e))?;
|
||||||
|
|
||||||
let mut connection =
|
let mut connection = Client::auth_connect(client_config, &load_keyring(), &host_public_key)
|
||||||
Client::auth_connect(client_config, &load_keyring(), &host_public_key)
|
.await
|
||||||
.await
|
.map_err(|e| format!("Connection failed: {}", e))?;
|
||||||
.map_err(|e| format!("Connection failed: {}", e))?;
|
|
||||||
|
|
||||||
log_in!(
|
log_in!(
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -328,10 +328,7 @@ impl ClientConnection {
|
||||||
|
|
||||||
/// Handle call invite
|
/// Handle call invite
|
||||||
async fn handle_call_invite(self: Arc<Self>, cv: CommunicationValue) {
|
async fn handle_call_invite(self: Arc<Self>, cv: CommunicationValue) {
|
||||||
let receiver_id: i128 = cv
|
let receiver_id: i128 = cv.get_data(DataType::ReceiverId).as_number().unwrap_or(0);
|
||||||
.get_data(DataType::ReceiverId)
|
|
||||||
.as_signed_number()
|
|
||||||
.unwrap_or(0);
|
|
||||||
if receiver_id == 0 {
|
if receiver_id == 0 {
|
||||||
self.send_error_response(cv.get_id(), CommunicationType::ErrorNoUserId)
|
self.send_error_response(cv.get_id(), CommunicationType::ErrorNoUserId)
|
||||||
.await;
|
.await;
|
||||||
|
|
|
||||||
|
|
@ -531,7 +531,12 @@ impl IotaConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_close(&self) {
|
pub async fn handle_close(&self) {
|
||||||
log_out!(self.iota_id as i64, PrintType::Iota, "Iota {} disconnected", self.iota_id);
|
log_out!(
|
||||||
|
self.iota_id as i64,
|
||||||
|
PrintType::Iota,
|
||||||
|
"Iota {} disconnected",
|
||||||
|
self.iota_id
|
||||||
|
);
|
||||||
if let Some(rho_conn) = self.get_rho_connection().await {
|
if let Some(rho_conn) = self.get_rho_connection().await {
|
||||||
rho_conn.close_iota_connection().await;
|
rho_conn.close_iota_connection().await;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,8 @@ fn format_data_container(data: Vec<(DataTypeId, DataValue)>, version: Version) -
|
||||||
DataValue::BoolFalse => format!("{}=false", key_str),
|
DataValue::BoolFalse => format!("{}=false", key_str),
|
||||||
|
|
||||||
DataValue::SignedNumber(num) => format!("{}={}", key_str, num),
|
DataValue::SignedNumber(num) => format!("{}={}", key_str, num),
|
||||||
|
DataValue::UnsignedNumber(num) => format!("{}={}", key_str, num),
|
||||||
|
DataValue::Bytes(bytes) => format!("{}=<{} bytes>", key_str, bytes.len()),
|
||||||
|
|
||||||
_ => "".to_string(),
|
_ => "".to_string(),
|
||||||
}
|
}
|
||||||
|
|
@ -244,6 +246,8 @@ fn format_array(arr: Vec<DataValue>, version: Version) -> String {
|
||||||
DataValue::BoolFalse => "false".to_string(),
|
DataValue::BoolFalse => "false".to_string(),
|
||||||
|
|
||||||
DataValue::SignedNumber(num) => num.to_string(),
|
DataValue::SignedNumber(num) => num.to_string(),
|
||||||
|
DataValue::UnsignedNumber(num) => num.to_string(),
|
||||||
|
DataValue::Bytes(bytes) => format!("<{} bytes>", bytes.len()),
|
||||||
|
|
||||||
_ => String::new(),
|
_ => String::new(),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue