Revert "plugin_framework, change return type"

This reverts commit 9c6b303fa2.
This commit is contained in:
fufesou
2023-05-04 19:21:13 +08:00
parent 9c6b303fa2
commit 1243d8f434
4 changed files with 83 additions and 94 deletions

View File

@@ -3,6 +3,7 @@
// -----------------------------------------------------------------------------
use super::*;
use std::{ffi::c_void, ptr::null};
const EXT_SUPPORT_BLOCK_INPUT: &str = "block-input";
@@ -10,7 +11,7 @@ pub(super) fn ext_support_callback(
id: &str,
peer: &str,
msg: &super::callback_msg::MsgToExtSupport,
) -> PluginReturn {
) -> *const c_void {
match &msg.r#type as _ {
EXT_SUPPORT_BLOCK_INPUT => {
// let supported_plugins = [];
@@ -18,25 +19,25 @@ pub(super) fn ext_support_callback(
let supported = true;
if supported {
if msg.data.len() != 1 {
return PluginReturn::new(
return make_return_code_msg(
errno::ERR_CALLBACK_INVALID_ARGS,
"Invalid data length",
);
}
let block = msg.data[0] != 0;
if crate::server::plugin_block_input(peer, block) == block {
PluginReturn::success()
null()
} else {
PluginReturn::new(errno::ERR_CALLBACK_FAILED, "")
make_return_code_msg(errno::ERR_CALLBACK_FAILED, "")
}
} else {
PluginReturn::new(
make_return_code_msg(
errno::ERR_CALLBACK_PLUGIN_ID,
&format!("This operation is not supported for plugin '{}', please contact the RustDesk team for support.", id),
)
}
}
_ => PluginReturn::new(
_ => make_return_code_msg(
errno::ERR_CALLBACK_TARGET_TYPE,
&format!("Unknown target type '{}'", &msg.r#type),
),