Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
8903f588
Commit
8903f588
authored
Jul 22, 2016
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix errors in vcard API.
parent
5139f91b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
65 deletions
+45
-65
coreapi/linphonecore_jni.cc
coreapi/linphonecore_jni.cc
+4
-4
coreapi/vcard.cc
coreapi/vcard.cc
+23
-23
coreapi/vcard.h
coreapi/vcard.h
+6
-13
coreapi/vcard_stubs.c
coreapi/vcard_stubs.c
+2
-15
java/common/org/linphone/core/LinphoneFriend.java
java/common/org/linphone/core/LinphoneFriend.java
+4
-4
java/impl/org/linphone/core/LinphoneFriendImpl.java
java/impl/org/linphone/core/LinphoneFriendImpl.java
+6
-6
No files found.
coreapi/linphonecore_jni.cc
View file @
8903f588
...
...
@@ -3508,7 +3508,7 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setName(JNIEnv* env
ReleaseStringUTFChars
(
env
,
jname
,
name
);
}
extern
"C"
void
Java_org_linphone_core_LinphoneFriendImpl_setFamil
l
yName
(
JNIEnv
*
env
extern
"C"
void
Java_org_linphone_core_LinphoneFriendImpl_setFamilyName
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
,
jstring
jname
)
{
...
...
@@ -3516,7 +3516,7 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setFamillyName(JNIEnv*
LinphoneVcard
*
lvc
=
linphone_friend_get_vcard
(
lf
);
if
(
lvc
)
{
const
char
*
name
=
GetStringUTFChars
(
env
,
jname
);
linphone_vcard_set_famil
l
y_name
(
lvc
,
name
);
linphone_vcard_set_family_name
(
lvc
,
name
);
ReleaseStringUTFChars
(
env
,
jname
,
name
);
}
}
...
...
@@ -3684,13 +3684,13 @@ 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_getFamil
l
yName
(
JNIEnv
*
env
extern
"C"
jstring
Java_org_linphone_core_LinphoneFriendImpl_getFamilyName
(
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_famil
l
y_name
(
lvc
);
const
char
*
name
=
linphone_vcard_get_family_name
(
lvc
);
return
name
?
env
->
NewStringUTF
(
name
)
:
NULL
;
}
return
NULL
;
...
...
coreapi/vcard.cc
View file @
8903f588
...
...
@@ -136,13 +136,13 @@ LinphoneVcard* linphone_vcard_context_get_vcard_from_buffer(LinphoneVcardContext
const
char
*
linphone_vcard_as_vcard4_string
(
LinphoneVcard
*
vCard
)
{
if
(
!
vCard
)
return
NULL
;
return
vCard
->
belCard
->
toFoldedString
().
c_str
();
}
void
linphone_vcard_set_full_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
)
{
if
(
!
vCard
||
!
name
)
return
;
if
(
vCard
->
belCard
->
getFullName
())
{
vCard
->
belCard
->
getFullName
()
->
setValue
(
name
);
}
else
{
...
...
@@ -154,14 +154,14 @@ void linphone_vcard_set_full_name(LinphoneVcard *vCard, const char *name) {
const
char
*
linphone_vcard_get_full_name
(
const
LinphoneVcard
*
vCard
)
{
if
(
!
vCard
)
return
NULL
;
const
char
*
result
=
vCard
->
belCard
->
getFullName
()
?
vCard
->
belCard
->
getFullName
()
->
getValue
().
c_str
()
:
NULL
;
return
result
;
}
void
linphone_vcard_set_famil
l
y_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
)
{
void
linphone_vcard_set_family_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
)
{
if
(
!
vCard
||
!
name
)
return
;
if
(
vCard
->
belCard
->
getName
())
{
vCard
->
belCard
->
getName
()
->
setFamilyName
(
name
);
}
else
{
...
...
@@ -171,16 +171,16 @@ void linphone_vcard_set_familly_name(LinphoneVcard *vCard, const char *name) {
}
}
const
char
*
linphone_vcard_get_famil
l
y_name
(
const
LinphoneVcard
*
vCard
)
{
const
char
*
linphone_vcard_get_family_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
{
...
...
@@ -192,14 +192,14 @@ void linphone_vcard_set_given_name(LinphoneVcard *vCard, const char *name) {
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
;
shared_ptr
<
belcard
::
BelCardImpp
>
impp
=
belcard
::
BelCardGeneric
::
create
<
belcard
::
BelCardImpp
>
();
impp
->
setValue
(
sip_address
);
vCard
->
belCard
->
addImpp
(
impp
);
...
...
@@ -207,7 +207,7 @@ void linphone_vcard_add_sip_address(LinphoneVcard *vCard, const char *sip_addres
void
linphone_vcard_remove_sip_address
(
LinphoneVcard
*
vCard
,
const
char
*
sip_address
)
{
if
(
!
vCard
)
return
;
shared_ptr
<
belcard
::
BelCardImpp
>
impp
;
for
(
auto
it
=
vCard
->
belCard
->
getImpp
().
begin
();
it
!=
vCard
->
belCard
->
getImpp
().
end
();
++
it
)
{
const
char
*
value
=
(
*
it
)
->
getValue
().
c_str
();
...
...
@@ -223,7 +223,7 @@ void linphone_vcard_remove_sip_address(LinphoneVcard *vCard, const char *sip_add
void
linphone_vcard_edit_main_sip_address
(
LinphoneVcard
*
vCard
,
const
char
*
sip_address
)
{
if
(
!
vCard
||
!
sip_address
)
return
;
if
(
vCard
->
belCard
->
getImpp
().
size
()
>
0
)
{
const
shared_ptr
<
belcard
::
BelCardImpp
>
impp
=
vCard
->
belCard
->
getImpp
().
front
();
impp
->
setValue
(
sip_address
);
...
...
@@ -237,7 +237,7 @@ void linphone_vcard_edit_main_sip_address(LinphoneVcard *vCard, const char *sip_
bctbx_list_t
*
linphone_vcard_get_sip_addresses
(
const
LinphoneVcard
*
vCard
)
{
bctbx_list_t
*
result
=
NULL
;
if
(
!
vCard
)
return
NULL
;
for
(
auto
it
=
vCard
->
belCard
->
getImpp
().
begin
();
it
!=
vCard
->
belCard
->
getImpp
().
end
();
++
it
)
{
const
char
*
value
=
(
*
it
)
->
getValue
().
c_str
();
if
(
strncmp
(
value
,
"sip:"
,
4
)
==
0
)
{
...
...
@@ -249,7 +249,7 @@ bctbx_list_t* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard) {
void
linphone_vcard_add_phone_number
(
LinphoneVcard
*
vCard
,
const
char
*
phone
)
{
if
(
!
vCard
||
!
phone
)
return
;
shared_ptr
<
belcard
::
BelCardPhoneNumber
>
phone_number
=
belcard
::
BelCardGeneric
::
create
<
belcard
::
BelCardPhoneNumber
>
();
phone_number
->
setValue
(
phone
);
vCard
->
belCard
->
addPhoneNumber
(
phone_number
);
...
...
@@ -257,7 +257,7 @@ void linphone_vcard_add_phone_number(LinphoneVcard *vCard, const char *phone) {
void
linphone_vcard_remove_phone_number
(
LinphoneVcard
*
vCard
,
const
char
*
phone
)
{
if
(
!
vCard
)
return
;
shared_ptr
<
belcard
::
BelCardPhoneNumber
>
tel
;
for
(
auto
it
=
vCard
->
belCard
->
getPhoneNumbers
().
begin
();
it
!=
vCard
->
belCard
->
getPhoneNumbers
().
end
();
++
it
)
{
const
char
*
value
=
(
*
it
)
->
getValue
().
c_str
();
...
...
@@ -274,7 +274,7 @@ void linphone_vcard_remove_phone_number(LinphoneVcard *vCard, const char *phone)
bctbx_list_t
*
linphone_vcard_get_phone_numbers
(
const
LinphoneVcard
*
vCard
)
{
bctbx_list_t
*
result
=
NULL
;
if
(
!
vCard
)
return
NULL
;
for
(
auto
it
=
vCard
->
belCard
->
getPhoneNumbers
().
begin
();
it
!=
vCard
->
belCard
->
getPhoneNumbers
().
end
();
++
it
)
{
const
char
*
value
=
(
*
it
)
->
getValue
().
c_str
();
result
=
bctbx_list_append
(
result
,
(
char
*
)
value
);
...
...
@@ -284,7 +284,7 @@ bctbx_list_t* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard) {
void
linphone_vcard_set_organization
(
LinphoneVcard
*
vCard
,
const
char
*
organization
)
{
if
(
!
vCard
)
return
;
if
(
vCard
->
belCard
->
getOrganizations
().
size
()
>
0
)
{
const
shared_ptr
<
belcard
::
BelCardOrganization
>
org
=
vCard
->
belCard
->
getOrganizations
().
front
();
org
->
setValue
(
organization
);
...
...
@@ -300,13 +300,13 @@ const char* linphone_vcard_get_organization(const LinphoneVcard *vCard) {
const
shared_ptr
<
belcard
::
BelCardOrganization
>
org
=
vCard
->
belCard
->
getOrganizations
().
front
();
return
org
->
getValue
().
c_str
();
}
return
NULL
;
}
bool_t
linphone_vcard_generate_unique_id
(
LinphoneVcard
*
vCard
)
{
char
uuid
[
64
];
if
(
vCard
)
{
if
(
linphone_vcard_get_uid
(
vCard
))
{
return
FALSE
;
...
...
@@ -323,7 +323,7 @@ bool_t linphone_vcard_generate_unique_id(LinphoneVcard *vCard) {
void
linphone_vcard_set_uid
(
LinphoneVcard
*
vCard
,
const
char
*
uid
)
{
if
(
!
vCard
||
!
uid
)
return
;
shared_ptr
<
belcard
::
BelCardUniqueId
>
uniqueId
=
belcard
::
BelCardGeneric
::
create
<
belcard
::
BelCardUniqueId
>
();
uniqueId
->
setValue
(
uid
);
vCard
->
belCard
->
setUniqueId
(
uniqueId
);
...
...
@@ -386,11 +386,11 @@ bool_t linphone_vcard_compare_md5_hash(LinphoneVcard *vCard) {
unsigned
char
*
previous_md5
=
vCard
->
md5
;
unsigned
char
*
new_md5
=
NULL
;
int
result
=
-
1
;
if
(
!
previous_md5
)
{
return
result
;
}
linphone_vcard_compute_md5_hash
(
vCard
);
new_md5
=
vCard
->
md5
;
result
=
memcmp
(
new_md5
,
previous_md5
,
VCARD_MD5_HASH_SIZE
);
...
...
@@ -402,4 +402,4 @@ bool_t linphone_vcard_compare_md5_hash(LinphoneVcard *vCard) {
#ifdef __cplusplus
}
#endif
\ No newline at end of file
#endif
coreapi/vcard.h
View file @
8903f588
...
...
@@ -130,18 +130,18 @@ 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 famil
l
y name in the N attribute of the vCard.
* Sets the family name in the N attribute of the vCard.
* @param[in] vCard the LinphoneVcard
* @param[in] name the famil
l
y name to set for the vCard
* @param[in] name the family name to set for the vCard
*/
LINPHONE_PUBLIC
void
linphone_vcard_set_famil
l
y_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
);
LINPHONE_PUBLIC
void
linphone_vcard_set_family_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
);
/**
* Returns the famil
l
y name in the N attribute of the vCard, or NULL if it isn't set yet.
* Returns the family name in the N attribute of the vCard, or NULL if it isn't set yet.
* @param[in] vCard the LinphoneVcard
* @return the famil
l
y name of the vCard, or NULL
* @return the family name of the vCard, or NULL
*/
LINPHONE_PUBLIC
const
char
*
linphone_vcard_get_famil
l
y_name
(
const
LinphoneVcard
*
vCard
);
LINPHONE_PUBLIC
const
char
*
linphone_vcard_get_family_name
(
const
LinphoneVcard
*
vCard
);
/**
* Sets the given name in the N attribute of the vCard.
...
...
@@ -206,13 +206,6 @@ void linphone_vcard_remove_phone_number(LinphoneVcard *vCard, const char *phone)
*/
LINPHONE_PUBLIC
bctbx_list_t
*
linphone_vcard_get_phone_numbers
(
const
LinphoneVcard
*
vCard
);
/**
* Returns the list of SIP addresses (as string) in the vCard (all the IMPP attributes that has an URI value starting by "sip:") or NULL
* @param[in] vCard the LinphoneVcard
* @return \mslist{const char *}
*/
LINPHONE_PUBLIC
bctbx_list_t
*
linphone_vcard_get_sip_addresses
(
const
LinphoneVcard
*
vCard
);
/**
* Fills the Organization field of the vCard
* @param[in] vCard the LinphoneVcard
...
...
coreapi/vcard_stubs.c
View file @
8903f588
...
...
@@ -52,7 +52,6 @@ LinphoneVcard* linphone_vcard_new(void) {
}
void
linphone_vcard_free
(
LinphoneVcard
*
vCard
)
{
}
MSList
*
linphone_vcard_context_get_vcard_list_from_file
(
LinphoneVcardContext
*
context
,
const
char
*
filename
)
{
...
...
@@ -72,23 +71,20 @@ const char * linphone_vcard_as_vcard4_string(LinphoneVcard *vCard) {
}
void
linphone_vcard_set_full_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
)
{
}
const
char
*
linphone_vcard_get_full_name
(
const
LinphoneVcard
*
vCard
)
{
return
NULL
;
}
void
linphone_vcard_set_familly_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
)
{
void
linphone_vcard_set_family_name
(
LinphoneVcard
*
vCard
,
const
char
*
name
)
{
}
const
char
*
linphone_vcard_get_famil
l
y_name
(
const
LinphoneVcard
*
vCard
)
{
const
char
*
linphone_vcard_get_family_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
)
{
...
...
@@ -96,15 +92,12 @@ const char* linphone_vcard_get_given_name(const LinphoneVcard *vCard) {
}
void
linphone_vcard_add_sip_address
(
LinphoneVcard
*
vCard
,
const
char
*
sip_address
)
{
}
void
linphone_vcard_remove_sip_address
(
LinphoneVcard
*
vCard
,
const
char
*
sip_address
)
{
}
void
linphone_vcard_edit_main_sip_address
(
LinphoneVcard
*
vCard
,
const
char
*
sip_address
)
{
}
MSList
*
linphone_vcard_get_sip_addresses
(
const
LinphoneVcard
*
vCard
)
{
...
...
@@ -112,11 +105,9 @@ MSList* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard) {
}
void
linphone_vcard_add_phone_number
(
LinphoneVcard
*
vCard
,
const
char
*
phone
)
{
}
void
linphone_vcard_remove_phone_number
(
LinphoneVcard
*
vCard
,
const
char
*
phone
)
{
}
MSList
*
linphone_vcard_get_phone_numbers
(
const
LinphoneVcard
*
vCard
)
{
...
...
@@ -124,7 +115,6 @@ MSList* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard) {
}
void
linphone_vcard_set_organization
(
LinphoneVcard
*
vCard
,
const
char
*
organization
)
{
}
const
char
*
linphone_vcard_get_organization
(
const
LinphoneVcard
*
vCard
)
{
...
...
@@ -136,7 +126,6 @@ bool_t linphone_vcard_generate_unique_id(LinphoneVcard *vCard) {
}
void
linphone_vcard_set_uid
(
LinphoneVcard
*
vCard
,
const
char
*
uid
)
{
}
const
char
*
linphone_vcard_get_uid
(
const
LinphoneVcard
*
vCard
)
{
...
...
@@ -144,7 +133,6 @@ const char* linphone_vcard_get_uid(const LinphoneVcard *vCard) {
}
void
linphone_vcard_set_etag
(
LinphoneVcard
*
vCard
,
const
char
*
etag
)
{
}
const
char
*
linphone_vcard_get_etag
(
const
LinphoneVcard
*
vCard
)
{
...
...
@@ -152,7 +140,6 @@ const char* linphone_vcard_get_etag(const LinphoneVcard *vCard) {
}
void
linphone_vcard_set_url
(
LinphoneVcard
*
vCard
,
const
char
*
url
)
{
}
const
char
*
linphone_vcard_get_url
(
const
LinphoneVcard
*
vCard
)
{
...
...
java/common/org/linphone/core/LinphoneFriend.java
View file @
8903f588
...
...
@@ -167,15 +167,15 @@ public interface LinphoneFriend {
*/
String
getName
();
/**
* Set a famil
l
y name for this friend
* Set a family name for this friend
* @param name
*/
void
setFamil
l
yName
(
String
name
);
void
setFamilyName
(
String
name
);
/**
* get a famil
l
y name of this friend
* get a family name of this friend
* @return
*/
String
getFamil
l
yName
();
String
getFamilyName
();
/**
* Set a given name for this friend
* @param name
...
...
java/impl/org/linphone/core/LinphoneFriendImpl.java
View file @
8903f588
...
...
@@ -142,15 +142,15 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable {
return
getName
(
nativePtr
);
}
private
native
void
setFamil
l
yName
(
long
nativePtr
,
String
name
);
private
native
void
setFamilyName
(
long
nativePtr
,
String
name
);
@Override
public
void
setFamil
l
yName
(
String
name
)
{
setFamil
l
yName
(
nativePtr
,
name
);
public
void
setFamilyName
(
String
name
)
{
setFamilyName
(
nativePtr
,
name
);
}
private
native
String
getFamil
l
yName
(
long
nativePtr
);
public
String
getFamil
l
yName
()
{
return
getFamil
l
yName
(
nativePtr
);
private
native
String
getFamilyName
(
long
nativePtr
);
public
String
getFamilyName
()
{
return
getFamilyName
(
nativePtr
);
}
private
native
void
setGivenName
(
long
nativePtr
,
String
name
);
...
...
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