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
2a090655
Commit
2a090655
authored
Apr 15, 2016
by
Sylvain Berfini
🐮
Browse files
Fixed vcard tests using new dav server
parent
2381e157
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
coreapi/carddav.c
coreapi/carddav.c
+5
-2
tester/rcfiles/carddav_rc
tester/rcfiles/carddav_rc
+3
-3
tester/vcard_tester.c
tester/vcard_tester.c
+11
-9
No files found.
coreapi/carddav.c
View file @
2a090655
...
...
@@ -430,10 +430,11 @@ static void linphone_carddav_send_query(LinphoneCardDavQuery *query) {
belle_generic_uri_t
*
uri
=
NULL
;
belle_http_request_t
*
req
=
NULL
;
belle_sip_memory_body_handler_t
*
bh
=
NULL
;
LinphoneCardDavContext
*
cdc
=
query
->
context
;
char
*
ua
=
NULL
;
uri
=
belle_generic_uri_parse
(
query
->
url
);
if
(
!
uri
)
{
LinphoneCardDavContext
*
cdc
=
query
->
context
;
if
(
cdc
&&
cdc
->
sync_done_cb
)
{
cdc
->
sync_done_cb
(
cdc
,
FALSE
,
"Could not send request, URL is invalid"
);
}
...
...
@@ -443,7 +444,6 @@ static void linphone_carddav_send_query(LinphoneCardDavQuery *query) {
req
=
belle_http_request_create
(
query
->
method
,
uri
,
belle_sip_header_content_type_create
(
"application"
,
"xml; charset=utf-8"
),
NULL
);
if
(
!
req
)
{
LinphoneCardDavContext
*
cdc
=
query
->
context
;
if
(
cdc
&&
cdc
->
sync_done_cb
)
{
cdc
->
sync_done_cb
(
cdc
,
FALSE
,
"Could not create belle_http_request_t"
);
}
...
...
@@ -452,6 +452,9 @@ static void linphone_carddav_send_query(LinphoneCardDavQuery *query) {
return
;
}
ua
=
ms_strdup_printf
(
"%s/%s"
,
linphone_core_get_user_agent
(
cdc
->
friend_list
->
lc
),
linphone_core_get_version
());
belle_sip_message_add_header
((
belle_sip_message_t
*
)
req
,
belle_sip_header_create
(
"User-Agent"
,
ua
));
ms_free
(
ua
);
if
(
query
->
depth
)
{
belle_sip_message_add_header
((
belle_sip_message_t
*
)
req
,
belle_sip_header_create
(
"Depth"
,
query
->
depth
));
}
else
if
(
query
->
ifmatch
)
{
...
...
tester/rcfiles/carddav_rc
View file @
2a090655
...
...
@@ -7,6 +7,6 @@ sip_random_port=1
[auth_info_0]
domain=dav.linphone.org
username=sylvain
ha1=4747ce2517a985f2fc20234a38f068b6
realm=SabreDAV
\ No newline at end of file
username=tester
ha1=102bdd8ccafef75cf7572c97969afd9a
realm=BaikalDAV
\ No newline at end of file
tester/vcard_tester.c
View file @
2a090655
...
...
@@ -23,6 +23,8 @@
#include <time.h>
#define CARDDAV_SERVER "http://dav.linphone.org/card.php/addressbooks/tester/default"
#ifdef VCARD_ENABLED
static
char
*
create_filepath
(
const
char
*
dir
,
const
char
*
filename
,
const
char
*
ext
)
{
return
ms_strdup_printf
(
"%s/%s.%s"
,
dir
,
filename
,
ext
);
...
...
@@ -390,7 +392,7 @@ static void carddav_sync(void) {
LinphoneFriendList
*
lfl
=
linphone_core_create_friend_list
(
manager
->
lc
);
LinphoneCardDavContext
*
c
=
NULL
;
linphone_friend_list_set_uri
(
lfl
,
"http://dav.linphone.org/sabredav/addressbookserver.php/addressbooks/sylvain/default"
);
linphone_friend_list_set_uri
(
lfl
,
CARDDAV_SERVER
);
linphone_core_add_friend_list
(
manager
->
lc
,
lfl
);
linphone_friend_list_unref
(
lfl
);
c
=
linphone_carddav_context_new
(
lfl
);
...
...
@@ -421,7 +423,7 @@ static void carddav_sync_2(void) {
LinphoneFriendList
*
lfl
=
linphone_core_create_friend_list
(
manager
->
lc
);
LinphoneCardDavContext
*
c
=
NULL
;
linphone_friend_list_set_uri
(
lfl
,
"http://dav.linphone.org/sabredav/addressbookserver.php/addressbooks/sylvain/default"
);
linphone_friend_list_set_uri
(
lfl
,
CARDDAV_SERVER
);
linphone_core_add_friend_list
(
manager
->
lc
,
lfl
);
linphone_friend_list_unref
(
lfl
);
c
=
linphone_carddav_context_new
(
lfl
);
...
...
@@ -463,7 +465,7 @@ static void carddav_sync_3(void) {
LinphoneFriendList
*
lfl
=
linphone_core_create_friend_list
(
manager
->
lc
);
LinphoneCardDavContext
*
c
=
NULL
;
linphone_friend_list_set_uri
(
lfl
,
"http://dav.linphone.org/sabredav/addressbookserver.php/addressbooks/sylvain/default"
);
linphone_friend_list_set_uri
(
lfl
,
CARDDAV_SERVER
);
linphone_core_add_friend_list
(
manager
->
lc
,
lfl
);
linphone_friend_list_unref
(
lfl
);
c
=
linphone_carddav_context_new
(
lfl
);
...
...
@@ -502,7 +504,7 @@ static void carddav_sync_4(void) {
LinphoneFriendList
*
lfl
=
linphone_core_create_friend_list
(
manager
->
lc
);
LinphoneCardDavContext
*
c
=
NULL
;
linphone_friend_list_set_uri
(
lfl
,
"http://dav.linphone.org/sabredav/addressbookserver.php/addressbooks/sylvain/default"
);
linphone_friend_list_set_uri
(
lfl
,
CARDDAV_SERVER
);
linphone_core_add_friend_list
(
manager
->
lc
,
lfl
);
linphone_friend_list_unref
(
lfl
);
c
=
linphone_carddav_context_new
(
lfl
);
...
...
@@ -566,7 +568,7 @@ static void carddav_integration(void) {
LinphoneCardDAVStats
*
stats
=
(
LinphoneCardDAVStats
*
)
ms_new0
(
LinphoneCardDAVStats
,
1
);
const
char
*
refkey
=
"toto"
;
linphone_friend_list_set_uri
(
lfl
,
"http://dav.linphone.org/sabredav/addressbookserver.php/addressbooks/sylvain/default"
);
linphone_friend_list_set_uri
(
lfl
,
CARDDAV_SERVER
);
cbs
=
linphone_friend_list_get_callbacks
(
lfl
);
linphone_friend_list_cbs_set_user_data
(
cbs
,
stats
);
linphone_friend_list_cbs_set_contact_created
(
cbs
,
carddav_contact_created
);
...
...
@@ -596,7 +598,7 @@ static void carddav_integration(void) {
linphone_friend_unref
(
lf
);
lvc2
=
linphone_vcard_new_from_vcard4_buffer
(
"BEGIN:VCARD
\r\n
VERSION:4.0
\r\n
FN:Sylvain Berfini
\r\n
IMPP:sip:sberfini@sip.linphone.org
\r\n
UID:1f08dd48-29ac-4097-8e48-8596d7776283
\r\n
END:VCARD
\r\n
"
);
linphone_vcard_set_url
(
lvc2
,
"/
sabredav/addressbookserver
.php/addressbooks/
sylvain
/default/me.vcf"
);
linphone_vcard_set_url
(
lvc2
,
"/
card
.php/addressbooks/
tester
/default/me.vcf"
);
lf2
=
linphone_friend_new_from_vcard
(
lvc2
);
linphone_friend_set_ref_key
(
lf2
,
refkey
);
BC_ASSERT_EQUAL
(
linphone_friend_list_add_local_friend
(
lfl
,
lf2
),
LinphoneFriendListOK
,
int
,
"%d"
);
...
...
@@ -650,7 +652,7 @@ static void carddav_clean(void) { // This is to ensure the content of the test
linphone_friend_list_cbs_set_contact_updated
(
cbs
,
carddav_contact_updated
);
linphone_friend_list_cbs_set_sync_status_changed
(
cbs
,
carddav_sync_status_changed
);
linphone_core_add_friend_list
(
manager
->
lc
,
lfl
);
linphone_friend_list_set_uri
(
lfl
,
"http://dav.linphone.org/sabredav/addressbookserver.php/addressbooks/sylvain/default"
);
linphone_friend_list_set_uri
(
lfl
,
CARDDAV_SERVER
);
linphone_friend_list_synchronize_friends_from_server
(
lfl
);
wait_for_until
(
manager
->
lc
,
NULL
,
&
stats
->
sync_done_count
,
1
,
2000
);
...
...
@@ -669,7 +671,7 @@ static void carddav_clean(void) { // This is to ensure the content of the test
}
lvc
=
linphone_vcard_new_from_vcard4_buffer
(
"BEGIN:VCARD
\r\n
VERSION:4.0
\r\n
FN:Sylvain Berfini
\r\n
IMPP:sip:sylvain@sip.linphone.org
\r\n
UID:1f08dd48-29ac-4097-8e48-8596d7776283
\r\n
END:VCARD
\r\n
"
);
linphone_vcard_set_url
(
lvc
,
"http://dav.linphone.org/
sabredav/addressbookserver
.php/addressbooks/
sylvain
/default/me.vcf"
);
linphone_vcard_set_url
(
lvc
,
"http://dav.linphone.org/
card
.php/addressbooks/
tester
/default/me.vcf"
);
lf
=
linphone_friend_new_from_vcard
(
lvc
);
linphone_friend_list_add_friend
(
lfl
,
lf
);
wait_for_until
(
manager
->
lc
,
NULL
,
&
stats
->
sync_done_count
,
1
,
2000
);
...
...
@@ -693,7 +695,7 @@ static void carddav_multiple_sync(void) {
linphone_friend_list_cbs_set_contact_updated
(
cbs
,
carddav_contact_updated
);
linphone_friend_list_cbs_set_sync_status_changed
(
cbs
,
carddav_sync_status_changed
);
linphone_core_add_friend_list
(
manager
->
lc
,
lfl
);
linphone_friend_list_set_uri
(
lfl
,
"http://dav.linphone.org/sabredav/addressbookserver.php/addressbooks/sylvain/default"
);
linphone_friend_list_set_uri
(
lfl
,
CARDDAV_SERVER
);
linphone_friend_list_synchronize_friends_from_server
(
lfl
);
wait_for_until
(
manager
->
lc
,
NULL
,
&
stats
->
sync_done_count
,
1
,
2000
);
...
...
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