Skip to content

Commit

Permalink
Some more errors are forwarded to the front-end.
Browse files Browse the repository at this point in the history
Reduced verbosity of debug messages.
  • Loading branch information
hoehermann committed Jul 27, 2024
1 parent da9da70 commit e7a3f41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/rust/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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));
}
}
}
Expand All @@ -264,7 +264,7 @@ pub async fn main(
rx: tokio::sync::mpsc::Receiver<crate::structs::Cmd>,
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 {
Expand Down
10 changes: 5 additions & 5 deletions src/rust/src/receive_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fn print_message<C: presage::store::Store>(
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
}
} {
Expand Down Expand Up @@ -215,21 +215,21 @@ pub async fn receive<C: presage::store::Store>(
manager: &mut presage::Manager<C, presage::manager::Registered>,
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;
}
}
Err(err) => {
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?"));
}

0 comments on commit e7a3f41

Please sign in to comment.