mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-14 00:31:01 +03:00
plugin_framework, return C structure
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
use super::*;
|
||||
use std::{ffi::c_void, ptr::null};
|
||||
|
||||
const EXT_SUPPORT_BLOCK_INPUT: &str = "block-input";
|
||||
|
||||
@@ -11,7 +10,7 @@ pub(super) fn ext_support_callback(
|
||||
id: &str,
|
||||
peer: &str,
|
||||
msg: &super::callback_msg::MsgToExtSupport,
|
||||
) -> *const c_void {
|
||||
) -> PluginReturn {
|
||||
match &msg.r#type as _ {
|
||||
EXT_SUPPORT_BLOCK_INPUT => {
|
||||
// let supported_plugins = [];
|
||||
@@ -19,25 +18,25 @@ pub(super) fn ext_support_callback(
|
||||
let supported = true;
|
||||
if supported {
|
||||
if msg.data.len() != 1 {
|
||||
return make_return_code_msg(
|
||||
return PluginReturn::new(
|
||||
errno::ERR_CALLBACK_INVALID_ARGS,
|
||||
"Invalid data length",
|
||||
);
|
||||
}
|
||||
let block = msg.data[0] != 0;
|
||||
if crate::server::plugin_block_input(peer, block) == block {
|
||||
null()
|
||||
PluginReturn::success()
|
||||
} else {
|
||||
make_return_code_msg(errno::ERR_CALLBACK_FAILED, "")
|
||||
PluginReturn::new(errno::ERR_CALLBACK_FAILED, "")
|
||||
}
|
||||
} else {
|
||||
make_return_code_msg(
|
||||
PluginReturn::new(
|
||||
errno::ERR_CALLBACK_PLUGIN_ID,
|
||||
&format!("This operation is not supported for plugin '{}', please contact the RustDesk team for support.", id),
|
||||
)
|
||||
}
|
||||
}
|
||||
_ => make_return_code_msg(
|
||||
_ => PluginReturn::new(
|
||||
errno::ERR_CALLBACK_TARGET_TYPE,
|
||||
&format!("Unknown target type '{}'", &msg.r#type),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user