mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-21 04:58:14 +00:00
Added JNI API to search a LinphoneAuthInfo from username and realm
This commit is contained in:
parent
08c59397cb
commit
712dd480ca
3 changed files with 25 additions and 1 deletions
|
|
@ -850,6 +850,18 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getAuthInfosList(J
|
|||
return jAuthInfos;
|
||||
}
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findAuthInfos(JNIEnv* env, jobject thiz, jlong lc, jstring jusername, jstring jrealm) {
|
||||
const char* username = env->GetStringUTFChars(jusername, NULL);
|
||||
const char* realm = jrealm ? env->GetStringUTFChars(jrealm, NULL) : NULL;
|
||||
const LinphoneAuthInfo *authInfo = linphone_core_find_auth_info((LinphoneCore*)lc, realm, username);
|
||||
|
||||
if (realm)
|
||||
env->ReleaseStringUTFChars(jrealm, realm);
|
||||
env->ReleaseStringUTFChars(jusername, username);
|
||||
|
||||
return (jlong) authInfo;
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearAuthInfos(JNIEnv* env, jobject thiz,jlong lc) {
|
||||
linphone_core_clear_all_auth_info((LinphoneCore*)lc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -396,6 +396,10 @@ public interface LinphoneCore {
|
|||
*/
|
||||
LinphoneAuthInfo[] getAuthInfosList();
|
||||
|
||||
/**
|
||||
* Returns a matching auth info or null if no match found
|
||||
*/
|
||||
LinphoneAuthInfo findAuthInfo(String username, String realm);
|
||||
/**
|
||||
* Removes a auth info.
|
||||
* @param authInfo
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native long[] listVideoPayloadTypes(long nativePtr);
|
||||
private native long[] getProxyConfigList(long nativePtr);
|
||||
private native long[] getAuthInfosList(long nativePtr);
|
||||
private native long findAuthInfos(long nativePtr, String username, String realm);
|
||||
private native long[] listAudioPayloadTypes(long nativePtr);
|
||||
private native void enableKeepAlive(long nativePtr,boolean enable);
|
||||
private native boolean isKeepAliveEnabled(long nativePtr);
|
||||
|
|
@ -1046,7 +1047,6 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
|
||||
return proxies;
|
||||
}
|
||||
@Override
|
||||
public LinphoneAuthInfo[] getAuthInfosList() {
|
||||
long[] typesPtr = getAuthInfosList(nativePtr);
|
||||
if (typesPtr == null) return null;
|
||||
|
|
@ -1059,4 +1059,12 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
|
||||
return authInfos;
|
||||
}
|
||||
|
||||
public LinphoneAuthInfo findAuthInfo(String username, String realm) {
|
||||
long ptr = findAuthInfos(nativePtr, username, realm);
|
||||
if (ptr == 0)
|
||||
return null;
|
||||
|
||||
return new LinphoneAuthInfoImpl(ptr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue