Diff between 26fab96849ed8deabda03fe4e5be6b9db433ed42 and abcdcfeb537fa40b9925ec20a2e8159e76ae67ec

Changed Files

File Additions Deletions Status
obexd/plugins/phonebook-tracker.c +11 -2 modified
obexd/plugins/vcard.c +3 -13 modified

Full Patch

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
@@ -558,12 +558,21 @@ static void add_to_cache(char **reply, int num_fields, void *user_data)
 {
 	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
@@ -236,19 +236,6 @@ void phonebook_add_contact(GString *vcards, struct phonebook_contact *contact,
 
 	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;
 
@@ -263,6 +250,9 @@ void phonebook_add_contact(GString *vcards, struct phonebook_contact *contact,
 	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);