mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-26 15:48:09 +00:00
Add getRLSUri JNI
This commit is contained in:
parent
4f912e5a71
commit
fb21732c38
3 changed files with 47 additions and 31 deletions
|
|
@ -3868,6 +3868,13 @@ extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_setRLSUri(JNIEnv*
|
|||
if (jrlsUri) ReleaseStringUTFChars(env, jrlsUri, uri);
|
||||
}
|
||||
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneFriendListImpl_getRLSUri(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
const char *uri = linphone_friend_list_get_rls_uri((LinphoneFriendList*)ptr);
|
||||
return uri ? env->NewStringUTF(uri) : NULL;
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_setRLSAddress(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.linphone.core.LinphoneAddress;
|
|||
public interface LinphoneFriendList {
|
||||
public void setRLSAddress(LinphoneAddress addr);
|
||||
public void setRLSUri(String uri);
|
||||
public String getRLSUri();
|
||||
public void addFriend(LinphoneFriend friend);
|
||||
public void addLocalFriend(LinphoneFriend friend);
|
||||
public LinphoneFriend[] getFriendList();
|
||||
|
|
@ -40,51 +41,51 @@ public interface LinphoneFriendList {
|
|||
* @return the number of friend imported
|
||||
**/
|
||||
public int importFriendsFromVCardFile(String file);
|
||||
|
||||
|
||||
/**
|
||||
* Imports LinphoneFriends from a vCard 4 buffer
|
||||
* @return the number of friend imported
|
||||
**/
|
||||
public int importFriendsFromVCardBuffer(String buffer);
|
||||
|
||||
|
||||
/**
|
||||
* Exports LinphoneFriends to a vCard 4 file
|
||||
**/
|
||||
public void exportFriendsToVCardFile(String file);
|
||||
|
||||
|
||||
long getNativePtr();
|
||||
|
||||
|
||||
/**
|
||||
* Set the callbacks associated with the LinphoneFriendList.
|
||||
*/
|
||||
void setListener(LinphoneFriendList.LinphoneFriendListListener listener);
|
||||
|
||||
|
||||
interface LinphoneFriendListListener {
|
||||
void onLinphoneFriendCreated(LinphoneFriendList list, LinphoneFriend lf);
|
||||
|
||||
|
||||
void onLinphoneFriendUpdated(LinphoneFriendList list, LinphoneFriend newFriend, LinphoneFriend oldFriend);
|
||||
|
||||
|
||||
void onLinphoneFriendDeleted(LinphoneFriendList list, LinphoneFriend lf);
|
||||
|
||||
|
||||
void onLinphoneFriendSyncStatusChanged(LinphoneFriendList list, LinphoneFriendList.State status, String message);
|
||||
}
|
||||
public static class State {
|
||||
static private Vector<State> values = new Vector<State>();
|
||||
public final int value() { return mValue; }
|
||||
|
||||
|
||||
private final int mValue;
|
||||
private final String mStringValue;
|
||||
|
||||
|
||||
public final static State SyncStarted = new State(0, "SyncStarted");
|
||||
public final static State SyncSuccessful = new State(1, "SyncSuccessful");
|
||||
public final static State SyncFailure = new State(2, "SyncFailure");
|
||||
|
||||
|
||||
private State(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
mStringValue = stringValue;
|
||||
}
|
||||
|
||||
|
||||
public static State fromInt(int value) {
|
||||
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
|
|
@ -93,11 +94,11 @@ public interface LinphoneFriendList {
|
|||
}
|
||||
throw new RuntimeException("state not found [" + value + "]");
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
return mStringValue;
|
||||
}
|
||||
|
||||
|
||||
public int toInt() {
|
||||
return mValue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,13 @@ package org.linphone.core;
|
|||
import java.io.Serializable;
|
||||
|
||||
class LinphoneFriendListImpl implements LinphoneFriendList, Serializable {
|
||||
|
||||
|
||||
protected final long nativePtr;
|
||||
private native void finalize(long nativePtr);
|
||||
private native long newLinphoneFriendList(long corePtr);
|
||||
private native void setRLSAddress(long nativePtr, long addrPtr);
|
||||
private native void setRLSUri(long nativePtr, String uri);
|
||||
private native String getRLSUri(long nativePtr);
|
||||
private native void addFriend(long nativePtr, long friendPtr);
|
||||
private native void addLocalFriend(long nativePtr, long friendPtr);
|
||||
private native LinphoneFriend[] getFriendList(long nativePtr);
|
||||
|
|
@ -53,49 +54,56 @@ class LinphoneFriendListImpl implements LinphoneFriendList, Serializable {
|
|||
setRLSUri(nativePtr, uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addFriend(LinphoneFriend friend) {
|
||||
public String getRLSUri() {
|
||||
synchronized(getSyncObject()){
|
||||
return getRLSUri(nativePtr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFriend(LinphoneFriend friend) {
|
||||
synchronized(getSyncObject()){
|
||||
addFriend(nativePtr, friend.getNativePtr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addLocalFriend(LinphoneFriend friend) {
|
||||
public void addLocalFriend(LinphoneFriend friend) {
|
||||
synchronized(getSyncObject()){
|
||||
addLocalFriend(nativePtr, friend.getNativePtr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LinphoneFriend[] getFriendList() {
|
||||
synchronized(getSyncObject()){
|
||||
return getFriendList(nativePtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateSubscriptions() {
|
||||
synchronized(getSyncObject()){
|
||||
updateSubscriptions(nativePtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void enableSubscriptions(boolean enable) {
|
||||
synchronized(getSyncObject()) {
|
||||
enableSubscriptions(nativePtr, enable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LinphoneFriend findFriendByUri(String uri) {
|
||||
synchronized(getSyncObject()){
|
||||
return findFriendByUri(nativePtr,uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private native void setUri(long nativePtr, String uri);
|
||||
@Override
|
||||
public void setUri(String uri) {
|
||||
|
|
@ -103,7 +111,7 @@ class LinphoneFriendListImpl implements LinphoneFriendList, Serializable {
|
|||
setUri(nativePtr, uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private native void synchronizeFriendsFromServer(long nativePtr);
|
||||
@Override
|
||||
public void synchronizeFriendsFromServer() {
|
||||
|
|
@ -111,30 +119,30 @@ class LinphoneFriendListImpl implements LinphoneFriendList, Serializable {
|
|||
synchronizeFriendsFromServer(nativePtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private native int importFriendsFromVCardFile(long nativePtr, String file);
|
||||
@Override
|
||||
public int importFriendsFromVCardFile(String file) {
|
||||
return importFriendsFromVCardFile(nativePtr, file);
|
||||
}
|
||||
|
||||
|
||||
private native int importFriendsFromVCardBuffer(long nativePtr, String buffer);
|
||||
@Override
|
||||
public int importFriendsFromVCardBuffer(String buffer) {
|
||||
return importFriendsFromVCardBuffer(nativePtr, buffer);
|
||||
}
|
||||
|
||||
|
||||
private native void exportFriendsToVCardFile(long nativePtr, String file);
|
||||
@Override
|
||||
public void exportFriendsToVCardFile(String file) {
|
||||
exportFriendsToVCardFile(nativePtr, file);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setListener(LinphoneFriendListListener listener) {
|
||||
setListener(nativePtr, listener);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*reserved for JNI */
|
||||
protected LinphoneFriendListImpl(long aNativePtr) {
|
||||
|
|
@ -154,6 +162,6 @@ class LinphoneFriendListImpl implements LinphoneFriendList, Serializable {
|
|||
}
|
||||
private Object getSyncObject(){
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue