diff --git a/src/codegen/pEp.yml2 b/src/codegen/pEp.yml2 index 7ec2584..c65f8d3 100644 --- a/src/codegen/pEp.yml2 +++ b/src/codegen/pEp.yml2 @@ -70,6 +70,7 @@ namespace pEp { enumitem sync_notify_accepted_device_added > 6 enumitem sync_notify_accepted_group_created > 7 enumitem sync_notify_accepted_device_accepted > 8 + enumitem sync_notify_outgoing_rating_change > 64 enumitem sync_passphrase_required > 128 enumitem sync_notify_sole > 254 enumitem sync_notify_in_group > 255 @@ -193,7 +194,7 @@ namespace pEp { in string fpr2, in string lang, returns sstring words, - in bool full + in bool full ); method cached=true get_message_trustwords( @@ -252,6 +253,8 @@ namespace pEp { in identitylist identities const ); + method cached=true sync_reinit(); + // "basic" methods are generated on the java side, but // on the C++ side, manually implemented in basic_api.cc @@ -275,6 +278,8 @@ namespace pEp { basic void config_passphrase(string passphrase); basic void config_passphrase_for_new_keys(bool enable, string passphrase); basic bytearray export_key(string fpr); + basic void config_enable_echo_protocol(bool enable); + basic void config_enable_echo_in_outgoing_message_rating_preview(bool enable); }; struct message { diff --git a/src/cxx/basic_api.cc b/src/cxx/basic_api.cc index 4f9960c..9cdee34 100644 --- a/src/cxx/basic_api.cc +++ b/src/cxx/basic_api.cc @@ -539,5 +539,33 @@ JNIEXPORT jbyteArray JNICALL Java_foundation_pEp_jniadapter_Engine__1export_1key return from_string(env, buff); } +JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine__1config_1enable_1echo_1protocol(JNIEnv *env, + jobject obj, + jboolean enable) +{ + std::mutex *mutex_local = nullptr; + { + std::lock_guard l(global_mutex); + pEpLog("called with lock_guard"); + mutex_local = get_engine_java_object_mutex(env, obj); + } + std::lock_guard l(*mutex_local); + ::config_enable_echo_protocol(session(),static_cast(enable)); +} + +JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine__1config_1enable_1echo_1in_1outgoing_1message_1rating_1preview(JNIEnv *env, + jobject obj, + jboolean enable) +{ + std::mutex *mutex_local = nullptr; + { + std::lock_guard l(global_mutex); + pEpLog("called with lock_guard"); + mutex_local = get_engine_java_object_mutex(env, obj); + } + std::lock_guard l(*mutex_local); + ::config_enable_echo_in_outgoing_message_rating_preview(session(),static_cast(enable)); +} + } // extern "C" diff --git a/src/cxx/foundation_pEp_jniadapter_AbstractEngine.cc b/src/cxx/foundation_pEp_jniadapter_AbstractEngine.cc index 80bcdf0..171b017 100644 --- a/src/cxx/foundation_pEp_jniadapter_AbstractEngine.cc +++ b/src/cxx/foundation_pEp_jniadapter_AbstractEngine.cc @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -358,6 +359,26 @@ JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_AbstractEngine__1stopSync( CallbackDispatcher::stop_sync(); } +JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_AbstractEngine__1config_1media_1keys(JNIEnv *env, + jobject obj, + jobject value) +{ + std::mutex *mutex_local = nullptr; + { + std::lock_guard l(global_mutex); + pEpLog("called with lock_guard"); + mutex_local = get_engine_java_object_mutex(env, obj); + } + std::lock_guard l(*mutex_local); + + PEP_STATUS status = ::config_media_keys(Adapter::session(),to_stringpairlist(env, value)); + if (status) { + throw_pEp_Exception(env, status); + } + +} + + JNIEXPORT jboolean JNICALL Java_foundation_pEp_jniadapter_AbstractEngine__1isSyncRunning(JNIEnv *env, jobject obj) { diff --git a/src/java/foundation/pEp/jniadapter/AbstractEngine.java b/src/java/foundation/pEp/jniadapter/AbstractEngine.java index 7d160d8..502236c 100644 --- a/src/java/foundation/pEp/jniadapter/AbstractEngine.java +++ b/src/java/foundation/pEp/jniadapter/AbstractEngine.java @@ -77,6 +77,19 @@ abstract class AbstractEngine extends UniquelyIdentifiable implements AbstractEn private native void _stopSync(); + public void config_media_keys(ArrayList> value) { + if (value != null) { + ArrayList> list = new ArrayList>(); + for (Pair i : value) { + list.add(new Pair(Utils.toUTF8(i.first), Utils.toUTF8(i.second))); + } + _config_media_keys(list); + } else { + _config_media_keys(null); + } + } + + private native void _config_media_keys(ArrayList> value); public boolean isSyncRunning() { return _isSyncRunning();