Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Fix handling nco affiliation fields
@ 2010-10-29  9:30 Lukasz Pawlik
  2010-10-29 12:46 ` Anderson Lizardo
  2010-10-29 13:53 ` Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Lukasz Pawlik @ 2010-10-29  9:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lukasz Pawlik

Previously when contact record was divided into separate replies,
phonebook-tracker would use first reply and merge only phone numbers,
addresses and emails from next. Now it's merging all fields dependent on the
nco:hasAffiliation as well.
---
 plugins/phonebook-tracker.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index 96290a4..f37ed5a 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -982,6 +982,14 @@ static void add_phone_number(struct phonebook_contact *contact,
 	contact->numbers = g_slist_append(contact->numbers, number);
 }
 
+static void add_affiliation(char **field, const char *value)
+{
+        if(strlen(*field) != 0 || value == NULL || strlen(value) == 0)
+                return;
+
+        *field = g_strdup(value);
+}
+
 static struct phonebook_email *find_email(GSList *emails, const char *address,
 								int type)
 {
@@ -1196,6 +1204,13 @@ add_numbers:
 	g_free(home_addr);
 	g_free(work_addr);
 
+        /* Adding fields connected by nco:hasAffiliation - they may be in
+         * separate replies */
+        add_affiliation(&contact->title, reply[33]);
+        add_affiliation(&contact->company, reply[22]);
+        add_affiliation(&contact->department, reply[23]);
+        add_affiliation(&contact->role, reply[24]);
+
 	DBG("contact %p", contact);
 
 	/* Adding contacts data to wrapper struct - this data will be used to
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-29 13:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-29  9:30 [PATCH] Fix handling nco affiliation fields Lukasz Pawlik
2010-10-29 12:46 ` Anderson Lizardo
2010-10-29 13:53 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox