mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 13:26:28 +03:00
add jsonrpc feature flag
This commit is contained in:
@@ -21,7 +21,7 @@ add_custom_command(
|
|||||||
PREFIX=${CMAKE_INSTALL_PREFIX}
|
PREFIX=${CMAKE_INSTALL_PREFIX}
|
||||||
LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR}
|
LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR}
|
||||||
INCLUDEDIR=${CMAKE_INSTALL_FULL_INCLUDEDIR}
|
INCLUDEDIR=${CMAKE_INSTALL_FULL_INCLUDEDIR}
|
||||||
${CARGO} build --release --no-default-features
|
${CARGO} build --release --no-default-features --features jsonrpc
|
||||||
|
|
||||||
# Build in `deltachat-ffi` directory instead of using
|
# Build in `deltachat-ffi` directory instead of using
|
||||||
# `--package deltachat_ffi` to avoid feature resolver version
|
# `--package deltachat_ffi` to avoid feature resolver version
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ crate-type = ["cdylib", "staticlib"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
deltachat = { path = "../", default-features = false }
|
deltachat = { path = "../", default-features = false }
|
||||||
deltachat-jsonrpc = { path = "../deltachat-jsonrpc" }
|
deltachat-jsonrpc = { path = "../deltachat-jsonrpc", optional = true }
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
human-panic = "1"
|
human-panic = "1"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
@@ -27,7 +27,8 @@ thiserror = "1"
|
|||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["vendored"]
|
default = ["vendored", "jsonrpc"]
|
||||||
vendored = ["deltachat/vendored"]
|
vendored = ["deltachat/vendored"]
|
||||||
nightly = ["deltachat/nightly"]
|
nightly = ["deltachat/nightly"]
|
||||||
|
jsonrpc = ["deltachat-jsonrpc"]
|
||||||
|
|
||||||
|
|||||||
@@ -4426,14 +4426,18 @@ pub unsafe extern "C" fn dc_accounts_get_next_event(
|
|||||||
.unwrap_or_else(ptr::null_mut)
|
.unwrap_or_else(ptr::null_mut)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "jsonrpc")]
|
||||||
use deltachat_jsonrpc::api::CommandApi;
|
use deltachat_jsonrpc::api::CommandApi;
|
||||||
|
#[cfg(feature = "jsonrpc")]
|
||||||
use deltachat_jsonrpc::yerpc::{MessageHandle, RpcHandle};
|
use deltachat_jsonrpc::yerpc::{MessageHandle, RpcHandle};
|
||||||
|
|
||||||
|
#[cfg(feature = "jsonrpc")]
|
||||||
pub struct dc_json_api_instance_t {
|
pub struct dc_json_api_instance_t {
|
||||||
receiver: async_std::channel::Receiver<deltachat_jsonrpc::yerpc::Message>,
|
receiver: async_std::channel::Receiver<deltachat_jsonrpc::yerpc::Message>,
|
||||||
handle: MessageHandle<CommandApi>,
|
handle: MessageHandle<CommandApi>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "jsonrpc")]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn dc_get_json_api(
|
pub unsafe extern "C" fn dc_get_json_api(
|
||||||
account_manager: *mut dc_accounts_t,
|
account_manager: *mut dc_accounts_t,
|
||||||
@@ -4454,6 +4458,7 @@ pub unsafe extern "C" fn dc_get_json_api(
|
|||||||
Box::into_raw(Box::new(instance))
|
Box::into_raw(Box::new(instance))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "jsonrpc")]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn dc_json_api_unref(json_api_instance: *mut dc_json_api_instance_t) {
|
pub unsafe extern "C" fn dc_json_api_unref(json_api_instance: *mut dc_json_api_instance_t) {
|
||||||
if json_api_instance.is_null() {
|
if json_api_instance.is_null() {
|
||||||
@@ -4464,6 +4469,7 @@ pub unsafe extern "C" fn dc_json_api_unref(json_api_instance: *mut dc_json_api_i
|
|||||||
Box::from_raw(json_api_instance);
|
Box::from_raw(json_api_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "jsonrpc")]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn dc_json_request(
|
pub unsafe extern "C" fn dc_json_request(
|
||||||
json_api_instance: *mut dc_json_api_instance_t,
|
json_api_instance: *mut dc_json_api_instance_t,
|
||||||
@@ -4482,6 +4488,7 @@ pub unsafe extern "C" fn dc_json_request(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "jsonrpc")]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn dc_get_next_json_response(
|
pub unsafe extern "C" fn dc_get_next_json_response(
|
||||||
json_api_instance: *mut dc_json_api_instance_t,
|
json_api_instance: *mut dc_json_api_instance_t,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const buildArgs = [
|
|||||||
'build',
|
'build',
|
||||||
'--release',
|
'--release',
|
||||||
'--features',
|
'--features',
|
||||||
'vendored',
|
'vendored,jsonrpc',
|
||||||
'-p',
|
'-p',
|
||||||
'deltachat_ffi'
|
'deltachat_ffi'
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user