From 5eed0033c1307c8b00acbbb5efea1d23c14c49af Mon Sep 17 00:00:00 2001 From: Alois Date: Mon, 6 Jul 2026 21:34:24 +0200 Subject: [PATCH] (fix): call invite stuff --- src/anonymous_clients/anonymous_client_connection.rs | 12 ++++++------ src/omega/omega_connection.rs | 7 +++---- src/rho/client_connection.rs | 5 +---- src/rho/iota_connection.rs | 7 ++++++- src/util/logger.rs | 4 ++++ 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/anonymous_clients/anonymous_client_connection.rs b/src/anonymous_clients/anonymous_client_connection.rs index 44cf320..6e47fd2 100644 --- a/src/anonymous_clients/anonymous_client_connection.rs +++ b/src/anonymous_clients/anonymous_client_connection.rs @@ -341,10 +341,7 @@ impl AnonymousClientConnection { /// Handle call invite async fn handle_call_invite(self: Arc, cv: CommunicationValue) { - let receiver_id: i64 = cv - .get_data(DataType::ReceiverId) - .as_signed_number() - .unwrap_or(0) as i64; + let receiver_id: i64 = cv.get_data(DataType::ReceiverId).as_number().unwrap_or(0) as i64; if receiver_id == 0 { self.send_error_response(&cv.get_id(), CommunicationType::ErrorNoUserId) .await; @@ -438,9 +435,12 @@ impl AnonymousClientConnection { .add_typed_default(DataType::CallId, DataValue::Str(call_id.to_string())) .add_typed_default( 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; diff --git a/src/omega/omega_connection.rs b/src/omega/omega_connection.rs index 09076fa..31cdb0a 100644 --- a/src/omega/omega_connection.rs +++ b/src/omega/omega_connection.rs @@ -283,10 +283,9 @@ impl OmegaConnection { let host_public_key = load_public_key_bundle("./omega.mpkb") .map_err(|e| format!("Failed to load omega.mpkb: {}", e))?; - let mut connection = - Client::auth_connect(client_config, &load_keyring(), &host_public_key) - .await - .map_err(|e| format!("Connection failed: {}", e))?; + let mut connection = Client::auth_connect(client_config, &load_keyring(), &host_public_key) + .await + .map_err(|e| format!("Connection failed: {}", e))?; log_in!( 0, diff --git a/src/rho/client_connection.rs b/src/rho/client_connection.rs index eab0f92..ea70ccb 100644 --- a/src/rho/client_connection.rs +++ b/src/rho/client_connection.rs @@ -328,10 +328,7 @@ impl ClientConnection { /// Handle call invite async fn handle_call_invite(self: Arc, cv: CommunicationValue) { - let receiver_id: i128 = cv - .get_data(DataType::ReceiverId) - .as_signed_number() - .unwrap_or(0); + let receiver_id: i128 = cv.get_data(DataType::ReceiverId).as_number().unwrap_or(0); if receiver_id == 0 { self.send_error_response(cv.get_id(), CommunicationType::ErrorNoUserId) .await; diff --git a/src/rho/iota_connection.rs b/src/rho/iota_connection.rs index e47d3d9..d0a46e4 100755 --- a/src/rho/iota_connection.rs +++ b/src/rho/iota_connection.rs @@ -531,7 +531,12 @@ impl IotaConnection { } 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 { rho_conn.close_iota_connection().await; } diff --git a/src/util/logger.rs b/src/util/logger.rs index f908151..dfc26fa 100644 --- a/src/util/logger.rs +++ b/src/util/logger.rs @@ -213,6 +213,8 @@ fn format_data_container(data: Vec<(DataTypeId, DataValue)>, version: Version) - DataValue::BoolFalse => format!("{}=false", key_str), 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(), } @@ -244,6 +246,8 @@ fn format_array(arr: Vec, version: Version) -> String { DataValue::BoolFalse => "false".to_string(), DataValue::SignedNumber(num) => num.to_string(), + DataValue::UnsignedNumber(num) => num.to_string(), + DataValue::Bytes(bytes) => format!("<{} bytes>", bytes.len()), _ => String::new(), })