[PATCH] Add handling of TITLE contact's field in vCard

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

 



From fffde75fb874b9db4afbb51dc0d8d7a72ed04ef0 Mon Sep 17 00:00:00 2001
From: Rafal Michalski <michalski.raf@xxxxxxxxx>
Date: Wed, 15 Sep 2010 09:16:11 +0200
Subject: [PATCH] Add handling of TITLE contact's field in vCard

After pulling contacts this field wasn't presented in downloaded vCard
structure in spite of that it existed (not empty). Now it shows downloaded
TITLE field (using database query).
---
 plugins/phonebook-tracker.c |   23 ++++++++++++-----------
 plugins/vcard.c             |    4 ++++
 plugins/vcard.h             |    1 +
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index 43c2e28..3161927 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -43,16 +43,16 @@
 #define TRACKER_RESOURCES_INTERFACE "org.freedesktop.Tracker1.Resources"
 
 #define TRACKER_DEFAULT_CONTACT_ME "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#default-contact-me";
-#define CONTACTS_ID_COL 36
-#define PULL_QUERY_COL_AMOUNT 37
+#define CONTACTS_ID_COL 37
+#define PULL_QUERY_COL_AMOUNT 38
 #define COL_HOME_NUMBER 0
 #define COL_HOME_EMAIL 7
 #define COL_WORK_NUMBER 8
 #define COL_FAX_NUMBER 16
 #define COL_WORK_EMAIL 17
-#define COL_DATE 33
-#define COL_SENT 34
-#define COL_ANSWERED 35
+#define COL_DATE 34
+#define COL_SENT 35
+#define COL_ANSWERED 36
 #define ADDR_FIELD_AMOUNT 7
 
 #define CONTACTS_QUERY_ALL						\
@@ -68,7 +68,7 @@
 	"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) "		\
 	"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) "	\
 	"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(?c) "	\
-	"\"NOTACALL\" \"false\" \"false\" ?c "				\
+	"nco:title(?a) \"NOTACALL\" \"false\" \"false\" ?c "		\
 	"WHERE { "							\
 		"?c a nco:PersonContact . "				\
 	"OPTIONAL { ?c nco:hasPhoneNumber ?h . 				\
@@ -119,7 +119,7 @@
 	"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) "		\
 	"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) "	\
 	"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(?c) "	\
-	"nmo:receivedDate(?call) "					\
+	"nco:title(?a) nmo:receivedDate(?call) "			\
 	"nmo:isSent(?call) nmo:isAnswered(?call) ?c "			\
 	"WHERE { "							\
 		"?call a nmo:Call ; "					\
@@ -171,7 +171,7 @@
 	"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) "		\
 	"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) "	\
 	"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(?c) "	\
-	"nmo:receivedDate(?call) "					\
+	"nco:title(?a) nmo:receivedDate(?call) "			\
 	"nmo:isSent(?call) nmo:isAnswered(?call) ?c "			\
 	"WHERE { "							\
 		"?call a nmo:Call ; "					\
@@ -223,7 +223,7 @@
 	"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) "		\
 	"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) "	\
 	"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(?c) "	\
-	"nmo:receivedDate(?call) "					\
+	"nco:title(?a) nmo:receivedDate(?call) "			\
 	"nmo:isSent(?call) nmo:isAnswered(?call) ?c "			\
 	"WHERE { "							\
 		"?call a nmo:Call ; "					\
@@ -273,7 +273,7 @@
 	"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) "		\
 	"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) "	\
 	"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(?c) "	\
-	"nmo:receivedDate(?call) "					\
+	"nco:title(?a) nmo:receivedDate(?call) "			\
 	"nmo:isSent(?call) nmo:isAnswered(?call) ?c "			\
 	"WHERE { "							\
 	"{ "								\
@@ -349,7 +349,7 @@
 	"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) "		\
 	"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) "	\
 	"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(<%s>) "	\
-	"\"NOTACALL\" \"false\" \"false\" <%s> "			\
+	"nco:title(?a) \"NOTACALL\" \"false\" \"false\" <%s> "		\
 	"WHERE { "							\
 		"<%s> a nco:Contact . "					\
 	"OPTIONAL { <%s> nco:hasPhoneNumber ?h . 			\
@@ -865,6 +865,7 @@ add_entry:
 	contact->department = g_strdup(reply[23]);
 	contact->role = g_strdup(reply[24]);
 	contact->uid = g_strdup(reply[32]);
+	contact->title = g_strdup(reply[33]);
 
 	set_call_type(contact, reply[COL_DATE], reply[COL_SENT],
 			reply[COL_ANSWERED]);
diff --git a/plugins/vcard.c b/plugins/vcard.c
index e277ced..bc22177 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -539,6 +539,9 @@ void phonebook_add_contact(GString *vcards, struct phonebook_contact *contact,
 	if (filter & FILTER_ROLE)
 		vcard_printf_tag(vcards, format, "ROLE", NULL, contact->role);
 
+	if (filter & FILTER_TITLE)
+		vcard_printf_tag(vcards, format, "TITLE", NULL, contact->title);
+
 	if (filter & FILTER_X_IRMC_CALL_DATETIME)
 		vcard_printf_datetime(vcards, contact);
 
@@ -597,6 +600,7 @@ void phonebook_contact_free(struct phonebook_contact *contact)
 	g_free(contact->company);
 	g_free(contact->department);
 	g_free(contact->role);
+	g_free(contact->title);
 	g_free(contact->datetime);
 	g_free(contact);
 }
diff --git a/plugins/vcard.h b/plugins/vcard.h
index 0ed51b9..d1c225e 100644
--- a/plugins/vcard.h
+++ b/plugins/vcard.h
@@ -79,6 +79,7 @@ struct phonebook_contact {
 	char *company;
 	char *department;
 	char *role;
+	char *title;
 	char *datetime;
 	int calltype;
 };
-- 
1.6.3.3


[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