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->lc) linphone_friend_update_subscribes(fr,NULL,linphone_core_should_subscribe_friends_only_when_registered(fr->lc)); ms_message("linphone_friend_apply() done."); lc->bl_refresh=TRUE; fr->commit=FALSE; }
static void _linphone_friend_destroy(LinphoneFriend *lf){ _linphone_friend_release_ops(lf); if (lf->presence != NULL) linphone_presence_model_unref(lf->presence); if (lf->uri!=NULL) linphone_address_unref(lf->uri); if (lf->info!=NULL) buddy_info_free(lf->info); if (lf->vcard != NULL) linphone_vcard_free(lf->vcard); }
void linphone_friend_destroy(LinphoneFriend *lf){ if (lf->insub) { sal_op_release(lf->insub); lf->insub=NULL; } if (lf->outsub){ sal_op_release(lf->outsub); lf->outsub=NULL; } if (lf->presence != NULL) linphone_presence_model_unref(lf->presence); if (lf->uri!=NULL) linphone_address_destroy(lf->uri); if (lf->info!=NULL) buddy_info_free(lf->info); ms_free(lf); }
static void linphone_friend_invalidate_subscription(LinphoneFriend *lf){ if (lf->outsub!=NULL) { LinphoneCore *lc=lf->lc; sal_op_release(lf->outsub); lf->outsub=NULL; lf->subscribe_active=FALSE; /*notify application that we no longer know the presence activity */ if (lf->presence != NULL) { linphone_presence_model_unref(lf->presence); } lf->presence = linphone_presence_model_new_with_activity(LinphonePresenceActivityOffline,"unknown activity"); linphone_core_notify_notify_presence_received(lc,lf); } lf->initial_subscribes_sent=FALSE; }
void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc) { LinphonePresenceModel *model; if (!fr->uri) { ms_warning("No sip url defined."); return; } if (!linphone_core_ready(lc)) { /* lc not ready, deffering subscription */ fr->commit=TRUE; return; } 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) linphone_friend_notify(fr, fr->lc->presence_model); break; case LinphoneSPDeny: linphone_friend_notify(fr, NULL); break; } fr->inc_subscribe_pending = FALSE; } if (fr->lc) { linphone_friend_list_update_subscriptions(fr->friend_list, NULL, linphone_core_should_subscribe_friends_only_when_registered(fr->lc)); } ms_debug("linphone_friend_apply() done."); lc->bl_refresh=TRUE; fr->commit=FALSE; }
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; }
void linphone_friend_set_presence_model(LinphoneFriend *lf, LinphonePresenceModel *presence) { if (lf->presence != NULL) { linphone_presence_model_unref(lf->presence); } lf->presence = presence; }