mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-18 18:51:08 +03:00
plugin_framework, block_input, ready to debug
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
use super::*;
|
||||
use std::{ffi::c_void, ptr::null, str::FromStr};
|
||||
use std::{ffi::c_void, ptr::null};
|
||||
|
||||
const EXT_SUPPORT_BLOCK_INPUT: &str = "block-input";
|
||||
|
||||
@@ -18,21 +18,17 @@ pub(super) fn ext_support_callback(
|
||||
// let supported = supported_plugins.contains(&id);
|
||||
let supported = true;
|
||||
if supported {
|
||||
match bool::from_str(&msg.data) {
|
||||
Ok(block) => {
|
||||
if crate::server::plugin_block_input(peer, block) == block {
|
||||
null()
|
||||
} else {
|
||||
make_return_code_msg(
|
||||
errno::ERR_CALLBACK_FAILED,
|
||||
"Failed to block input",
|
||||
)
|
||||
}
|
||||
}
|
||||
Err(err) => make_return_code_msg(
|
||||
if msg.data.len() != 1 {
|
||||
return make_return_code_msg(
|
||||
errno::ERR_CALLBACK_INVALID_ARGS,
|
||||
&format!("Failed to parse data: {}", err),
|
||||
),
|
||||
"Invalid data length",
|
||||
);
|
||||
}
|
||||
let block = msg.data[0] != 0;
|
||||
if crate::server::plugin_block_input(peer, block) == block {
|
||||
null()
|
||||
} else {
|
||||
make_return_code_msg(errno::ERR_CALLBACK_FAILED, "Failed to block input")
|
||||
}
|
||||
} else {
|
||||
make_return_code_msg(
|
||||
|
||||
Reference in New Issue
Block a user