feat: start integrating conversation wrapper functions

This commit is contained in:
0x330a 2023-01-30 16:15:03 +11:00
parent ed6930ba10
commit 3e348dc7e2
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C
4 changed files with 55 additions and 5 deletions

View File

@ -26,6 +26,7 @@ set(SOURCES
user_profile.cpp
config_base.cpp
contacts.cpp
conversation.cpp
util.cpp)
add_library( # Sets the name of the library.

View File

@ -0,0 +1,19 @@
#include <jni.h>
#include "conversation.h"
#pragma clang diagnostic push
extern "C"
#pragma ide diagnostic ignored "bugprone-reserved-identifier"
JNIEXPORT jobject JNICALL
Java_network_loki_messenger_libsession_1util_ConversationVolatileConfig_00024Companion_newInstance___3B(
JNIEnv *env, jobject thiz, jbyteArray ed25519_secret_key) {
}
extern "C"
#pragma ide diagnostic ignored "bugprone-reserved-identifier"
JNIEXPORT jobject JNICALL
Java_network_loki_messenger_libsession_1util_ConversationVolatileConfig_00024Companion_newInstance___3B_3B(
JNIEnv *env, jobject thiz, jbyteArray ed25519_secret_key, jbyteArray initial_dump) {
}
#pragma clang diagnostic pop

View File

@ -0,0 +1,32 @@
#ifndef SESSION_ANDROID_CONVERSATION_H
#define SESSION_ANDROID_CONVERSATION_H
#include <jni.h>
#include "util.h"
#include "session/config/convo_info_volatile.hpp"
inline session::config::ConvoInfoVolatile *ptrToContacts(JNIEnv *env, jobject obj) {
jclass contactsClass = env->FindClass("network/loki/messenger/libsession_util/ConversationVolatileConfig");
jfieldID pointerField = env->GetFieldID(contactsClass, "pointer", "J");
return (session::config::ConvoInfoVolatile *) env->GetLongField(obj, pointerField);
}
inline jobject serialize_one_on_one(JNIEnv *env, session::config::convo::one_to_one one_to_one) {
// TODO serialize function
}
inline jobject serialize_open_group(JNIEnv *env, session::config::convo::open_group open_group) {
// TODO
}
inline jobject serialize_legacy_group(JNIEnv *env, session::config::convo::legacy_closed_group legacy_group) {
}
inline jobject serialize_any(JNIEnv *env, session::config::convo::any)
inline session::config::ConvoInfoVolatile* deserialize_convo_info(JNIEnv *env, jobject info) {
// TODO deserialize function
}
#endif //SESSION_ANDROID_CONVERSATION_H

View File

@ -67,18 +67,16 @@ class UserProfile(pointer: Long) : ConfigBase(pointer) {
external fun setPic(userPic: UserPic)
}
class ConversationConfig(pointer: Long): ConfigBase(pointer) {
class ConversationVolatileConfig(pointer: Long): ConfigBase(pointer) {
companion object {
init {
System.loadLibrary("session_util")
}
external fun newInstance(ed25519SecretKey: ByteArray): ConversationConfig
external fun newInstance(ed25519SecretKey: ByteArray): ConversationVolatileConfig
external fun newInstance(ed25519SecretKey: ByteArray, initialDump: ByteArray): ConversationConfig
external fun newInstance(ed25519SecretKey: ByteArray, initialDump: ByteArray): ConversationVolatileConfig
}
external fun todo()
}