X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=filter.c;h=ff3e511872f0e2bd3619680fa67c70de7699eff4;hb=9ccd2453b5a55c7bccae5de1e1022947c7ff889a;hp=1c96a8896ca974e115e0616a224eb2858b682e98;hpb=6e4a7610dcb671089f011061603a6bc7c604881d;p=pkg%2Fabook.git diff --git a/filter.c b/filter.c index 1c96a88..ff3e511 100644 --- a/filter.c +++ b/filter.c @@ -29,6 +29,10 @@ #include "xmalloc.h" #include +#ifdef HAVE_VFORMAT +#include "vcard.h" +#endif + extern abook_field_list *fields_list; extern int fields_count; @@ -293,6 +297,18 @@ import_file(char filtname[FILTNAME_LEN], char *filename) if(i < 0) return -1; +#ifdef HAVE_VFORMAT + // this is a special case for + // libvformat whose API expects a filename + if(!strcmp(filtname, "vcard")) { + if(!strcmp(filename, "-")) + ret = vcard_parse_file_libvformat("/dev/stdin"); + else + ret = vcard_parse_file_libvformat(filename); + } + else +#endif + if(!strcmp(filename, "-")) { struct stat s; if((fstat(fileno(stdin), &s)) == -1 || S_ISDIR(s.st_mode)) @@ -615,8 +631,8 @@ ldif_convert(ldif_item item, char *type, char *value) } for(i=0; i < LDIF_ITEM_FIELDS; i++) { - if(!safe_strcmp(ldif_field_names[i], type) && *value) { - if(i == LDIF_ITEM_FIELDS - 1) /* this is a dirty hack */ + if(!strcasecmp(ldif_field_names[i], type) && *value) { + if(i == LDIF_ITEM_FIELDS - 1) /* this is a dirty hack */ if(safe_strcmp("person", value)) break; @@ -624,6 +640,7 @@ ldif_convert(ldif_item item, char *type, char *value) free(item_fget(item, i)); item_fput(item, i, xstrdup(value)); + break; } } }