Commit 505e22c9 authored by Sylvain Berfini's avatar Sylvain Berfini

Added JNI bindings for set/get AppData methods for LinphoneChatMessage class

parent bd27eb0d
......@@ -2707,6 +2707,18 @@ extern "C" jobject Java_org_linphone_core_LinphoneChatMessageImpl_getFileTransfe
return NULL;
}
extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getAppData(JNIEnv* env, jobject thiz, jlong ptr) {
const char * app_data = linphone_chat_message_get_appdata((LinphoneChatMessage *)ptr);
return app_data ? env->NewStringUTF(app_data) : NULL;
}
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setAppData(JNIEnv* env, jobject thiz, jlong ptr, jstring appdata) {
const char * data = appdata ? env->GetStringUTFChars(appdata, NULL) : NULL;
linphone_chat_message_set_appdata((LinphoneChatMessage *)ptr, data);
if (appdata)
env->ReleaseStringUTFChars(appdata, data);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFileTransferServer(JNIEnv* env, jobject thiz, jlong ptr, jstring server_url) {
const char * url = server_url ? env->GetStringUTFChars(server_url, NULL) : NULL;
linphone_core_set_file_transfer_server((LinphoneCore *)ptr, url);
......
......@@ -168,4 +168,15 @@ public interface LinphoneChatMessage {
* @return a pointer to the LinphoneContent structure or NULL if not present.
*/
LinphoneContent getFileTransferInformation();
/**
* Sets data in the chat message
* @param data to store in the message
*/
void setAppData(String data);
/**
* @return the data stored in the chat message if any, else null
*/
String getAppData();
}
......@@ -115,4 +115,16 @@ public class LinphoneChatMessageImpl implements LinphoneChatMessage {
public LinphoneContent getFileTransferInformation() {
return (LinphoneContent) getFileTransferInformation(nativePtr);
}
private native void setAppData(long ptr, String data);
@Override
public void setAppData(String data) {
setAppData(nativePtr, data);
}
private native String getAppData(long ptr);
@Override
public String getAppData() {
return getAppData(nativePtr);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment