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
23397e26
Commit
23397e26
authored
Apr 25, 2016
by
Gautier Pelloux-Prayer
Browse files
friendlist: add linphone_friend_list_enable_subscriptions API
parent
29230187
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
11 deletions
+30
-11
coreapi/friend.c
coreapi/friend.c
+2
-1
coreapi/friendlist.c
coreapi/friendlist.c
+19
-7
coreapi/friendlist.h
coreapi/friendlist.h
+7
-2
coreapi/linphonecore.c
coreapi/linphonecore.c
+1
-1
coreapi/private.h
coreapi/private.h
+1
-0
No files found.
coreapi/friend.c
View file @
23397e26
...
...
@@ -387,8 +387,9 @@ void linphone_friend_remove_incoming_subscription(LinphoneFriend *lf, SalOp *op)
static
void
linphone_friend_unsubscribe
(
LinphoneFriend
*
lf
){
if
(
lf
->
outsub
!=
NULL
)
{
sal_unsubscribe
(
lf
->
outsub
);
lf
->
subscribe_active
=
FALSE
;
}
/* for friend list there is no necessary outsub*/
lf
->
subscribe_active
=
FALSE
;
}
void
linphone_friend_invalidate_subscription
(
LinphoneFriend
*
lf
){
...
...
coreapi/friendlist.c
View file @
23397e26
...
...
@@ -285,6 +285,7 @@ static bool_t linphone_friend_list_has_subscribe_inactive(const LinphoneFriendLi
static
LinphoneFriendList
*
linphone_friend_list_new
(
void
)
{
LinphoneFriendList
*
list
=
belle_sip_object_new
(
LinphoneFriendList
);
list
->
cbs
=
linphone_friend_list_cbs_new
();
list
->
enable_subscriptions
=
FALSE
;
belle_sip_object_ref
(
list
);
return
list
;
}
...
...
@@ -541,12 +542,12 @@ static void carddav_updated(LinphoneCardDavContext *cdc, LinphoneFriend *lf_new,
void
linphone_friend_list_synchronize_friends_from_server
(
LinphoneFriendList
*
list
)
{
LinphoneCardDavContext
*
cdc
=
NULL
;
if
(
!
list
||
!
list
->
uri
||
!
list
->
lc
)
{
ms_error
(
"FATAL"
);
return
;
}
cdc
=
linphone_carddav_context_new
(
list
);
if
(
cdc
)
{
cdc
->
contact_created_cb
=
carddav_created
;
...
...
@@ -606,19 +607,19 @@ LinphoneFriend * linphone_friend_list_find_friend_by_out_subscribe(const Linphon
return
NULL
;
}
void
linphone_friend_list_close_subscriptions
(
LinphoneFriendList
*
list
)
{
/* FIXME we should wait until subscription to complete. */
static
void
linphone_friend_list_close_subscriptions
(
LinphoneFriendList
*
list
)
{
/* FIXME we should wait until subscription to complete. */
if
(
list
->
event
)
{
linphone_event_terminate
(
list
->
event
);
linphone_event_unref
(
list
->
event
);
list
->
event
=
NULL
;
}
else
if
(
list
->
friends
)
ms_list_for_each
(
list
->
friends
,
(
void
(
*
)(
void
*
))
linphone_friend_close_subscriptions
);
}
ms_list_for_each
(
list
->
friends
,
(
void
(
*
)(
void
*
))
linphone_friend_close_subscriptions
);
}
void
linphone_friend_list_update_subscriptions
(
LinphoneFriendList
*
list
,
LinphoneProxyConfig
*
cfg
,
bool_t
only_when_registered
)
{
const
MSList
*
elem
;
if
(
list
->
rls_uri
!=
NULL
)
{
if
(
list
->
enable_subscriptions
&&
list
->
rls_uri
!=
NULL
)
{
LinphoneAddress
*
address
=
linphone_address_new
(
list
->
rls_uri
);
char
*
xml_content
=
create_resource_list_xml
(
list
);
if
((
address
!=
NULL
)
&&
(
xml_content
!=
NULL
)
&&
(
linphone_friend_list_has_subscribe_inactive
(
list
)
==
TRUE
))
{
...
...
@@ -852,3 +853,14 @@ void linphone_friend_list_export_friends_as_vcard4_file(LinphoneFriendList *list
fclose
(
file
);
}
void
linphone_friend_list_enable_subscriptions
(
LinphoneFriendList
*
list
,
bool_t
enabled
)
{
if
(
list
->
enable_subscriptions
!=
enabled
)
{
if
(
enabled
)
{
linphone_friend_list_update_subscriptions
(
list
,
NULL
,
TRUE
);
}
else
{
linphone_friend_list_close_subscriptions
(
list
);
}
list
->
enable_subscriptions
=
enabled
;
}
}
coreapi/friendlist.h
View file @
23397e26
...
...
@@ -209,8 +209,6 @@ LINPHONE_PUBLIC LinphoneFriend * linphone_friend_list_find_friend_by_uri(const L
**/
LINPHONE_PUBLIC
LinphoneFriend
*
linphone_friend_list_find_friend_by_ref_key
(
const
LinphoneFriendList
*
list
,
const
char
*
ref_key
);
LINPHONE_PUBLIC
void
linphone_friend_list_close_subscriptions
(
LinphoneFriendList
*
list
);
LINPHONE_PUBLIC
void
linphone_friend_list_update_subscriptions
(
LinphoneFriendList
*
list
,
LinphoneProxyConfig
*
cfg
,
bool_t
only_when_registered
);
/**
...
...
@@ -408,6 +406,13 @@ LINPHONE_PUBLIC int linphone_friend_list_import_friends_from_vcard4_buffer(Linph
*/
LINPHONE_PUBLIC
void
linphone_friend_list_export_friends_as_vcard4_file
(
LinphoneFriendList
*
list
,
const
char
*
vcard_file
);
/**
* Enable subscription to NOTIFYes of all friends list
* @param[in] list the LinphoneFriendList object
* @param[in] enabled should subscription be enabled or not
*/
LINPHONE_PUBLIC
void
linphone_friend_list_enable_subscriptions
(
LinphoneFriendList
*
list
,
bool_t
enabled
);
/**
* @}
*/
...
...
coreapi/linphonecore.c
View file @
23397e26
...
...
@@ -6559,7 +6559,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
for
(
elem
=
lc
->
friends_lists
;
elem
!=
NULL
;
elem
=
ms_list_next
(
elem
))
{
LinphoneFriendList
*
list
=
(
LinphoneFriendList
*
)
elem
->
data
;
linphone_friend_list_
clos
e_subscriptions
(
list
);
linphone_friend_list_
enabl
e_subscriptions
(
list
,
FALSE
);
if
(
list
->
event
)
wait_until_unsubscribe
=
TRUE
;
}
...
...
coreapi/private.h
View file @
23397e26
...
...
@@ -729,6 +729,7 @@ struct _LinphoneFriendList {
MSList
*
dirty_friends_to_update
;
int
revision
;
LinphoneFriendListCbs
*
cbs
;
bool_t
enable_subscriptions
;
};
BELLE_SIP_DECLARE_VPTR
(
LinphoneFriendList
);
...
...
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