Example #1
0
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;
}
Example #2
0
void sal_remove_supported_tag(Sal *ctx, const char* tag){
	bctbx_list_t *elem=bctbx_list_find_custom(ctx->supported_tags,(bctbx_compare_func)strcasecmp,tag);
	if (elem){
		ms_free(elem->data);
		ctx->supported_tags=bctbx_list_remove_link(ctx->supported_tags,elem);
		make_supported_header(ctx);
	}
}
Example #3
0
static void remove_tasks_for_filter(MSTicker *ticker, MSFilter *f){
	bctbx_list_t *elem,*nextelem;
	for (elem=ticker->task_list;elem!=NULL;elem=nextelem){
		MSFilterTask *t=(MSFilterTask*)elem->data;
		nextelem=elem->next;
		if (t->f==f){
			ticker->task_list=bctbx_list_remove_link(ticker->task_list,elem);
			ms_free(t);
		}
	}
}
Example #4
0
static unsigned int linphone_ldap_contact_provider_cancel_search(LinphoneContactProvider* obj, LinphoneContactSearch *req)
{
	LinphoneLDAPContactSearch*  ldap_req = LINPHONE_LDAP_CONTACT_SEARCH(req);
	LinphoneLDAPContactProvider* ldap_cp = LINPHONE_LDAP_CONTACT_PROVIDER(obj);
	int ret = 1;

	bctbx_list_t* list_entry = bctbx_list_find_custom(ldap_cp->requests, linphone_ldap_request_entry_compare_strong, req);
	if( list_entry ) {
		ms_message("Delete search %p", req);
		ldap_cp->requests = bctbx_list_remove_link(ldap_cp->requests, list_entry);
		ldap_cp->req_count--;
		ret = 0; // return OK if we found it in the monitored requests
	} else {
		ms_warning("Couldn't find ldap request %p (id %d) in monitoring.", ldap_req, ldap_req->msgid);
	}
	belle_sip_object_unref(req); // unref request even if not found
	return ret;
}