Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
d5f765da
Commit
d5f765da
authored
Jul 05, 2017
by
Sylvain Berfini
🐮
Browse files
Added get/set domain and configure to AccountCreator JNI wrapper
parent
fe9512bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
coreapi/linphonecore_jni.cc
View file @
d5f765da
...
...
@@ -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
);
...
...
java/common/org/linphone/core/LinphoneAccountCreator.java
View file @
d5f765da
...
...
@@ -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
();
...
...
java/impl/org/linphone/core/LinphoneAccountCreatorImpl.java
View file @
d5f765da
...
...
@@ -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
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment