Commit 1cc0a418 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Few changes in JNI interface for linphone friends + fix issue in linphone_friend_destroy

parent 1a4712e8
...@@ -396,8 +396,8 @@ void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) ...@@ -396,8 +396,8 @@ void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf)
void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend* fl){ void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend* fl){
MSList *el=ms_list_find(lc->friends,(void *)fl); MSList *el=ms_list_find(lc->friends,(void *)fl);
if (el!=NULL){ if (el!=NULL){
lc->friends=ms_list_remove_link(lc->friends,el);
linphone_friend_destroy((LinphoneFriend*)el->data); linphone_friend_destroy((LinphoneFriend*)el->data);
lc->friends=ms_list_remove_link(lc->friends,el);
linphone_core_write_friends_config(lc); linphone_core_write_friends_config(lc);
} }
} }
......
...@@ -1592,6 +1592,21 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_done(JNIEnv* env ...@@ -1592,6 +1592,21 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_done(JNIEnv* env
,jlong ptr) { ,jlong ptr) {
linphone_friend_done((LinphoneFriend*)ptr); linphone_friend_done((LinphoneFriend*)ptr);
} }
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeFriend(JNIEnv* env
,jobject thiz
,jlong ptr
,jlong lf) {
linphone_core_remove_friend((LinphoneCore*)ptr, (LinphoneFriend*)lf);
}
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getFriendByAddress(JNIEnv* env
,jobject thiz
,jlong ptr
,jstring jaddress) {
const char* address = env->GetStringUTFChars(jaddress, NULL);
LinphoneFriend *lf = linphone_core_get_friend_by_address((LinphoneCore*)ptr, address);
env->ReleaseStringUTFChars(jaddress, address);
return (jlong) lf;
}
//LinphoneChatRoom //LinphoneChatRoom
extern "C" long Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv* env extern "C" long Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv* env
,jobject thiz ,jobject thiz
......
...@@ -20,9 +20,6 @@ package org.linphone.core; ...@@ -20,9 +20,6 @@ package org.linphone.core;
import java.util.Vector; import java.util.Vector;
import org.linphone.core.LinphoneCallLog;
import org.linphone.core.LinphoneCallParams;
/** /**
* Linphone core main object created by method {@link LinphoneCoreFactory#createLinphoneCore(LinphoneCoreListener, String, String, Object)}. * Linphone core main object created by method {@link LinphoneCoreFactory#createLinphoneCore(LinphoneCoreListener, String, String, Object)}.
* *
...@@ -802,4 +799,14 @@ public interface LinphoneCore { ...@@ -802,4 +799,14 @@ public interface LinphoneCore {
* return the version code of linphone core * return the version code of linphone core
*/ */
public String getVersion(); public String getVersion();
/**
* remove a linphone friend from linphone core and linphonerc
*/
void removeFriend(LinphoneFriend lf);
/**
* return a linphone friend (if exists) that matches the sip address
*/
LinphoneFriend findFriendByAddress(String sipUri);
} }
...@@ -123,5 +123,8 @@ public interface LinphoneFriend { ...@@ -123,5 +123,8 @@ public interface LinphoneFriend {
*/ */
String toString(); String toString();
/**
* Return the native pointer for this object
*/
long getNativePtr();
} }
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