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
92a44a61
Commit
92a44a61
authored
Apr 06, 2016
by
Gautier Pelloux-Prayer
Browse files
Revert "Revert "presence_tester.c: add some long term tests""
This reverts commit
e2609f96
.
parent
fa75613e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
166 additions
and
95 deletions
+166
-95
coreapi/bellesip_sal/sal_op_registration.c
coreapi/bellesip_sal/sal_op_registration.c
+5
-5
coreapi/friendlist.c
coreapi/friendlist.c
+14
-13
tester/accountmanager.c
tester/accountmanager.c
+13
-13
tester/presence_tester.c
tester/presence_tester.c
+134
-64
No files found.
coreapi/bellesip_sal/sal_op_registration.c
View file @
92a44a61
...
...
@@ -25,8 +25,8 @@ static void register_refresher_listener (belle_sip_refresher_t* refresher
,
const
char
*
reason_phrase
)
{
SalOp
*
op
=
(
SalOp
*
)
user_pointer
;
belle_sip_response_t
*
response
=
belle_sip_transaction_get_response
(
BELLE_SIP_TRANSACTION
(
belle_sip_refresher_get_transaction
(
refresher
)));
ms_message
(
"Register refresher
[%i] reason [%s] for proxy [%s]"
,
status_code
,
reason_phrase
,
sal_op_get_proxy
(
op
));
ms_message
(
"Register refresher [%i] reason [%s] for proxy [%s]"
,
status_code
,
reason_phrase
,
sal_op_get_proxy
(
op
));
if
(
belle_sip_refresher_get_auth_events
(
refresher
))
{
if
(
op
->
auth_info
)
sal_auth_info_delete
(
op
->
auth_info
);
/*only take first one for now*/
...
...
@@ -46,7 +46,7 @@ static void register_refresher_listener (belle_sip_refresher_t* refresher
}
sal_op_set_service_route
(
op
,(
const
SalAddress
*
)
service_route_address
);
if
(
service_route_address
)
belle_sip_object_unref
(
service_route_address
);
sal_remove_pending_auth
(
op
->
base
.
root
,
op
);
/*just in case*/
if
(
contact
)
{
sal_op_set_contact_address
(
op
,(
SalAddress
*
)(
BELLE_SIP_HEADER_ADDRESS
(
contact
)));
/*update contact with real value*/
...
...
@@ -79,13 +79,13 @@ int sal_register(SalOp *op, const char *proxy, const char *from, int expires,Sal
belle_sip_request_t
*
req
;
belle_sip_uri_t
*
req_uri
;
belle_sip_header_t
*
accept_header
;
if
(
op
->
refresher
){
belle_sip_refresher_stop
(
op
->
refresher
);
belle_sip_object_unref
(
op
->
refresher
);
op
->
refresher
=
NULL
;
}
op
->
type
=
SalOpRegister
;
sal_op_set_from
(
op
,
from
);
sal_op_set_to
(
op
,
from
);
...
...
coreapi/friendlist.c
View file @
92a44a61
...
...
@@ -296,6 +296,7 @@ static void linphone_friend_list_destroy(LinphoneFriendList *list) {
if
(
list
->
event
!=
NULL
)
{
linphone_event_terminate
(
list
->
event
);
linphone_event_unref
(
list
->
event
);
list
->
event
=
NULL
;
}
if
(
list
->
uri
!=
NULL
)
ms_free
(
list
->
uri
);
if
(
list
->
cbs
)
linphone_friend_list_cbs_unref
(
list
->
cbs
);
...
...
@@ -436,7 +437,7 @@ LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *
return
LinphoneFriendListOK
;
}
static
void
carddav_done
(
LinphoneCardDavContext
*
cdc
,
bool_t
success
,
const
char
*
msg
)
{
static
void
carddav_done
(
LinphoneCardDavContext
*
cdc
,
bool_t
success
,
const
char
*
msg
)
{
if
(
cdc
&&
cdc
->
friend_list
->
cbs
->
sync_state_changed_cb
)
{
cdc
->
friend_list
->
cbs
->
sync_state_changed_cb
(
cdc
->
friend_list
,
success
?
LinphoneFriendListSyncSuccessful
:
LinphoneFriendListSyncFailure
,
msg
);
}
...
...
@@ -465,7 +466,7 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
}
}
}
lf
->
friend_list
=
NULL
;
linphone_friend_unref
(
lf
);
list
->
friends
=
ms_list_remove_link
(
list
->
friends
,
elem
);
...
...
@@ -483,7 +484,7 @@ const MSList * linphone_friend_list_get_friends(const LinphoneFriendList *list)
void
linphone_friend_list_update_dirty_friends
(
LinphoneFriendList
*
list
)
{
LinphoneCardDavContext
*
cdc
=
linphone_carddav_context_new
(
list
);
MSList
*
dirty_friends
=
list
->
dirty_friends_to_update
;
if
(
cdc
)
{
cdc
->
sync_done_cb
=
carddav_done
;
while
(
dirty_friends
)
{
...
...
@@ -528,7 +529,7 @@ static void carddav_updated(LinphoneCardDavContext *cdc, LinphoneFriend *lf_new,
elem
->
data
=
linphone_friend_ref
(
lf_new
);
}
linphone_core_store_friend_in_db
(
lf_new
->
lc
,
lf_new
);
if
(
cdc
->
friend_list
->
cbs
->
contact_updated_cb
)
{
cdc
->
friend_list
->
cbs
->
contact_updated_cb
(
lfl
,
lf_new
,
lf_old
);
}
...
...
@@ -538,7 +539,7 @@ static void carddav_updated(LinphoneCardDavContext *cdc, LinphoneFriend *lf_new,
void
linphone_friend_list_synchronize_friends_from_server
(
LinphoneFriendList
*
list
)
{
LinphoneCardDavContext
*
cdc
=
linphone_carddav_context_new
(
list
);
if
(
cdc
)
{
cdc
->
contact_created_cb
=
carddav_created
;
cdc
->
contact_removed_cb
=
carddav_removed
;
...
...
@@ -734,7 +735,7 @@ void linphone_friend_list_subscription_state_changed(LinphoneCore *lc, LinphoneE
,
linphone_subscription_state_to_string
(
state
)
,
lev
,
list
);
if
(
state
==
LinphoneSubscriptionOutgoingProgress
&&
linphone_event_get_reason
(
lev
)
==
LinphoneReasonNoMatch
)
{
ms_message
(
"Resseting version count for friend list [%p]"
,
list
);
list
->
expected_notification_version
=
0
;
...
...
@@ -749,7 +750,7 @@ LinphoneCore* linphone_friend_list_get_core(LinphoneFriendList *list) {
int
linphone_friend_list_import_friends_from_vcard4_file
(
LinphoneFriendList
*
list
,
const
char
*
vcard_file
)
{
MSList
*
vcards
=
linphone_vcard_list_from_vcard4_file
(
vcard_file
);
int
count
=
0
;
#ifndef VCARD_ENABLED
ms_error
(
"vCard support wasn't enabled at compilation time"
);
return
-
1
;
...
...
@@ -762,7 +763,7 @@ int linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *lis
ms_error
(
"Can't import into a NULL list"
);
return
-
1
;
}
while
(
vcards
!=
NULL
&&
vcards
->
data
!=
NULL
)
{
LinphoneVcard
*
vcard
=
(
LinphoneVcard
*
)
vcards
->
data
;
LinphoneFriend
*
lf
=
linphone_friend_new_from_vcard
(
vcard
);
...
...
@@ -785,7 +786,7 @@ int linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *lis
int
linphone_friend_list_import_friends_from_vcard4_buffer
(
LinphoneFriendList
*
list
,
const
char
*
vcard_buffer
)
{
MSList
*
vcards
=
linphone_vcard_list_from_vcard4_buffer
(
vcard_buffer
);
int
count
=
0
;
#ifndef VCARD_ENABLED
ms_error
(
"vCard support wasn't enabled at compilation time"
);
return
-
1
;
...
...
@@ -798,7 +799,7 @@ int linphone_friend_list_import_friends_from_vcard4_buffer(LinphoneFriendList *l
ms_error
(
"Can't import into a NULL list"
);
return
-
1
;
}
while
(
vcards
!=
NULL
&&
vcards
->
data
!=
NULL
)
{
LinphoneVcard
*
vcard
=
(
LinphoneVcard
*
)
vcards
->
data
;
LinphoneFriend
*
lf
=
linphone_friend_new_from_vcard
(
vcard
);
...
...
@@ -821,13 +822,13 @@ int linphone_friend_list_import_friends_from_vcard4_buffer(LinphoneFriendList *l
void
linphone_friend_list_export_friends_as_vcard4_file
(
LinphoneFriendList
*
list
,
const
char
*
vcard_file
)
{
FILE
*
file
=
NULL
;
const
MSList
*
friends
=
linphone_friend_list_get_friends
(
list
);
file
=
fopen
(
vcard_file
,
"wb"
);
if
(
file
==
NULL
)
{
ms_warning
(
"Could not write %s ! Maybe it is read-only. Contacts will not be saved."
,
vcard_file
);
return
;
}
#ifndef VCARD_ENABLED
ms_error
(
"vCard support wasn't enabled at compilation time"
);
#endif
...
...
@@ -842,6 +843,6 @@ void linphone_friend_list_export_friends_as_vcard4_file(LinphoneFriendList *list
}
friends
=
ms_list_next
(
friends
);
}
fclose
(
file
);
}
tester/accountmanager.c
View file @
92a44a61
...
...
@@ -23,9 +23,9 @@ struct _Account{
LinphoneAddress
*
identity
;
LinphoneAddress
*
modified_identity
;
char
*
password
;
int
c
re
at
ed
;
int
re
gister
ed
;
int
done
;
int
auth_reques
ted
;
int
crea
ted
;
};
typedef
struct
_Account
Account
;
...
...
@@ -95,9 +95,15 @@ Account *account_manager_get_account(AccountManager *m, const LinphoneAddress *i
static
void
account_created_on_server_cb
(
LinphoneCore
*
lc
,
LinphoneProxyConfig
*
cfg
,
LinphoneRegistrationState
state
,
const
char
*
info
){
Account
*
account
=
(
Account
*
)
linphone_core_get_user_data
(
lc
);
switch
(
state
){
case
LinphoneRegistrationOk
:
account
->
created
=
1
;
break
;
case
LinphoneRegistrationOk
:
{
char
*
phrase
=
sal_op_get_error_info
((
SalOp
*
)
cfg
->
op
)
->
full_string
;
if
(
phrase
&&
strcasecmp
(
"Test account created"
,
phrase
)
==
0
)
{
account
->
created
=
1
;
}
else
{
account
->
registered
=
1
;
}
break
;
}
case
LinphoneRegistrationCleared
:
account
->
done
=
1
;
break
;
...
...
@@ -106,11 +112,6 @@ static void account_created_on_server_cb(LinphoneCore *lc, LinphoneProxyConfig *
}
}
static
void
account_created_auth_requested_cb
(
LinphoneCore
*
lc
,
const
char
*
username
,
const
char
*
realm
,
const
char
*
domain
){
Account
*
account
=
(
Account
*
)
linphone_core_get_user_data
(
lc
);
account
->
auth_requested
=
1
;
}
void
account_create_on_server
(
Account
*
account
,
const
LinphoneProxyConfig
*
refcfg
){
LinphoneCoreVTable
vtable
=
{
0
};
LinphoneCore
*
lc
;
...
...
@@ -122,7 +123,6 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
LCSipTransports
tr
;
vtable
.
registration_state_changed
=
account_created_on_server_cb
;
vtable
.
auth_info_requested
=
account_created_auth_requested_cb
;
lc
=
configure_lc_from
(
&
vtable
,
bc_tester_get_resource_dir_prefix
(),
NULL
,
account
);
tr
.
udp_port
=
LC_SIP_TRANSPORT_RANDOM
;
tr
.
tcp_port
=
LC_SIP_TRANSPORT_RANDOM
;
...
...
@@ -150,7 +150,7 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
linphone_core_add_proxy_config
(
lc
,
cfg
);
if
(
wait_for_until
(
lc
,
NULL
,
&
account
->
auth_reques
ted
,
1
,
10000
)
==
FALSE
){
if
(
wait_for_until
(
lc
,
NULL
,
&
account
->
crea
ted
,
1
,
10000
)
==
FALSE
){
ms_fatal
(
"Account for %s could not be created on server."
,
linphone_proxy_config_get_identity
(
refcfg
));
}
linphone_proxy_config_edit
(
cfg
);
...
...
@@ -168,7 +168,7 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
linphone_core_add_auth_info
(
lc
,
ai
);
linphone_auth_info_destroy
(
ai
);
if
(
wait_for_until
(
lc
,
NULL
,
&
account
->
c
re
at
ed
,
1
,
3000
)
==
FALSE
){
if
(
wait_for_until
(
lc
,
NULL
,
&
account
->
re
gister
ed
,
1
,
3000
)
==
FALSE
){
ms_fatal
(
"Account for %s is not working on server."
,
linphone_proxy_config_get_identity
(
refcfg
));
}
linphone_core_remove_proxy_config
(
lc
,
cfg
);
...
...
tester/presence_tester.c
View file @
92a44a61
This diff is collapsed.
Click to expand it.
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