Commit fd9fbedb authored by François Grisez's avatar François Grisez

Fix regression about P2P presence

Denying a friend to subscribe presence was no more possible
once we accepted.
parent 605fd462
...@@ -464,12 +464,16 @@ void linphone_friend_invalidate_subscription(LinphoneFriend *lf){ ...@@ -464,12 +464,16 @@ void linphone_friend_invalidate_subscription(LinphoneFriend *lf){
lf->initial_subscribes_sent=FALSE; lf->initial_subscribes_sent=FALSE;
} }
void linphone_friend_close_subscriptions(LinphoneFriend *lf){ static void linphone_friend_close_incoming_subscriptions(LinphoneFriend *lf) {
linphone_friend_unsubscribe(lf);
bctbx_list_for_each(lf->insubs, (MSIterateFunc) sal_notify_presence_close); bctbx_list_for_each(lf->insubs, (MSIterateFunc) sal_notify_presence_close);
lf->insubs = bctbx_list_free_with_data(lf->insubs, (MSIterateFunc)sal_op_release); lf->insubs = bctbx_list_free_with_data(lf->insubs, (MSIterateFunc)sal_op_release);
} }
void linphone_friend_close_subscriptions(LinphoneFriend *lf){
linphone_friend_unsubscribe(lf);
linphone_friend_close_incoming_subscriptions(lf);
}
static void _linphone_friend_release_ops(LinphoneFriend *lf){ static void _linphone_friend_release_ops(LinphoneFriend *lf){
lf->insubs = bctbx_list_free_with_data(lf->insubs, (MSIterateFunc) sal_op_release); lf->insubs = bctbx_list_free_with_data(lf->insubs, (MSIterateFunc) sal_op_release);
if (lf->outsub){ if (lf->outsub){
...@@ -744,6 +748,10 @@ void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc) { ...@@ -744,6 +748,10 @@ void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc) {
} }
fr->inc_subscribe_pending = FALSE; fr->inc_subscribe_pending = FALSE;
} }
if (fr->pol == LinphoneSPDeny && fr->insubs) {
linphone_friend_close_incoming_subscriptions(fr);
}
linphone_friend_update_subscribes(fr, linphone_core_should_subscribe_friends_only_when_registered(lc)); linphone_friend_update_subscribes(fr, linphone_core_should_subscribe_friends_only_when_registered(lc));
......
...@@ -1551,12 +1551,17 @@ void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){ ...@@ -1551,12 +1551,17 @@ void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){
/* check if we answer to this subscription */ /* check if we answer to this subscription */
lf = linphone_core_find_friend(lc, uri); lf = linphone_core_find_friend(lc, uri);
if (lf!=NULL){ if (lf!=NULL){
linphone_friend_add_incoming_subscription(lf, op); if (lf->pol != LinphoneSPDeny) {
lf->inc_subscribe_pending=TRUE; linphone_friend_add_incoming_subscription(lf, op);
if (lp_config_get_int(lc->config,"sip","notify_pending_state",0)) { lf->inc_subscribe_pending=TRUE;
sal_notify_pending_state(op); if (lp_config_get_int(lc->config,"sip","notify_pending_state",0)) {
sal_notify_pending_state(op);
}
sal_subscribe_accept(op);
} else {
ms_message("%s is not authorized to subscribe", from);
sal_subscribe_decline(op, SalReasonDeclined);
} }
sal_subscribe_accept(op);
linphone_friend_done(lf); /*this will do all necessary actions */ linphone_friend_done(lf); /*this will do all necessary actions */
}else{ }else{
/* check if this subscriber is in our black list */ /* check if this subscriber is in our black list */
......
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