コード例 #1
0
ファイル: friend.c プロジェクト: 42p/linphone
void linphone_friend_save(LinphoneFriend *fr, LinphoneCore *lc) {
	if (!lc) return;
#ifdef SQLITE_STORAGE_ENABLED
	if (lc->friends_db_file) {
		linphone_core_store_friend_in_db(lc, fr);
	} else {
		linphone_core_write_friends_config(lc);
	}
#else
	linphone_core_write_friends_config(lc);
#endif
}
コード例 #2
0
ファイル: friend.c プロジェクト: ringring-io/linphone
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;
}
コード例 #3
0
ファイル: friendlist.c プロジェクト: smking1122/heqinphone
static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t remove_from_server) {
	bctbx_list_t *elem = bctbx_list_find(list->friends, lf);
	if (elem == NULL) return LinphoneFriendListNonExistentFriend;

#ifdef SQLITE_STORAGE_ENABLED
	if (lf && lf->lc && lf->lc->friends_db) {
		linphone_core_remove_friend_from_db(lf->lc, lf);
	}
#endif
	if (remove_from_server) {
		LinphoneVcard *lvc = linphone_friend_get_vcard(lf);
		if (lvc && linphone_vcard_get_uid(lvc)) {
			LinphoneCardDavContext *cdc = linphone_carddav_context_new(list);
			if (cdc) {
				cdc->sync_done_cb = carddav_done;
				if (cdc->friend_list->cbs->sync_state_changed_cb) {
					cdc->friend_list->cbs->sync_state_changed_cb(cdc->friend_list, LinphoneFriendListSyncStarted, NULL);
				}
				linphone_carddav_delete_vcard(cdc, lf);
			}
		}
	}
	if (!list->lc->friends_db_file) {
		linphone_core_write_friends_config(list->lc);
	}

	lf->friend_list = NULL;
	linphone_friend_unref(lf);
	list->friends = bctbx_list_remove_link(list->friends, elem);
	return LinphoneFriendListOK;
}
コード例 #4
0
ファイル: friend.c プロジェクト: ringring-io/linphone
void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key){
	if (lf->refkey!=NULL){
		ms_free(lf->refkey);
		lf->refkey=NULL;
	}
	if (key)
		lf->refkey=ms_strdup(key);
	if (lf->lc)
		linphone_core_write_friends_config(lf->lc);
}
コード例 #5
0
ファイル: friend.c プロジェクト: ringring-io/linphone
void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend* fl){
	MSList *el=ms_list_find(lc->friends,fl);
	if (el!=NULL){
		linphone_friend_destroy((LinphoneFriend*)el->data);
		lc->friends=ms_list_remove_link(lc->friends,el);
		linphone_core_write_friends_config(lc);
	}else{
		ms_error("linphone_core_remove_friend(): friend [%p] is not part of core's list.",fl);
	}
}
コード例 #6
0
ファイル: friend.c プロジェクト: codingtony/linphone
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;
}