diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c
index e64a3f2..18c6fc5 100644
--- a/obexd/plugins/phonebook-tracker.c
+++ b/obexd/plugins/phonebook-tracker.c
{
struct cache_data *cache = user_data;
char *formatted;
+ int i;
if (reply == NULL)
goto done;
- formatted = g_strdup_printf("%s;%s;%s;%s;%s", reply[1], reply[2],
- reply[3], reply[4], reply[5]);
+ for (i = 1; i < 6; i++)
+ if (reply[i][0] != '\0') {
+ formatted = g_strdup_printf("%s;%s;%s;%s;%s",
+ reply[1], reply[2], reply[3], reply[4],
+ reply[5]);
+ break;
+ }
+
+ if (i == 6)
+ formatted = g_strdup(reply[6]);
/* The owner vCard must have the 0 handle */
if (strcmp(reply[0], TRACKER_DEFAULT_CONTACT_ME) == 0)
diff --git a/obexd/plugins/vcard.c b/obexd/plugins/vcard.c
index 4a128ed..dc6e283 100644
--- a/obexd/plugins/vcard.c
+++ b/obexd/plugins/vcard.c
vcard_printf_begin(vcards, format);
- if (filter & FILTER_FN) {
- char* fullname;
- if (contact->fullname == NULL || contact->fullname[0] == '\0') {
- struct phonebook_number *number;
-
- number = contact->numbers->data;
- fullname = number->tel;
- } else
- fullname = contact->fullname;
-
- vcard_printf_fullname(vcards, fullname);
- }
-
if (filter & FILTER_TEL) {
GSList *l;
if (filter & FILTER_N)
vcard_printf_name(vcards, contact);
+ if (filter & FILTER_FN)
+ vcard_printf_fullname(vcards, contact->fullname);
+
if (filter & FILTER_EMAIL)
vcard_printf_email(vcards, contact->email);