make cli compilable

This commit is contained in:
rustdesk
2022-12-29 00:02:31 +08:00
parent 08b8f40397
commit 4d2e62981b
7 changed files with 115 additions and 103 deletions

View File

@@ -1481,6 +1481,19 @@ impl LoginConfigHandler {
msg_out.set_misc(misc);
msg_out
}
pub fn set_force_relay(&mut self, direct: bool, received: bool) {
self.force_relay = false;
if direct && !received {
let errno = errno::errno().0;
log::info!("errno is {}", errno);
// TODO: check mac and ios
if cfg!(windows) && errno == 10054 || !cfg!(windows) && errno == 104 {
self.force_relay = true;
self.set_option("force-always-relay".to_owned(), "Y".to_owned());
}
}
}
}
/// Media data.
@@ -1825,18 +1838,20 @@ pub trait Interface: Send + Clone + 'static + Sized {
fn msgbox(&self, msgtype: &str, title: &str, text: &str, link: &str);
fn handle_login_error(&mut self, err: &str) -> bool;
fn handle_peer_info(&mut self, pi: PeerInfo);
fn set_force_relay(&mut self, direct: bool, received: bool);
fn set_connection_info(&mut self, direct: bool, received: bool);
fn is_file_transfer(&self) -> bool;
fn is_port_forward(&self) -> bool;
fn is_rdp(&self) -> bool;
fn on_error(&self, err: &str) {
self.msgbox("error", "Error", err, "");
}
fn is_force_relay(&self) -> bool;
async fn handle_hash(&mut self, pass: &str, hash: Hash, peer: &mut Stream);
async fn handle_login_from_ui(&mut self, password: String, remember: bool, peer: &mut Stream);
async fn handle_test_delay(&mut self, t: TestDelay, peer: &mut Stream);
fn get_login_config_handler(&self) -> Arc<RwLock<LoginConfigHandler>>;
fn set_force_relay(&self, direct: bool, received: bool) {
self.get_login_config_handler().write().unwrap().set_force_relay(direct, received);
}
fn is_force_relay(&self) -> bool {
self.get_login_config_handler().read().unwrap().force_relay
}
}
/// Data used by the client interface.