bctbx_list_t *bctbx_list_delete_custom(bctbx_list_t *list, bctbx_compare_func compare_func, const void *user_data) {
    bctbx_list_t *elem=bctbx_list_find_custom(list,compare_func,user_data);
    if (elem!=NULL) {
        list=bctbx_list_erase_link(list,elem);
    }
    return list;
}
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
void sal_add_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){
		ctx->supported_tags=bctbx_list_append(ctx->supported_tags,ms_strdup(tag));
		make_supported_header(ctx);
	}

}
Example #4
0
bctbx_list_t *linphone_find_friend_by_address(bctbx_list_t *fl, const LinphoneAddress *addr, LinphoneFriend **lf){
	bctbx_list_t *res=NULL;
	LinphoneFriend dummy;
	if (lf!=NULL) *lf=NULL;
	dummy.uri=(LinphoneAddress*)addr;
	res=bctbx_list_find_custom(fl,friend_compare,&dummy);
	if (lf!=NULL && res!=NULL) *lf=(LinphoneFriend*)res->data;
	return res;
}
Example #5
0
static inline LinphoneLDAPContactSearch* linphone_ldap_contact_provider_request_search( LinphoneLDAPContactProvider* obj, int msgid )
{
	LinphoneLDAPContactSearch dummy = {};
	bctbx_list_t* list_entry;
	dummy.msgid = msgid;

	list_entry = bctbx_list_find_custom(obj->requests, linphone_ldap_request_entry_compare_weak, &dummy);
	if( list_entry ) return list_entry->data;
	else return NULL;
}
Example #6
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;
}