void linphone_friend_close_subscriptions(LinphoneFriend *lf){ linphone_friend_unsubscribe(lf); if (lf->insub){ sal_notify_presence_close(lf->insub); } }
void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc){ LinphonePresenceModel *model; if (fr->uri==NULL) { ms_warning("No sip url defined."); return; } linphone_core_write_friends_config(lc); if (fr->inc_subscribe_pending){ switch(fr->pol){ case LinphoneSPWait: model = linphone_presence_model_new_with_activity(LinphonePresenceActivityOther, "Waiting for user acceptance"); linphone_friend_notify(fr,model); linphone_presence_model_unref(model); break; case LinphoneSPAccept: if (fr->lc!=NULL) linphone_friend_notify(fr,fr->lc->presence_model); break; case LinphoneSPDeny: linphone_friend_notify(fr,NULL); break; } fr->inc_subscribe_pending=FALSE; } if (fr->subscribe && fr->subscribe_active==FALSE){ ms_message("Sending a new SUBSCRIBE"); __linphone_friend_do_subscribe(fr); }else if (fr->subscribe_active && !fr->subscribe){ linphone_friend_unsubscribe(fr); } ms_message("linphone_friend_apply() done."); lc->bl_refresh=TRUE; fr->commit=FALSE; }
/* * updates the subscriptions. * If only_when_registered is TRUE, subscribe will be sent only if the friend's corresponding proxy config is in registered. * Otherwise if the proxy config goes to unregistered state, the subscription refresh will be suspended. * An optional proxy whose state has changed can be passed to optimize the processing. **/ void linphone_friend_update_subscribes(LinphoneFriend *fr, LinphoneProxyConfig *proxy, bool_t only_when_registered){ int can_subscribe=1; if (only_when_registered && (fr->subscribe || fr->subscribe_active)){ LinphoneProxyConfig *cfg=linphone_core_lookup_known_proxy(fr->lc,fr->uri); if (proxy && proxy!=cfg) return; if (cfg && cfg->state!=LinphoneRegistrationOk){ char *tmp=linphone_address_as_string(fr->uri); ms_message("Friend [%s] belongs to proxy config with identity [%s], but this one isn't registered. Subscription is suspended.", tmp,linphone_proxy_config_get_identity(cfg)); ms_free(tmp); can_subscribe=0; } } if (can_subscribe && fr->subscribe && fr->subscribe_active==FALSE){ ms_message("Sending a new SUBSCRIBE"); __linphone_friend_do_subscribe(fr); }else if (can_subscribe && fr->subscribe_active && !fr->subscribe){ linphone_friend_unsubscribe(fr); }else if (!can_subscribe && fr->outsub){ fr->subscribe_active=FALSE; sal_op_stop_refreshing(fr->outsub); } }
void linphone_friend_close_subscriptions(LinphoneFriend *lf){ linphone_friend_unsubscribe(lf); bctbx_list_for_each(lf->insubs, (MSIterateFunc) sal_notify_presence_close); lf->insubs = bctbx_list_free_with_data(lf->insubs, (MSIterateFunc)sal_op_release); }