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
442cd8b9
Commit
442cd8b9
authored
Jul 21, 2016
by
Sylvain Berfini
🎩
Browse files
Added getter/setter for familly/given names in vCards
parent
c91eb8c1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
182 additions
and
4 deletions
+182
-4
coreapi/linphonecore_jni.cc
coreapi/linphonecore_jni.cc
+50
-0
coreapi/vcard.cc
coreapi/vcard.cc
+45
-3
coreapi/vcard.h
coreapi/vcard.h
+28
-0
coreapi/vcard_stubs.c
coreapi/vcard_stubs.c
+16
-0
java/common/org/linphone/core/LinphoneFriend.java
java/common/org/linphone/core/LinphoneFriend.java
+21
-1
java/impl/org/linphone/core/LinphoneFriendImpl.java
java/impl/org/linphone/core/LinphoneFriendImpl.java
+22
-0
No files found.
coreapi/linphonecore_jni.cc
View file @
442cd8b9
...
...
@@ -3484,6 +3484,32 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setName(JNIEnv* env
ReleaseStringUTFChars
(
env
,
jname
,
name
);
}
extern
"C"
void
Java_org_linphone_core_LinphoneFriendImpl_setFamillyName
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
,
jstring
jname
)
{
LinphoneFriend
*
lf
=
(
LinphoneFriend
*
)
ptr
;
LinphoneVcard
*
lvc
=
linphone_friend_get_vcard
(
lf
);
if
(
lvc
)
{
const
char
*
name
=
GetStringUTFChars
(
env
,
jname
);
linphone_vcard_set_familly_name
(
lvc
,
name
);
ReleaseStringUTFChars
(
env
,
jname
,
name
);
}
}
extern
"C"
void
Java_org_linphone_core_LinphoneFriendImpl_setGivenName
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
,
jstring
jname
)
{
LinphoneFriend
*
lf
=
(
LinphoneFriend
*
)
ptr
;
LinphoneVcard
*
lvc
=
linphone_friend_get_vcard
(
lf
);
if
(
lvc
)
{
const
char
*
name
=
GetStringUTFChars
(
env
,
jname
);
linphone_vcard_set_given_name
(
lvc
,
name
);
ReleaseStringUTFChars
(
env
,
jname
,
name
);
}
}
extern
"C"
void
Java_org_linphone_core_LinphoneFriendListImpl_setRLSUri
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
...
...
@@ -3634,6 +3660,30 @@ extern "C" jstring Java_org_linphone_core_LinphoneFriendImpl_getName(JNIEnv* en
return
name
?
env
->
NewStringUTF
(
name
)
:
NULL
;
}
extern
"C"
jstring
Java_org_linphone_core_LinphoneFriendImpl_getFamillyName
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
)
{
LinphoneFriend
*
lf
=
(
LinphoneFriend
*
)
ptr
;
LinphoneVcard
*
lvc
=
linphone_friend_get_vcard
(
lf
);
if
(
lvc
)
{
const
char
*
name
=
linphone_vcard_get_familly_name
(
lvc
);
return
name
?
env
->
NewStringUTF
(
name
)
:
NULL
;
}
return
NULL
;
}
extern
"C"
jstring
Java_org_linphone_core_LinphoneFriendImpl_getGivenName
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
)
{
LinphoneFriend
*
lf
=
(
LinphoneFriend
*
)
ptr
;
LinphoneVcard
*
lvc
=
linphone_friend_get_vcard
(
lf
);
if
(
lvc
)
{
const
char
*
name
=
linphone_vcard_get_given_name
(
lvc
);
return
name
?
env
->
NewStringUTF
(
name
)
:
NULL
;
}
return
NULL
;
}
extern
"C"
jstring
Java_org_linphone_core_LinphoneFriendImpl_getOrganization
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
)
{
...
...
coreapi/vcard.cc
View file @
442cd8b9
...
...
@@ -143,9 +143,13 @@ const char * linphone_vcard_as_vcard4_string(LinphoneVcard *vCard) {
void
linphone_vcard_set_full_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
)
{
if
(
!
vCard
||
!
name
)
return
;
shared_ptr
<
belcard
::
BelCardFullName
>
fn
=
belcard
::
BelCardGeneric
::
create
<
belcard
::
BelCardFullName
>
();
fn
->
setValue
(
name
);
vCard
->
belCard
->
setFullName
(
fn
);
if
(
vCard
->
belCard
->
getFullName
())
{
vCard
->
belCard
->
getFullName
()
->
setValue
(
name
);
}
else
{
shared_ptr
<
belcard
::
BelCardFullName
>
fn
=
belcard
::
BelCardGeneric
::
create
<
belcard
::
BelCardFullName
>
();
fn
->
setValue
(
name
);
vCard
->
belCard
->
setFullName
(
fn
);
}
}
const
char
*
linphone_vcard_get_full_name
(
const
LinphoneVcard
*
vCard
)
{
...
...
@@ -155,6 +159,44 @@ const char* linphone_vcard_get_full_name(const LinphoneVcard *vCard) {
return
result
;
}
void
linphone_vcard_set_familly_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
)
{
if
(
!
vCard
||
!
name
)
return
;
if
(
vCard
->
belCard
->
getName
())
{
vCard
->
belCard
->
getName
()
->
setFamilyName
(
name
);
}
else
{
shared_ptr
<
belcard
::
BelCardName
>
n
=
belcard
::
BelCardGeneric
::
create
<
belcard
::
BelCardName
>
();
n
->
setFamilyName
(
name
);
vCard
->
belCard
->
setName
(
n
);
}
}
const
char
*
linphone_vcard_get_familly_name
(
const
LinphoneVcard
*
vCard
)
{
if
(
!
vCard
)
return
NULL
;
const
char
*
result
=
vCard
->
belCard
->
getName
()
?
vCard
->
belCard
->
getName
()
->
getFamilyName
().
c_str
()
:
NULL
;
return
result
;
}
void
linphone_vcard_set_given_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
)
{
if
(
!
vCard
||
!
name
)
return
;
if
(
vCard
->
belCard
->
getName
())
{
vCard
->
belCard
->
getName
()
->
setGivenName
(
name
);
}
else
{
shared_ptr
<
belcard
::
BelCardName
>
n
=
belcard
::
BelCardGeneric
::
create
<
belcard
::
BelCardName
>
();
n
->
setGivenName
(
name
);
vCard
->
belCard
->
setName
(
n
);
}
}
const
char
*
linphone_vcard_get_given_name
(
const
LinphoneVcard
*
vCard
)
{
if
(
!
vCard
)
return
NULL
;
const
char
*
result
=
vCard
->
belCard
->
getName
()
?
vCard
->
belCard
->
getName
()
->
getGivenName
().
c_str
()
:
NULL
;
return
result
;
}
void
linphone_vcard_add_sip_address
(
LinphoneVcard
*
vCard
,
const
char
*
sip_address
)
{
if
(
!
vCard
||
!
sip_address
)
return
;
...
...
coreapi/vcard.h
View file @
442cd8b9
...
...
@@ -129,6 +129,34 @@ LINPHONE_PUBLIC void linphone_vcard_set_full_name(LinphoneVcard *vCard, const ch
*/
LINPHONE_PUBLIC
const
char
*
linphone_vcard_get_full_name
(
const
LinphoneVcard
*
vCard
);
/**
* Sets the familly name in the N attribute of the vCard.
* @param[in] vCard the LinphoneVcard
* @param[in] name the familly name to set for the vCard
*/
LINPHONE_PUBLIC
void
linphone_vcard_set_familly_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
);
/**
* Returns the familly name in the N attribute of the vCard, or NULL if it isn't set yet.
* @param[in] vCard the LinphoneVcard
* @return the familly name of the vCard, or NULL
*/
LINPHONE_PUBLIC
const
char
*
linphone_vcard_get_familly_name
(
const
LinphoneVcard
*
vCard
);
/**
* Sets the given name in the N attribute of the vCard.
* @param[in] vCard the LinphoneVcard
* @param[in] name the given name to set for the vCard
*/
LINPHONE_PUBLIC
void
linphone_vcard_set_given_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
);
/**
* Returns the given name in the N attribute of the vCard, or NULL if it isn't set yet.
* @param[in] vCard the LinphoneVcard
* @return the given name of the vCard, or NULL
*/
LINPHONE_PUBLIC
const
char
*
linphone_vcard_get_given_name
(
const
LinphoneVcard
*
vCard
);
/**
* Adds a SIP address in the vCard, using the IMPP property
* @param[in] vCard the LinphoneVcard
...
...
coreapi/vcard_stubs.c
View file @
442cd8b9
...
...
@@ -79,6 +79,22 @@ const char* linphone_vcard_get_full_name(const LinphoneVcard *vCard) {
return
NULL
;
}
void
linphone_vcard_set_familly_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
)
{
}
const
char
*
linphone_vcard_get_familly_name
(
const
LinphoneVcard
*
vCard
)
{
return
NULL
;
}
void
linphone_vcard_set_given_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
)
{
}
const
char
*
linphone_vcard_get_given_name
(
const
LinphoneVcard
*
vCard
)
{
return
NULL
;
}
void
linphone_vcard_add_sip_address
(
LinphoneVcard
*
vCard
,
const
char
*
sip_address
)
{
}
...
...
java/common/org/linphone/core/LinphoneFriend.java
View file @
442cd8b9
...
...
@@ -162,10 +162,30 @@ public interface LinphoneFriend {
*/
void
setName
(
String
name
);
/**
* get name of this friend
* get
a
name of this friend
* @return
*/
String
getName
();
/**
* Set a familly name for this friend
* @param name
*/
void
setFamillyName
(
String
name
);
/**
* get a familly name of this friend
* @return
*/
String
getFamillyName
();
/**
* Set a given name for this friend
* @param name
*/
void
setGivenName
(
String
name
);
/**
* get a given name of this friend
* @return
*/
String
getGivenName
();
/**
* Set an organization for this friend
* @param organization
...
...
java/impl/org/linphone/core/LinphoneFriendImpl.java
View file @
442cd8b9
...
...
@@ -142,6 +142,28 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable {
return
getName
(
nativePtr
);
}
private
native
void
setFamillyName
(
long
nativePtr
,
String
name
);
@Override
public
void
setFamillyName
(
String
name
)
{
setFamillyName
(
nativePtr
,
name
);
}
private
native
String
getFamillyName
(
long
nativePtr
);
public
String
getFamillyName
()
{
return
getFamillyName
(
nativePtr
);
}
private
native
void
setGivenName
(
long
nativePtr
,
String
name
);
@Override
public
void
setGivenName
(
String
name
)
{
setGivenName
(
nativePtr
,
name
);
}
private
native
String
getGivenName
(
long
nativePtr
);
public
String
getGivenName
()
{
return
getGivenName
(
nativePtr
);
}
private
native
void
setOrganization
(
long
nativePtr
,
String
organization
);
@Override
public
void
setOrganization
(
String
organization
)
{
...
...
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