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
da682bf6
Commit
da682bf6
authored
Dec 18, 2015
by
Ghislain MARY
Browse files
If a presence list subscription already exist refresh it instead of creating a new one.
parent
03261a97
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
coreapi/friendlist.c
coreapi/friendlist.c
+11
-8
coreapi/private.h
coreapi/private.h
+1
-1
No files found.
coreapi/friendlist.c
View file @
da682bf6
...
@@ -120,6 +120,7 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList
...
@@ -120,6 +120,7 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList
linphone_free_xml_text_content
(
version_str
);
linphone_free_xml_text_content
(
version_str
);
if
(
version
<
list
->
expected_notification_version
)
{
if
(
version
<
list
->
expected_notification_version
)
{
ms_warning
(
"rlmi+xml: Discarding received notification with version %d because %d was expected"
,
version
,
list
->
expected_notification_version
);
ms_warning
(
"rlmi+xml: Discarding received notification with version %d because %d was expected"
,
version
,
list
->
expected_notification_version
);
linphone_friend_list_update_subscriptions
(
list
,
NULL
,
FALSE
);
/* Refresh subscription to get new full state notify. */
goto
end
;
goto
end
;
}
}
...
@@ -224,6 +225,7 @@ static LinphoneFriendList * linphone_friend_list_new(void) {
...
@@ -224,6 +225,7 @@ static LinphoneFriendList * linphone_friend_list_new(void) {
static
void
linphone_friend_list_destroy
(
LinphoneFriendList
*
list
)
{
static
void
linphone_friend_list_destroy
(
LinphoneFriendList
*
list
)
{
if
(
list
->
display_name
!=
NULL
)
ms_free
(
list
->
display_name
);
if
(
list
->
display_name
!=
NULL
)
ms_free
(
list
->
display_name
);
if
(
list
->
rls_uri
!=
NULL
)
ms_free
(
list
->
rls_uri
);
if
(
list
->
rls_uri
!=
NULL
)
ms_free
(
list
->
rls_uri
);
if
(
list
->
event
!=
NULL
)
linphone_event_unref
(
list
->
event
);
list
->
friends
=
ms_list_free_with_data
(
list
->
friends
,
(
void
(
*
)(
void
*
))
linphone_friend_unref
);
list
->
friends
=
ms_list_free_with_data
(
list
->
friends
,
(
void
(
*
)(
void
*
))
linphone_friend_unref
);
}
}
...
@@ -364,24 +366,25 @@ void linphone_friend_list_close_subscriptions(LinphoneFriendList *list) {
...
@@ -364,24 +366,25 @@ void linphone_friend_list_close_subscriptions(LinphoneFriendList *list) {
void
linphone_friend_list_update_subscriptions
(
LinphoneFriendList
*
list
,
LinphoneProxyConfig
*
cfg
,
bool_t
only_when_registered
)
{
void
linphone_friend_list_update_subscriptions
(
LinphoneFriendList
*
list
,
LinphoneProxyConfig
*
cfg
,
bool_t
only_when_registered
)
{
const
MSList
*
elem
;
const
MSList
*
elem
;
if
(
list
->
rls_uri
!=
NULL
)
{
if
(
list
->
event
!=
NULL
)
{
linphone_event_refresh_subscribe
(
list
->
event
);
}
else
if
(
list
->
rls_uri
!=
NULL
)
{
LinphoneAddress
*
address
=
linphone_address_new
(
list
->
rls_uri
);
LinphoneAddress
*
address
=
linphone_address_new
(
list
->
rls_uri
);
char
*
xml_content
=
create_resource_list_xml
(
list
);
char
*
xml_content
=
create_resource_list_xml
(
list
);
if
((
address
!=
NULL
)
&&
(
xml_content
!=
NULL
)
&&
(
linphone_friend_list_has_subscribe_inactive
(
list
)
==
TRUE
))
{
if
((
address
!=
NULL
)
&&
(
xml_content
!=
NULL
)
&&
(
linphone_friend_list_has_subscribe_inactive
(
list
)
==
TRUE
))
{
LinphoneEvent
*
event
;
LinphoneContent
*
content
;
LinphoneContent
*
content
;
int
expires
=
lp_config_get_int
(
list
->
lc
->
config
,
"sip"
,
"rls_presence_expires"
,
3600
);
int
expires
=
lp_config_get_int
(
list
->
lc
->
config
,
"sip"
,
"rls_presence_expires"
,
3600
);
list
->
expected_notification_version
=
0
;
list
->
expected_notification_version
=
0
;
event
=
linphone_core_create_subscribe
(
list
->
lc
,
address
,
"presence"
,
expires
);
list
->
event
=
linphone_core_create_subscribe
(
list
->
lc
,
address
,
"presence"
,
expires
);
linphone_event_add_custom_header
(
event
,
"Require"
,
"recipient-list-subscribe"
);
linphone_event_add_custom_header
(
list
->
event
,
"Require"
,
"recipient-list-subscribe"
);
linphone_event_add_custom_header
(
event
,
"Supported"
,
"eventlist"
);
linphone_event_add_custom_header
(
list
->
event
,
"Supported"
,
"eventlist"
);
linphone_event_add_custom_header
(
event
,
"Accept"
,
"multipart/related, application/pidf+xml, application/rlmi+xml"
);
linphone_event_add_custom_header
(
list
->
event
,
"Accept"
,
"multipart/related, application/pidf+xml, application/rlmi+xml"
);
linphone_event_add_custom_header
(
event
,
"Content-Disposition"
,
"recipient-list"
);
linphone_event_add_custom_header
(
list
->
event
,
"Content-Disposition"
,
"recipient-list"
);
content
=
linphone_core_create_content
(
list
->
lc
);
content
=
linphone_core_create_content
(
list
->
lc
);
linphone_content_set_type
(
content
,
"application"
);
linphone_content_set_type
(
content
,
"application"
);
linphone_content_set_subtype
(
content
,
"resource-lists+xml"
);
linphone_content_set_subtype
(
content
,
"resource-lists+xml"
);
linphone_content_set_string_buffer
(
content
,
xml_content
);
linphone_content_set_string_buffer
(
content
,
xml_content
);
linphone_event_send_subscribe
(
event
,
content
);
linphone_event_send_subscribe
(
list
->
event
,
content
);
linphone_content_unref
(
content
);
linphone_content_unref
(
content
);
}
}
if
(
address
!=
NULL
)
linphone_address_unref
(
address
);
if
(
address
!=
NULL
)
linphone_address_unref
(
address
);
...
...
coreapi/private.h
View file @
da682bf6
...
@@ -361,7 +361,6 @@ void linphone_core_write_auth_info(LinphoneCore *lc, LinphoneAuthInfo *ai);
...
@@ -361,7 +361,6 @@ void linphone_core_write_auth_info(LinphoneCore *lc, LinphoneAuthInfo *ai);
const
LinphoneAuthInfo
*
_linphone_core_find_auth_info
(
LinphoneCore
*
lc
,
const
char
*
realm
,
const
char
*
username
,
const
char
*
domain
,
bool_t
ignore_realm
);
const
LinphoneAuthInfo
*
_linphone_core_find_auth_info
(
LinphoneCore
*
lc
,
const
char
*
realm
,
const
char
*
username
,
const
char
*
domain
,
bool_t
ignore_realm
);
void
linphone_core_update_proxy_register
(
LinphoneCore
*
lc
);
void
linphone_core_update_proxy_register
(
LinphoneCore
*
lc
);
void
linphone_core_refresh_subscribes
(
LinphoneCore
*
lc
);
int
linphone_core_abort_call
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
,
const
char
*
error
);
int
linphone_core_abort_call
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
,
const
char
*
error
);
const
char
*
linphone_core_get_nat_address_resolved
(
LinphoneCore
*
lc
);
const
char
*
linphone_core_get_nat_address_resolved
(
LinphoneCore
*
lc
);
...
@@ -657,6 +656,7 @@ struct _LinphoneFriendList {
...
@@ -657,6 +656,7 @@ struct _LinphoneFriendList {
belle_sip_object_t
base
;
belle_sip_object_t
base
;
void
*
user_data
;
void
*
user_data
;
LinphoneCore
*
lc
;
LinphoneCore
*
lc
;
LinphoneEvent
*
event
;
char
*
display_name
;
char
*
display_name
;
char
*
rls_uri
;
char
*
rls_uri
;
MSList
*
friends
;
MSList
*
friends
;
...
...
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