]> sjero.net Git - linphone/commitdiff
Few changes in JNI interface for linphone friends + fix issue in linphone_friend_destroy
authorSylvain Berfini <Sylvain.Berfini@Belledonne-Communications.com>
Fri, 5 Oct 2012 15:32:38 +0000 (17:32 +0200)
committerSylvain Berfini <Sylvain.Berfini@Belledonne-Communications.com>
Fri, 5 Oct 2012 15:32:38 +0000 (17:32 +0200)
coreapi/friend.c
coreapi/linphonecore_jni.cc
java/common/org/linphone/core/LinphoneCore.java
java/common/org/linphone/core/LinphoneFriend.java

index 05a1baeec3a7ed26013cc44a758b614042dc138f..c6dee2440a8d28019c003893123cc2dfde218b0a 100644 (file)
@@ -396,8 +396,8 @@ void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf)
 void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend* fl){
        MSList *el=ms_list_find(lc->friends,(void *)fl);
        if (el!=NULL){
-               lc->friends=ms_list_remove_link(lc->friends,el);
                linphone_friend_destroy((LinphoneFriend*)el->data);
+               lc->friends=ms_list_remove_link(lc->friends,el);
                linphone_core_write_friends_config(lc);
        }
 }
index b8d48de53203cc3d293eec1eee78e1f5fd5eee4d..566269a760c007b9f67a269793082a013d10b11f 100644 (file)
@@ -1592,6 +1592,21 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_done(JNIEnv*  env
                                                                                                                                                ,jlong 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
 extern "C" long Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv*  env
                                                                                                                                                ,jobject  thiz
index 6ac821322d8593bc23e1d21602a4498445448a7d..732940fdd4c04fce583fb3ac95d3508f91506815 100644 (file)
@@ -20,9 +20,6 @@ package org.linphone.core;
 
 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)}.   
  *
@@ -802,4 +799,14 @@ public interface LinphoneCore {
         * return the version code of linphone core
         */
        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);
 }
index d4f0e7503ed6814459fb63ec244d532af5dfd5bc..e070f69214154bb6297ce2e65f29b463e0d4cdb8 100644 (file)
@@ -123,5 +123,8 @@ public interface LinphoneFriend {
         */
        String toString();
        
-
+       /**
+        * Return the native pointer for this object
+        */
+       long getNativePtr();
 }