From 80656964548f1d96c73842c2a94613cc9401e4cb Mon Sep 17 00:00:00 2001 From: Rafal Michalski Date: Wed, 15 Sep 2010 12:18:08 +0200 Subject: [PATCH] obexd: 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). --- obexd/plugins/phonebook-tracker.c | 23 ++++++++++++----------- obexd/plugins/vcard.c | 4 ++++ obexd/plugins/vcard.h | 1 + 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c index 43c2e28f9..316192776 100644 --- a/obexd/plugins/phonebook-tracker.c +++ b/obexd/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/obexd/plugins/vcard.c b/obexd/plugins/vcard.c index e277cedd2..bc22177e3 100644 --- a/obexd/plugins/vcard.c +++ b/obexd/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/obexd/plugins/vcard.h b/obexd/plugins/vcard.h index 0ed51b9ee..d1c225ef2 100644 --- a/obexd/plugins/vcard.h +++ b/obexd/plugins/vcard.h @@ -79,6 +79,7 @@ struct phonebook_contact { char *company; char *department; char *role; + char *title; char *datetime; int calltype; }; -- 2.47.3