From e7a3f41542c0374c70acd5f3c5020500534d1a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hermann=20H=C3=B6hne?= Date: Sat, 27 Jul 2024 12:11:35 +0200 Subject: [PATCH] Some more errors are forwarded to the front-end. Reduced verbosity of debug messages. --- src/rust/src/core.rs | 6 +++--- src/rust/src/receive_text.rs | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rust/src/core.rs b/src/rust/src/core.rs index 1fa6189..9bdf0bb 100755 --- a/src/rust/src/core.rs +++ b/src/rust/src/core.rs @@ -211,7 +211,7 @@ pub async fn mainloop( break; } _ => { - purple_debug(account, 2, format!("run {:?} begins…\n", cmd)); + //purple_debug(account, 2, format!("run {:?} begins…\n", cmd)); // TODO: find out if config_store.clone() is the correct thing to do here match run(cmd.clone(), config_store.clone(), manager, account).await { Ok(m) => { @@ -247,7 +247,7 @@ pub async fn mainloop( purple_error(account, 16, format!("run Err {err:?}")); } } - purple_debug(account, 2, format!("run {:?} finished.\n", cmd)); + //purple_debug(account, 2, format!("run {:?} finished.\n", cmd)); } } } @@ -264,7 +264,7 @@ pub async fn main( rx: tokio::sync::mpsc::Receiver, account: *const std::os::raw::c_void, ) { - purple_debug(account, 2, String::from("opening config database from {store_path}\n")); + purple_debug(account, 2, format!("opening config database from {store_path}\n")); let config_store = presage_store_sled::SledStore::open_with_passphrase(store_path, passphrase, presage_store_sled::MigrationConflictStrategy::Raise, presage_store_sled::OnNewIdentity::Trust); match config_store { diff --git a/src/rust/src/receive_text.rs b/src/rust/src/receive_text.rs index 75f928b..7445ed9 100755 --- a/src/rust/src/receive_text.rs +++ b/src/rust/src/receive_text.rs @@ -106,7 +106,7 @@ fn print_message( presage::libsignal_service::content::ContentBody::TypingMessage(_) => None, //Some(Msg::Received(&thread, "is typing...".into())), // too annyoing for now. also does not differentiate between "started typing" and "stopped typing" presage::libsignal_service::content::ContentBody::ReceiptMessage(_) => None, //Some(Msg::Received(&thread, "received a message.".into())), // works, but too annyoing for now c => { - println!("rust: unsupported message {c:?}"); + crate::core::purple_debug(account, 2, format!("Unsupported message {c:?}\n")); None } } { @@ -215,15 +215,15 @@ pub async fn receive( manager: &mut presage::Manager, account: *const std::os::raw::c_void, ) { - crate::core::purple_debug(account, 2, String::from("receive on separate thread begins…\n")); + //crate::core::purple_debug(account, 2, String::from("receive on separate thread begins…\n")); let messages = manager.receive_messages(presage::manager::ReceivingMode::Forever).await; match messages { Ok(messages) => { - crate::core::purple_debug(account, 2, String::from("receive got messages\n")); + //crate::core::purple_debug(account, 2, String::from("receive got messages\n")); futures::pin_mut!(messages); while let Some(content) = messages.next().await { // NOTE: This blocks until there is a message to be handled. Blocking forever seems to be by design. - crate::core::purple_debug(account, 2, String::from("receive got a message's content\n")); + //crate::core::purple_debug(account, 2, String::from("receive got a message's content\n")); process_incoming_message(manager, &content, account).await; } } @@ -231,5 +231,5 @@ pub async fn receive( crate::core::purple_error(account, 16, err.to_string()); } } - crate::core::purple_debug(account, 2, String::from("receive on separate thread finished\n")); + crate::core::purple_error(account, 0, String::from("Receiver has finished. Disconnected?")); }