mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-21 04:58:14 +00:00
Added new method to import a LinphoneFriend into a LinphoneFriendList without flagging it as dirty
This commit is contained in:
parent
9c7eb70ef8
commit
7d03d2e00e
5 changed files with 46 additions and 12 deletions
|
|
@ -375,7 +375,7 @@ void linphone_friend_list_set_rls_uri(LinphoneFriendList *list, const char *rls_
|
|||
}
|
||||
}
|
||||
|
||||
LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *lf) {
|
||||
static LinphoneFriendListStatus _linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t synchronize) {
|
||||
if (!list || !lf->uri || lf->friend_list) {
|
||||
if (!list)
|
||||
ms_error("linphone_friend_list_add_friend(): invalid list, null");
|
||||
|
|
@ -392,11 +392,19 @@ LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *lis
|
|||
ms_warning("Friend %s already in list [%s], ignored.", tmp ? tmp : "unknown", list->display_name);
|
||||
if (tmp) ms_free(tmp);
|
||||
} else {
|
||||
return linphone_friend_list_import_friend(list, lf, TRUE);
|
||||
return linphone_friend_list_import_friend(list, lf, synchronize);
|
||||
}
|
||||
return LinphoneFriendListOK;
|
||||
}
|
||||
|
||||
LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *lf) {
|
||||
return _linphone_friend_list_add_friend(list, lf, TRUE);
|
||||
}
|
||||
|
||||
LinphoneFriendListStatus linphone_friend_list_add_local_friend(LinphoneFriendList *list, LinphoneFriend *lf) {
|
||||
return _linphone_friend_list_add_friend(list, lf, FALSE);
|
||||
}
|
||||
|
||||
LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t synchronize) {
|
||||
if (!lf->uri || lf->friend_list) {
|
||||
if (!lf->uri)
|
||||
|
|
|
|||
|
|
@ -145,12 +145,21 @@ LINPHONE_PUBLIC const char * linphone_friend_list_get_rls_uri(const LinphoneFrie
|
|||
LINPHONE_PUBLIC void linphone_friend_list_set_rls_uri(LinphoneFriendList *list, const char *rls_uri);
|
||||
|
||||
/**
|
||||
* Add a friend to a friend list.
|
||||
* Add a friend to a friend list. If or when a remote CardDAV server will be attached to the list, the friend will be sent to the server.
|
||||
* @param[in] list LinphoneFriendList object.
|
||||
* @param[in] friend LinphoneFriend object to add to the friend list.
|
||||
* @return LinphoneFriendListOK if successfully added, LinphoneFriendListInvalidFriend if the friend is not valid.
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *afriend);
|
||||
LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *lf);
|
||||
|
||||
/**
|
||||
* Add a friend to a friend list. The friend will never be sent to a remote CardDAV server.
|
||||
* Warning! LinphoneFriends added this way will be removed on the next synchronization, and the callback contact_deleted will be called.
|
||||
* @param[in] list LinphoneFriendList object.
|
||||
* @param[in] friend LinphoneFriend object to add to the friend list.
|
||||
* @return LinphoneFriendListOK if successfully added, LinphoneFriendListInvalidFriend if the friend is not valid.
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_add_local_friend(LinphoneFriendList *list, LinphoneFriend *lf);
|
||||
|
||||
/**
|
||||
* Remove a friend from a friend list.
|
||||
|
|
|
|||
|
|
@ -2017,6 +2017,7 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getCurrentCall(JNIEnv
|
|||
) {
|
||||
return getCall(env,linphone_core_get_current_call((LinphoneCore*)lc));
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addFriend(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc
|
||||
|
|
@ -3309,7 +3310,7 @@ extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_setRLSUri(JNIEnv*
|
|||
,jlong ptr
|
||||
,jstring jrlsUri) {
|
||||
const char* uri = env->GetStringUTFChars(jrlsUri, NULL);
|
||||
linphone_friend_list_set_rls_uri((LinphoneFriendList*)ptr,uri);
|
||||
linphone_friend_list_set_rls_uri((LinphoneFriendList*)ptr, uri);
|
||||
env->ReleaseStringUTFChars(jrlsUri, uri);
|
||||
}
|
||||
|
||||
|
|
@ -3319,7 +3320,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneFriendListImpl_findFriendByUri(J
|
|||
,jstring juri) {
|
||||
const char* uri = env->GetStringUTFChars(juri, NULL);
|
||||
LinphoneFriend* lResult;
|
||||
lResult = linphone_friend_list_find_friend_by_uri((LinphoneFriendList*)friendListptr,uri);
|
||||
lResult = linphone_friend_list_find_friend_by_uri((LinphoneFriendList*)friendListptr, uri);
|
||||
env->ReleaseStringUTFChars(juri, uri);
|
||||
return (jlong)lResult;
|
||||
}
|
||||
|
|
@ -3328,7 +3329,14 @@ extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_addFriend(JNIEnv*
|
|||
,jobject thiz
|
||||
,jlong friendListptr
|
||||
,jlong friendPtr) {
|
||||
linphone_friend_list_add_friend((LinphoneFriendList*)friendListptr,(LinphoneFriend*)friendPtr);
|
||||
linphone_friend_list_add_friend((LinphoneFriendList*)friendListptr, (LinphoneFriend*)friendPtr);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_addLocalFriend(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong friendListptr
|
||||
,jlong friendPtr) {
|
||||
linphone_friend_list_add_local_friend((LinphoneFriendList*)friendListptr, (LinphoneFriend*)friendPtr);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_updateSubscriptions(JNIEnv* env
|
||||
|
|
@ -3336,7 +3344,7 @@ extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_updateSubscription
|
|||
,jlong friendListptr
|
||||
,jlong proxyConfigPtr
|
||||
,jboolean jonlyWhenRegistered) {
|
||||
linphone_friend_list_update_subscriptions((LinphoneFriendList*)friendListptr,(LinphoneProxyConfig*)proxyConfigPtr,jonlyWhenRegistered);
|
||||
linphone_friend_list_update_subscriptions((LinphoneFriendList*)friendListptr, (LinphoneProxyConfig*)proxyConfigPtr, jonlyWhenRegistered);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package org.linphone.core;
|
|||
public interface LinphoneFriendList {
|
||||
public void setRLSUri(String uri);
|
||||
public void addFriend(LinphoneFriend friend);
|
||||
public void addLocalFriend(LinphoneFriend friend);
|
||||
public void updateSubscriptions(LinphoneProxyConfig proxyConfig,boolean onlyWhenRegistered);
|
||||
public LinphoneFriend findFriendByUri(String uri);
|
||||
public void setUri(String uri);
|
||||
|
|
|
|||
|
|
@ -25,11 +25,12 @@ class LinphoneFriendListImpl implements LinphoneFriendList, Serializable {
|
|||
protected final long nativePtr;
|
||||
private native void finalize(long nativePtr);
|
||||
private native long newLinphoneFriendList(long corePtr);
|
||||
private native void setRLSUri(long nativePtr,String uri);
|
||||
private native void addFriend(long nativePtr,long friendPtr);
|
||||
private native void updateSubscriptions(long nativePtr,long proxyConfigPtr,boolean onlyWhenRegistered);
|
||||
private native void setRLSUri(long nativePtr, String uri);
|
||||
private native void addFriend(long nativePtr, long friendPtr);
|
||||
private native void addLocalFriend(long nativePtr, long friendPtr);
|
||||
private native void updateSubscriptions(long nativePtr, long proxyConfigPtr, boolean onlyWhenRegistered);
|
||||
private native Object getCore(long ptr);
|
||||
private native LinphoneFriend findFriendByUri(long nativePtr,String uri);
|
||||
private native LinphoneFriend findFriendByUri(long nativePtr, String uri);
|
||||
private native void setListener(long ptr, LinphoneFriendListListener listener);
|
||||
|
||||
protected LinphoneFriendListImpl(LinphoneCoreImpl core) {
|
||||
|
|
@ -50,6 +51,13 @@ class LinphoneFriendListImpl implements LinphoneFriendList, Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLocalFriend(LinphoneFriend friend) {
|
||||
synchronized(getSyncObject()){
|
||||
addLocalFriend(nativePtr, friend.getNativePtr());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSubscriptions(LinphoneProxyConfig proxyConfig,boolean onlyWhenRegistered) {
|
||||
synchronized(getSyncObject()){
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue