diff options
author | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2010-06-02 21:01:11 -0300 |
---|---|---|
committer | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2010-06-02 21:01:11 -0300 |
commit | a750fbbc75d2d30a26d3f6804142709b0e85b67f (patch) | |
tree | c771476926ad9bee35e1aed9dcd14caa3dc0410c | |
parent | 2fa5bbdd8b199c78c9ff4c38e2e5b3f83973612c (diff) | |
download | obexd-a750fbbc75d2d30a26d3f6804142709b0e85b67f.tar.gz |
Fix inconsistency when using vCard version 2.1
With vCard version 2.1 the type prefix to parameter values is
optional, so the client implementation may not be able to parse
it.
-rw-r--r-- | plugins/vcard.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/vcard.c b/plugins/vcard.c index 6c2445c..9d7e6ea 100644 --- a/plugins/vcard.c +++ b/plugins/vcard.c @@ -148,7 +148,8 @@ static void vcard_printf_fullname(GString *vcards, const char *text) vcard_printf(vcards, "FN:%s", field); } -static void vcard_printf_number(GString *vcards, const char *number, int type, +static void vcard_printf_number(GString *vcards, uint8_t format, + const char *number, int type, enum phonebook_number_type category) { char *pref = "", *intl = "", *category_string = ""; @@ -178,8 +179,13 @@ static void vcard_printf_number(GString *vcards, const char *number, int type, if ((type == TYPE_INTERNATIONAL) && (number[0] != '+')) intl = "+"; - snprintf(buf, sizeof(buf), "TEL;TYPE=\%s%s:\%s\%s", pref, - category_string, intl, number); + if (format == FORMAT_VCARD30) + snprintf(buf, sizeof(buf), "TEL;TYPE=\%s%s:\%s\%s", pref, + category_string, intl, number); + else if (format == FORMAT_VCARD21) + snprintf(buf, sizeof(buf), "TEL;\%s%s:\%s\%s", pref, + category_string, intl, number); + vcard_printf(vcards, buf, number); } @@ -246,7 +252,7 @@ void phonebook_add_contact(GString *vcards, struct phonebook_contact *contact, for (l = contact->numbers; l; l = l->next) { struct phonebook_number *number = l->data; - vcard_printf_number(vcards, number->tel, 1, + vcard_printf_number(vcards, format, number->tel, 1, number->type); } } |