linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add handling of TITLE contact's field in vCard
@ 2010-09-15 10:18 Rafał Michalski
  2010-09-15 12:49 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Rafał Michalski @ 2010-09-15 10:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Rafał Michalski

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0001-Add-handling-of-TITLE-contact-s-field-in-vCard.patch --]
[-- Type: text/x-patch, Size: 5142 bytes --]

From fffde75fb874b9db4afbb51dc0d8d7a72ed04ef0 Mon Sep 17 00:00:00 2001
From: Rafal Michalski <michalski.raf@gmail.com>
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


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

* Re: [PATCH] Add handling of TITLE contact's field in vCard
  2010-09-15 10:18 [PATCH] Add handling of TITLE contact's field in vCard Rafał Michalski
@ 2010-09-15 12:49 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2010-09-15 12:49 UTC (permalink / raw)
  To: Rafał Michalski; +Cc: linux-bluetooth

Hi Rafal,

On Wed, Sep 15, 2010, Rafał Michalski wrote:
> From: Rafal Michalski <michalski.raf@gmail.com>
> 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(-)

Thanks for the patch. It's now upstream.

Johan

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

end of thread, other threads:[~2010-09-15 12:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 10:18 [PATCH] Add handling of TITLE contact's field in vCard Rafał Michalski
2010-09-15 12:49 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).