X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=filter.c;h=a22d69edf3bd94c82585b6415d5783449033c44a;hb=f214e4ab8782ed6bba5248aad9d39889e273968f;hp=7966f7e8e38d174a44806c068fd73d1602c6b24a;hpb=84133598d00157f8129b99f4885171539bbfa8f5;p=pkg%2Fabook.git diff --git a/filter.c b/filter.c index 7966f7e..a22d69e 100644 --- a/filter.c +++ b/filter.c @@ -1509,32 +1509,25 @@ vcard_parse_name(list_item item, char *line) static void vcard_parse_phone(list_item item, char *line) { - int index = 8; char *type = vcard_get_line_element(line, VCARD_KEY_ATTRIBUTE); char *value = vcard_get_line_element(line, VCARD_VALUE); /* set the standard number */ - if (!type) { - item[index] = value; - } + if (!type) item_fput(item, PHONE, value); /* * see rfc2426 section 3.3.1 * Note: we probably support both vCard 2 and 3 */ else { - if (strcasestr(type, "home") != NULL) { - item[index] = xstrdup(value); - } - if (strcasestr(type, "work") != NULL) { - item[index+1] = xstrdup(value); - } - if (strcasestr(type, "fax") != NULL) { - item[index+2] = xstrdup(value); - } - if (strcasestr(type, "cell") != NULL) { - item[index+3] = xstrdup(value); - } + if (strcasestr(type, "home") != NULL) + item_fput(item, PHONE, xstrdup(value)); + else if (strcasestr(type, "work") != NULL) + item_fput(item, WORKPHONE, xstrdup(value)); + else if (strcasestr(type, "fax") != NULL) + item_fput(item, FAX, xstrdup(value)); + else if (strcasestr(type, "cell") != NULL) + item_fput(item, MOBILEPHONE, xstrdup(value)); xfree(type); xfree(value);