summaryrefslogtreecommitdiff
path: root/plugins/phonebook-tracker.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/phonebook-tracker.c')
-rw-r--r--plugins/phonebook-tracker.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index 1c579d1..a6e21f8 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,13 @@ 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);