Commit d5f765da authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added get/set domain and configure to AccountCreator JNI wrapper

parent fe9512bd
......@@ -8761,6 +8761,20 @@ extern "C" jstring Java_org_linphone_core_LinphoneAccountCreatorImpl_getEmail(JN
return email ? env->NewStringUTF(email) : NULL;
}
extern "C" jint Java_org_linphone_core_LinphoneAccountCreatorImpl_setDomain(JNIEnv *env, jobject thiz, jlong ptr, jstring jdomain) {
const char *domain = GetStringUTFChars(env, jdomain);
LinphoneAccountCreator *account_creator = (LinphoneAccountCreator *)ptr;
LinphoneAccountCreatorDomainStatus status = linphone_account_creator_set_domain(account_creator, domain);
ReleaseStringUTFChars(env, jdomain, domain);
return (jint) status;
}
extern "C" jstring Java_org_linphone_core_LinphoneAccountCreatorImpl_getDomain(JNIEnv *env, jobject thiz, jlong ptr) {
LinphoneAccountCreator *account_creator = (LinphoneAccountCreator *)ptr;
const char *email = linphone_account_creator_get_domain(account_creator);
return email ? env->NewStringUTF(email) : NULL;
}
extern "C" jint Java_org_linphone_core_LinphoneAccountCreatorImpl_isAccountUsed(JNIEnv *env, jobject thiz, jlong ptr) {
LinphoneAccountCreator *account_creator = (LinphoneAccountCreator *)ptr;
return (jint) linphone_account_creator_is_account_exist(account_creator);
......
......@@ -138,6 +138,38 @@ public interface LinphoneAccountCreator {
}
}
public static class DomainCheck {
static private Vector<DomainCheck> values = new Vector<DomainCheck>();
private final int mValue;
private final String mStringValue;
public final int value() { return mValue; }
public final static DomainCheck Ok = new DomainCheck(0, "Ok");
public final static DomainCheck Invalid = new DomainCheck(1, "Invalid");
private DomainCheck(int value, String stringValue) {
mValue = value;
values.addElement(this);
mStringValue = stringValue;
}
public static DomainCheck fromInt(int value) {
for (int i=0; i < values.size(); i++) {
DomainCheck state = (DomainCheck) values.elementAt(i);
if (state.mValue == value) return state;
}
throw new RuntimeException("DomainCheck not found [" + value + "]");
}
public String toString() {
return mStringValue;
}
public int toInt() {
return mValue;
}
}
public static class PasswordCheck {
static private Vector<PasswordCheck> values = new Vector<PasswordCheck>();
private final int mValue;
......@@ -323,6 +355,12 @@ public interface LinphoneAccountCreator {
String getPrefix(String phone);
DomainCheck setDomain(String domain);
String getDomain();
LinphoneProxyConfig configure();
RequestStatus isAccountUsed();
RequestStatus createAccount();
......
......@@ -134,6 +134,24 @@ public class LinphoneAccountCreatorImpl implements LinphoneAccountCreator {
return getPrefix(nativePtr, phone);
}
private native int setDomain(long ptr, String domain);
@Override
public DomainCheck setDomain(String domain) {
return DomainCheck.fromInt(setDomain(nativePtr, domain));
}
private native String getDomain(long ptr);
@Override
public String getDomain() {
return getDomain(nativePtr);
}
private native LinphoneProxyConfig configure(long ptr);
@Override
public LinphoneProxyConfig configure() {
return configure(nativePtr);
}
private native int isAccountUsed(long ptr);
@Override
public RequestStatus isAccountUsed() {
......
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