Commit eeb4b52d authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

JNI glue for linphone_core_set_primary_contact

parent 6b32d7d6
......@@ -542,6 +542,22 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env
delete lcData;
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact(JNIEnv* env, jobject thiz, jlong lc, jstring jdisplayname, jstring jusername) {
const char* displayname = env->GetStringUTFChars(jdisplayname, NULL);
const char* username = env->GetStringUTFChars(jusername, NULL);
LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed((LinphoneCore*)lc);
if (parsed != NULL) {
linphone_address_set_display_name(parsed, displayname);
linphone_address_set_username(parsed, username);
char *contact = linphone_address_as_string(parsed);
linphone_core_set_primary_contact((LinphoneCore*)lc, contact);
}
env->ReleaseStringUTFChars(jdisplayname, displayname);
env->ReleaseStringUTFChars(jusername, username);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearProxyConfigs(JNIEnv* env, jobject thiz,jlong lc) {
linphone_core_clear_proxy_config((LinphoneCore*)lc);
}
......
......@@ -851,4 +851,9 @@ public interface LinphoneCore {
void setInCallTimeout(int timeout);
void setMicrophoneGain(float gain);
/**
* Set username and display name to use if no LinphoneProxyConfig configured
*/
void setPrimaryContact(String displayName, String username);
}
......@@ -116,6 +116,7 @@ class LinphoneCoreImpl implements LinphoneCore {
private native void setVideoPortRange(long nativePtr, int minPort, int maxPort);
private native void setIncomingTimeout(long nativePtr, int timeout);
private native void setInCallTimeout(long nativePtr, int timeout);
private native void setPrimaryContact(long nativePtr, String displayName, String username);
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
mListener=listener;
......@@ -793,4 +794,8 @@ class LinphoneCoreImpl implements LinphoneCore {
public void setMicrophoneGain(float gain) {
setMicrophoneGain(nativePtr, gain);
}
public void setPrimaryContact(String displayName, String username) {
setPrimaryContact(nativePtr, displayName, username);
}
}
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