Commit 04f704aa authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed two potential issues with presence

parent 0265fb11
...@@ -825,6 +825,17 @@ LinphoneFriend *linphone_core_find_friend_by_out_subscribe(const LinphoneCore *l ...@@ -825,6 +825,17 @@ LinphoneFriend *linphone_core_find_friend_by_out_subscribe(const LinphoneCore *l
return lf; return lf;
} }
LinphoneFriend *linphone_core_find_friend_by_inc_subscribe(const LinphoneCore *lc, SalOp *op) {
MSList *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_inc_subscribe(list, op);
lists = ms_list_next(lists);
}
return lf;
}
#define key_compare(s1,s2) strcmp(s1,s2) #define key_compare(s1,s2) strcmp(s1,s2)
LinphoneSubscribePolicy __policy_str_to_enum(const char* pol){ LinphoneSubscribePolicy __policy_str_to_enum(const char* pol){
......
...@@ -1509,9 +1509,7 @@ void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){ ...@@ -1509,9 +1509,7 @@ void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){
ms_message("Receiving new subscription from %s.",from); ms_message("Receiving new subscription from %s.",from);
/* check if we answer to this subscription */ /* check if we answer to this subscription */
if (linphone_core_get_default_friend_list(lc) != NULL) { lf = linphone_core_find_friend(lc, uri);
lf = linphone_friend_list_find_friend_by_address(linphone_core_get_default_friend_list(lc), uri);
}
if (lf!=NULL){ if (lf!=NULL){
linphone_friend_add_incoming_subscription(lf, op); linphone_friend_add_incoming_subscription(lf, op);
lf->inc_subscribe_pending=TRUE; lf->inc_subscribe_pending=TRUE;
...@@ -1938,8 +1936,7 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa ...@@ -1938,8 +1936,7 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa
void linphone_subscription_closed(LinphoneCore *lc, SalOp *op){ void linphone_subscription_closed(LinphoneCore *lc, SalOp *op){
LinphoneFriend *lf = NULL; LinphoneFriend *lf = NULL;
if (linphone_core_get_default_friend_list(lc) != NULL) lf = linphone_core_find_friend_by_inc_subscribe(lc, op);
lf = linphone_friend_list_find_friend_by_inc_subscribe(linphone_core_get_default_friend_list(lc), op);
if (lf!=NULL){ if (lf!=NULL){
/*this will release the op*/ /*this will release the op*/
......
...@@ -422,6 +422,7 @@ void linphone_friend_remove_incoming_subscription(LinphoneFriend *lf, SalOp *op) ...@@ -422,6 +422,7 @@ void linphone_friend_remove_incoming_subscription(LinphoneFriend *lf, SalOp *op)
LinphoneFriend *linphone_friend_list_find_friend_by_inc_subscribe(const LinphoneFriendList *list, SalOp *op); LinphoneFriend *linphone_friend_list_find_friend_by_inc_subscribe(const LinphoneFriendList *list, SalOp *op);
LinphoneFriend *linphone_friend_list_find_friend_by_out_subscribe(const LinphoneFriendList *list, SalOp *op); LinphoneFriend *linphone_friend_list_find_friend_by_out_subscribe(const LinphoneFriendList *list, SalOp *op);
LinphoneFriend *linphone_core_find_friend_by_out_subscribe(const LinphoneCore *lc, SalOp *op); LinphoneFriend *linphone_core_find_friend_by_out_subscribe(const LinphoneCore *lc, SalOp *op);
LinphoneFriend *linphone_core_find_friend_by_inc_subscribe(const LinphoneCore *lc, SalOp *op);
MSList *linphone_find_friend_by_address(MSList *fl, const LinphoneAddress *addr, LinphoneFriend **lf); MSList *linphone_find_friend_by_address(MSList *fl, const LinphoneAddress *addr, LinphoneFriend **lf);
bool_t linphone_core_should_subscribe_friends_only_when_registered(const LinphoneCore *lc); bool_t linphone_core_should_subscribe_friends_only_when_registered(const LinphoneCore *lc);
void linphone_core_update_friends_subscriptions(LinphoneCore *lc, LinphoneProxyConfig *cfg, bool_t only_when_registered); void linphone_core_update_friends_subscriptions(LinphoneCore *lc, LinphoneProxyConfig *cfg, bool_t only_when_registered);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment