disallow composing on offline contact

This commit is contained in:
creating2morrow 2023-05-01 00:14:30 -04:00
parent c70d53357e
commit 7070bbb77b
3 changed files with 17 additions and 4 deletions

View file

@ -1,7 +1,7 @@
use rand_core::RngCore;
use clap::Parser;
use rocket::serde::json::Json;
use crate::{args, db, i2p, message, models, monero, gpg, utils, reqres};
use crate::{args, db, i2p, models, monero, gpg, utils, reqres};
use log::{info, debug, error, warn};
use std::time::Duration;
@ -317,7 +317,7 @@ pub async fn start_up() {
gen_app_gpg().await;
let env: String = get_release_env().value();
start_gui();
{ tokio::spawn(async { message::retry_fts().await; }); }
// { tokio::spawn(async { message::retry_fts().await; }); }
info!("{} - nevmes is online", env);
}

View file

@ -1,4 +1,7 @@
## Dev
`cd ../ && cargo build && cd nevmes-gui && RUST_LOG=debug cargo run`
Note: gui depends on the binary if starting core from gui
otherwise run nevmes core on your own
`cd ../ && cargo build && cp target/debug/nevmes nevmes-gui/ && cd nevmes-gui && RUST_LOG=debug cargo run`

View file

@ -159,6 +159,14 @@ impl eframe::App for AddressBookApp {
self.approve_contact = true;
}
if self.showing_status {
let i2p_address = self.s_contact.i2p_address.clone();
if self.s_contact.xmr_address == utils::empty_string() {
clear_gui_db(String::from("gui-online"), String::from(&i2p_address));
write_gui_db(String::from("gui-online"), String::from(&i2p_address), String::from("0"));
} else {
clear_gui_db(String::from("gui-online"), String::from(&i2p_address));
write_gui_db(String::from("gui-online"), String::from(&i2p_address), String::from("1"));
}
self.is_pinging = false;
}
}
@ -490,9 +498,11 @@ impl eframe::App for AddressBookApp {
Ok(n) => n,
Err(_e) => 0,
};
let is_online_now = search_gui_db(String::from("gui-online"), String::from(&c.i2p_address));
if now < expire && self.status.signed_key
&& self.status.jwp != utils::empty_string()
&& c.i2p_address == self.status.i2p {
&& c.i2p_address == self.status.i2p
&& is_online_now == String::from("1") {
if ui.button("Compose").clicked() {
self.is_composing = true;
}