* [PATCH] Provide extra query for vCard single call
@ 2010-10-25 9:04 Rafal Michalski
2010-10-25 16:26 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Rafal Michalski @ 2010-10-25 9:04 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Rafal Michalski
This patch makes that additional circumstance is recognized - after
making a call with number that is out of phonebook it can be downloaded
as a single vCard containing number with OTHER type.
---
plugins/phonebook-tracker.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index 1c579d1..f25708a 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -55,6 +55,7 @@
#define COL_SENT 36
#define COL_ANSWERED 37
#define ADDR_FIELD_AMOUNT 7
+#define CONTACT_ID_PREFIX "contact:"
#define CONTACTS_QUERY_ALL \
"SELECT ?v nco:fullname(?c) " \
@@ -569,6 +570,16 @@
"} " \
"}"
+#define CONTACTS_OTHER_QUERY_FROM_URI \
+ "SELECT \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" "\
+ "\"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" " \
+ "\"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" " \
+ "nco:phoneNumber(?t) \"NOTACALL\" \"false\" \"false\" <%s> " \
+ "WHERE { " \
+ "<%s> a nco:Contact . " \
+ "<%s> nco:hasPhoneNumber ?t . " \
+ "} "
+
typedef void (*reply_list_foreach_t) (char **reply, int num_fields,
void *user_data);
@@ -1305,9 +1316,14 @@ int phonebook_get_entry(const char *folder, const char *id,
data->cb = cb;
data->vcardentry = TRUE;
- query = g_strdup_printf(CONTACTS_QUERY_FROM_URI, id, id, id, id, id,
- id, id, id, id, id, id, id,
+ if (strncmp(id, CONTACT_ID_PREFIX, strlen(CONTACT_ID_PREFIX)) == 0) {
+ query = g_strdup_printf(CONTACTS_QUERY_FROM_URI, id, id, id, id,
+ id, id, id, id, id, id, id, id,
id, id, id, id, id);
+ } else {
+ query = g_strdup_printf(CONTACTS_OTHER_QUERY_FROM_URI,
+ id, id, id);
+ }
ret = query_tracker(query, PULL_QUERY_COL_AMOUNT, pull_contacts, data);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Provide extra query for vCard single call
2010-10-25 9:04 [PATCH] Provide extra query for vCard single call Rafal Michalski
@ 2010-10-25 16:26 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2010-10-25 16:26 UTC (permalink / raw)
To: Rafal Michalski; +Cc: linux-bluetooth
Hi Rafal,
On Mon, Oct 25, 2010, Rafal Michalski wrote:
> This patch makes that additional circumstance is recognized - after
> making a call with number that is out of phonebook it can be downloaded
> as a single vCard containing number with OTHER type.
> ---
> plugins/phonebook-tracker.c | 20 ++++++++++++++++++--
> 1 files changed, 18 insertions(+), 2 deletions(-)
Pushed upstream, but I had to fix your coding style first:
> - query = g_strdup_printf(CONTACTS_QUERY_FROM_URI, id, id, id, id, id,
> - id, id, id, id, id, id, id,
> + if (strncmp(id, CONTACT_ID_PREFIX, strlen(CONTACT_ID_PREFIX)) == 0) {
> + query = g_strdup_printf(CONTACTS_QUERY_FROM_URI, id, id, id, id,
> + id, id, id, id, id, id, id, id,
> id, id, id, id, id);
> + } else {
> + query = g_strdup_printf(CONTACTS_OTHER_QUERY_FROM_URI,
> + id, id, id);
> + }
>
> ret = query_tracker(query, PULL_QUERY_COL_AMOUNT, pull_contacts, data);
Single line branches shouldn't use curly braces.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-25 16:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-25 9:04 [PATCH] Provide extra query for vCard single call Rafal Michalski
2010-10-25 16:26 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox