Commit 04abb576 authored by Margaux Clerc's avatar Margaux Clerc
Browse files

Add key ref for friend

parent 9ec6bda1
......@@ -2892,6 +2892,21 @@ extern "C" jobject Java_org_linphone_core_LinphoneFriendImpl_getCore(JNIEnv* en
}
return NULL;
}
extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setRefKey(JNIEnv* env
,jobject thiz
,jlong ptr
,jstring jkey) {
const char* key = env->GetStringUTFChars(jkey, NULL);
linphone_friend_set_ref_key((LinphoneFriend*)ptr,key);
env->ReleaseStringUTFChars(jkey, key);
}
extern "C" jstring Java_org_linphone_core_LinphoneFriendImpl_getRefKey(JNIEnv* env
,jobject thiz
,jlong ptr) {
const char * key = linphone_friend_get_ref_key((LinphoneFriend *)ptr);
return key ? env->NewStringUTF(key) : NULL;
}
/*
* Class: org_linphone_core_LinphoneFriendImpl
......
......@@ -133,4 +133,16 @@ public interface LinphoneFriend {
* Return the native pointer for this object
*/
long getNativePtr();
/**
* Set the reference key of a friend.
* @param key The reference key to use for the friend.
**/
void setRefKey(String key);
/**
* Get the reference key of a friend.
* @return The reference key of the friend.
**/
String getRefKey();
}
......@@ -36,6 +36,8 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable {
private native void done(long nativePtr);
private native void delete(long ptr);
private native Object getCore(long ptr);
private native void setRefKey(long nativePtr, String key);
private native String getRefKey(long nativePtr);
boolean ownPtr = false;
protected LinphoneFriendImpl() {
......@@ -103,4 +105,14 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable {
if (core!=null) return core;
else return this;
}
public void setRefKey(String key){
synchronized(getSyncObject()){
setRefKey(nativePtr,key);
}
}
public String getRefKey(){
return getRefKey(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