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
820d26ba
Commit
820d26ba
authored
Dec 18, 2015
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix presence list tests.
parent
da682bf6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
10 deletions
+38
-10
coreapi/friend.c
coreapi/friend.c
+27
-2
coreapi/presence.c
coreapi/presence.c
+3
-1
tester/presence_tester.c
tester/presence_tester.c
+8
-7
No files found.
coreapi/friend.c
View file @
820d26ba
...
...
@@ -488,7 +488,7 @@ LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, cons
}
void
linphone_core_add_friend
(
LinphoneCore
*
lc
,
LinphoneFriend
*
lf
)
{
if
(
linphone_friend_list_add_friend
(
lc
->
friendlist
,
lf
)
!=
LinphoneFriendListOK
)
return
;
if
((
lc
->
friendlist
==
NULL
)
||
(
linphone_friend_list_add_friend
(
lc
->
friendlist
,
lf
)
!=
LinphoneFriendListOK
)
)
return
;
if
(
ms_list_find
(
lc
->
subscribers
,
lf
))
{
/*if this friend was in the pending subscriber list, now remove it from this list*/
lc
->
subscribers
=
ms_list_remove
(
lc
->
subscribers
,
lf
);
...
...
@@ -515,9 +515,34 @@ bool_t linphone_core_should_subscribe_friends_only_when_registered(const Linphon
}
void
linphone_core_send_initial_subscribes
(
LinphoneCore
*
lc
){
bool_t
proxy_config_for_rls_presence_uri_domain
=
FALSE
;
LinphoneAddress
*
rls_address
=
NULL
;
const
MSList
*
elem
;
if
(
lc
->
initial_subscribes_sent
)
return
;
lc
->
initial_subscribes_sent
=
TRUE
;
linphone_core_update_friends_subscriptions
(
lc
,
NULL
,
linphone_core_should_subscribe_friends_only_when_registered
(
lc
));
if
(
lc
->
friendlist
->
rls_uri
!=
NULL
)
{
rls_address
=
linphone_core_create_address
(
lc
,
lc
->
friendlist
->
rls_uri
);
}
if
(
rls_address
!=
NULL
)
{
const
char
*
rls_domain
=
linphone_address_get_domain
(
rls_address
);
if
(
rls_domain
!=
NULL
)
{
for
(
elem
=
linphone_core_get_proxy_config_list
(
lc
);
elem
!=
NULL
;
elem
=
elem
->
next
)
{
LinphoneProxyConfig
*
cfg
=
(
LinphoneProxyConfig
*
)
elem
->
data
;
const
char
*
proxy_domain
=
linphone_proxy_config_get_domain
(
cfg
);
if
(
strcmp
(
rls_domain
,
proxy_domain
)
==
0
)
{
proxy_config_for_rls_presence_uri_domain
=
TRUE
;
break
;
}
}
}
linphone_address_unref
(
rls_address
);
}
if
(
proxy_config_for_rls_presence_uri_domain
==
TRUE
)
{
ms_message
(
"Presence list activated so do not send initial subscribes it will be done when registered"
);
}
else
{
linphone_core_update_friends_subscriptions
(
lc
,
NULL
,
linphone_core_should_subscribe_friends_only_when_registered
(
lc
));
}
}
void
linphone_core_invalidate_friend_subscriptions
(
LinphoneCore
*
lc
){
...
...
coreapi/presence.c
View file @
820d26ba
...
...
@@ -1482,7 +1482,9 @@ void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){
ms_message
(
"Receiving new subscription from %s."
,
from
);
/* check if we answer to this subscription */
lf
=
linphone_friend_list_find_friend_by_address
(
lc
->
friendlist
,
uri
);
if
(
lc
->
friendlist
!=
NULL
)
{
lf
=
linphone_friend_list_find_friend_by_address
(
lc
->
friendlist
,
uri
);
}
if
(
lf
!=
NULL
){
linphone_friend_add_incoming_subscription
(
lf
,
op
);
lf
->
inc_subscribe_pending
=
TRUE
;
...
...
tester/presence_tester.c
View file @
820d26ba
...
...
@@ -560,7 +560,7 @@ static void enable_publish(LinphoneCoreManager *mgr, bool_t enable) {
LinphoneProxyConfig
*
cfg
=
linphone_core_get_default_proxy_config
(
mgr
->
lc
);
linphone_proxy_config_edit
(
cfg
);
linphone_proxy_config_enable_publish
(
cfg
,
enable
);
linphone_proxy_config_set_publish_expires
(
cfg
,
3
);
linphone_proxy_config_set_publish_expires
(
cfg
,
60
);
linphone_proxy_config_done
(
cfg
);
}
...
...
@@ -581,6 +581,7 @@ static void test_presence_list(void) {
pauline_identity
=
get_identity
(
pauline
);
enable_publish
(
marie
,
TRUE
);
enable_publish
(
pauline
,
TRUE
);
enable_publish
(
laure
,
TRUE
);
linphone_core_set_presence_model
(
marie
->
lc
,
linphone_core_create_presence_model_with_activity
(
marie
->
lc
,
LinphonePresenceActivityBusy
,
NULL
));
linphone_core_set_presence_model
(
pauline
->
lc
,
linphone_core_create_presence_model_with_activity
(
pauline
->
lc
,
LinphonePresenceActivityVacation
,
NULL
));
...
...
@@ -601,9 +602,9 @@ static void test_presence_list(void) {
lcs
=
ms_list_append
(
lcs
,
marie
->
lc
);
lcs
=
ms_list_append
(
lcs
,
pauline
->
lc
);
wait_for_list
(
lcs
,
&
laure
->
stat
.
number_of_NotifyReceived
,
1
,
2000
);
wait_for_list
(
lcs
,
&
laure
->
stat
.
number_of_NotifyReceived
,
2
,
2000
);
wait_for_list
(
lcs
,
&
laure
->
stat
.
number_of_NotifyPresenceReceived
,
2
,
2000
);
BC_ASSERT_EQUAL
(
laure
->
stat
.
number_of_NotifyReceived
,
1
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
laure
->
stat
.
number_of_NotifyReceived
,
2
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
laure
->
stat
.
number_of_NotifyPresenceReceived
,
2
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
laure
->
lc
->
friendlist
->
expected_notification_version
,
1
,
int
,
"%d"
);
lf
=
linphone_friend_list_find_friend_by_uri
(
laure
->
lc
->
friendlist
,
marie_identity
);
...
...
@@ -619,14 +620,13 @@ static void test_presence_list(void) {
BC_ASSERT_EQUAL
(
lf
->
presence_received
,
FALSE
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
lf
->
subscribe_active
,
TRUE
,
int
,
"%d"
);
enable_publish
(
laure
,
TRUE
);
lfl
=
linphone_core_create_friend_list
(
marie
->
lc
);
linphone_friend_list_set_rls_uri
(
lfl
,
rls_uri
);
lf
=
linphone_core_create_friend_with_address
(
marie
->
lc
,
laure_identity
);
linphone_friend_list_add_friend
(
lfl
,
lf
);
linphone_core_set_friend_list
(
marie
->
lc
,
lfl
);
linphone_friend_list_unref
(
lfl
);
linphone_friend_list_update_subscriptions
(
paulin
e
->
lc
->
friendlist
,
NULL
,
FALSE
);
linphone_friend_list_update_subscriptions
(
mari
e
->
lc
->
friendlist
,
NULL
,
FALSE
);
wait_for_list
(
lcs
,
&
marie
->
stat
.
number_of_NotifyReceived
,
1
,
2000
);
wait_for_list
(
lcs
,
&
marie
->
stat
.
number_of_NotifyPresenceReceived
,
1
,
2000
);
...
...
@@ -658,9 +658,9 @@ static void test_presence_list(void) {
linphone_core_set_presence_model
(
marie
->
lc
,
linphone_core_create_presence_model_with_activity
(
marie
->
lc
,
LinphonePresenceActivityOnThePhone
,
NULL
));
wait_for_list
(
lcs
,
&
laure
->
stat
.
number_of_NotifyReceived
,
2
,
2000
);
wait_for_list
(
lcs
,
&
laure
->
stat
.
number_of_NotifyReceived
,
3
,
2000
);
wait_for_list
(
lcs
,
&
laure
->
stat
.
number_of_NotifyPresenceReceived
,
4
,
2000
);
BC_ASSERT_EQUAL
(
laure
->
stat
.
number_of_NotifyReceived
,
2
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
laure
->
stat
.
number_of_NotifyReceived
,
3
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
laure
->
stat
.
number_of_NotifyPresenceReceived
,
4
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
laure
->
lc
->
friendlist
->
expected_notification_version
,
2
,
int
,
"%d"
);
lf
=
linphone_friend_list_find_friend_by_uri
(
laure
->
lc
->
friendlist
,
marie_identity
);
...
...
@@ -706,6 +706,7 @@ static void test_presence_list_subscribe_before_publish(void) {
linphone_core_set_friend_list
(
laure
->
lc
,
lfl
);
linphone_friend_list_unref
(
lfl
);
linphone_core_set_presence_model
(
laure
->
lc
,
linphone_core_create_presence_model_with_activity
(
laure
->
lc
,
LinphonePresenceActivityOnline
,
NULL
));
linphone_friend_list_update_subscriptions
(
laure
->
lc
->
friendlist
,
NULL
,
FALSE
);
lcs
=
ms_list_append
(
lcs
,
laure
->
lc
);
lcs
=
ms_list_append
(
lcs
,
pauline
->
lc
);
...
...
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