Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
void linphone_friend_list_notify_presence(LinphoneFriendList *list, LinphonePresenceModel *presence) {
	const bctbx_list_t *elem;
	for(elem = list->friends; elem != NULL; elem = elem->next) {
		LinphoneFriend *lf = (LinphoneFriend *)elem->data;
		linphone_friend_notify(lf, presence);
	}
}
Ejemplo n.º 3
0
void linphone_core_notify_all_friends(LinphoneCore *lc, LinphoneOnlineStatus os){
	MSList *elem;
	ms_message("Notifying all friends that we are in status %i",os);
	for(elem=lc->friends;elem!=NULL;elem=elem->next){
		LinphoneFriend *lf=(LinphoneFriend *)elem->data;
		if (lf->insub){
			linphone_friend_notify(lf,os);
		}
	}
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
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;
}