[PATCH] Added empty VCARD N: parameter handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some of the devices are expecting that N: parameter in VCARD is always filled (by example Nokia BH-903)
When this field is empty (N:;;;;) then list of dialed/incoming calls on carkit is useless - carkit then shows only blank lines and it's impossible to determine who made call ( phone number are invisible too in this case)
    
If none of the contact fields is available, then setting telephone number as the first attribute for "N:" parameter.
Carkit will see that number as contact name - it is only used in case when none of more detailed contact information is available on the phone.

BR,
Radek
From 6d88e3d7c1a5014e60ca8f53f7163e3a51148530 Mon Sep 17 00:00:00 2001
From: Radoslaw Jablonski <ext-jablonski.radoslaw@xxxxxxxxx>
Date: Wed, 7 Jul 2010 15:07:58 +0300
Subject: [PATCH] Added empty N: parameter handling in VCARD

Some of the devices are expecting that N: parameter in VCARD is always filled (by example Nokia BH-903)
When this field is empty (N:;;;;) then list of dialed/incoming calls on carkit is useless.

If none of fields is available then setting telephone number as the first attribute for "N:" parameter.
Carkit will see that number as contact name - it is only used in case when none of more detailed contact information is available on phone.
---
 plugins/vcard.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/plugins/vcard.c b/plugins/vcard.c
index 5948a4a..b2ab30a 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -136,9 +136,20 @@ static void vcard_printf_begin(GString *vcards, uint8_t format)
 static void vcard_printf_name(GString *vcards,
 					struct phonebook_contact *contact)
 {
-	vcard_printf(vcards, "N:%s;%s;%s;%s;%s", contact->family,
-				contact->given, contact->additional,
-				contact->prefix, contact->suffix);
+	/* at least one of fields is present */
+	if ((contact->family && strlen(contact->family)) ||
+		(contact->given && strlen (contact->given)) ||
+		(contact->additional && strlen(contact->additional)) ||
+		(contact->prefix && strlen (contact->prefix)) ||
+		(contact->suffix && strlen (contact->suffix)))
+		vcard_printf(vcards, "N:%s;%s;%s;%s;%s", contact->family,
+						contact->given, contact->additional,
+						contact->prefix, contact->suffix);
+	else {
+		/* if all fields are empty we're using  first phone number as name */
+		struct phonebook_number *number = contact->numbers->data;
+		vcard_printf(vcards, "N:%s;;;;", number->tel);
+	}
 }
 
 static void vcard_printf_fullname(GString *vcards, const char *text)
-- 
1.6.0.4


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux