diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c
index 619d361..0f5bce5 100644
--- a/obexd/plugins/phonebook-tracker.c
+++ b/obexd/plugins/phonebook-tracker.c
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
"nco:postalcode(?p) nco:country(?p) \"NOTACALL\" \"false\" " \
- "\"false\" " \
+ "\"false\" ?c " \
"WHERE { " \
"?c a nco:PersonContact . " \
"OPTIONAL { ?c nco:hasPhoneNumber ?h . } " \
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
"nco:postalcode(?p) nco:country(?p) nmo:receivedDate(?call) " \
- "nmo:isSent(?call) nmo:isAnswered(?call)" \
+ "nmo:isSent(?call) nmo:isAnswered(?call) ?c " \
"WHERE { " \
"?call a nmo:Call ; " \
"nmo:from ?c ; " \
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
"nco:postalcode(?p) nco:country(?p) nmo:receivedDate(?call) " \
- "nmo:isSent(?call) nmo:isAnswered(?call)" \
+ "nmo:isSent(?call) nmo:isAnswered(?call) ?c " \
"WHERE { " \
"?call a nmo:Call ; " \
"nmo:from ?c ; " \
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
"nco:postalcode(?p) nco:country(?p) nmo:receivedDate(?call) " \
- "nmo:isSent(?call) nmo:isAnswered(?call)" \
+ "nmo:isSent(?call) nmo:isAnswered(?call) ?c " \
"WHERE { " \
"?call a nmo:Call ; " \
"nmo:to ?c ; " \
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
"nco:postalcode(?p) nco:country(?p) nmo:receivedDate(?call) " \
- "nmo:isSent(?call) nmo:isAnswered(?call)" \
+ "nmo:isSent(?call) nmo:isAnswered(?call) ?c " \
"WHERE { " \
"{ " \
"?call a nmo:Call ; " \
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
"nco:postalcode(?p) nco:country(?p) \"NOTACALL\" \"false\" " \
- "\"false\" " \
+ "\"false\" <%s> " \
"WHERE { " \
"<%s> a nco:Contact . " \
"OPTIONAL { <%s> nco:hasPhoneNumber ?h . } " \
while (dbus_message_iter_get_arg_type(&element) != DBUS_TYPE_INVALID) {
char **node;
- int i;
if (dbus_message_iter_get_arg_type(&element) !=
DBUS_TYPE_ARRAY) {
}
node = string_array_from_iter(element, pending->num_fields);
-
- /* Ignoring empty responses */
- for (i = 0; i < pending->num_fields; i++) {
- if (node[i][0] != '\0') {
- pending->callback(node, pending->num_fields,
+ pending->callback(node, pending->num_fields,
pending->user_data);
- break;
- }
- }
g_free(node);
struct phonebook_contact *contact;
struct phonebook_number *number;
GString *vcards = data->vcards;
- int last_index;
+ int last_index, i;
DBG("reply %p", reply);
if (data->vcardentry)
goto add_entry;
+ /* Last four fields are always present, ignoring them */
+ for (i = 0; i < num_fields - 4; i++)
+ if (reply[i][0] != '\0')
+ break;
+
+ if (i == num_fields - 4 && g_str_equal(reply[19],
+ TRACKER_DEFAULT_CONTACT_ME) == FALSE)
+ return;
+
data->index++;
/* Just interested in knowing the phonebook size */
if (reply == NULL)
goto done;
- for (i = 1; i < 6; i++)
- if (reply[i][0] != '\0') {
- formatted = g_strdup_printf("%s;%s;%s;%s;%s",
- reply[1], reply[2], reply[3], reply[4],
- reply[5]);
+ /* the first element is the URI, always not empty */
+ for (i = 1; i < num_fields; i++)
+ if (reply[i][0] != '\0')
break;
- }
+
+ if (i == num_fields && g_str_equal(reply[0],
+ TRACKER_DEFAULT_CONTACT_ME) == FALSE)
+ return;
if (i == 6)
formatted = g_strdup(reply[6]);
+ else
+ formatted = g_strdup_printf("%s;%s;%s;%s;%s",
+ reply[1], reply[2], reply[3], reply[4],
+ reply[5]);
/* The owner vCard must have the 0 handle */
if (strcmp(reply[0], TRACKER_DEFAULT_CONTACT_ME) == 0)
data->user_data = user_data;
data->cb = cb;
- return query_tracker(query, 19, pull_contacts, data);
+ return query_tracker(query, 20, pull_contacts, data);
}
int phonebook_get_entry(const char *folder, const char *id,
data->vcardentry = TRUE;
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, id);
- ret = query_tracker(query, 19, pull_contacts, data);
+ ret = query_tracker(query, 20, pull_contacts, data);
g_free(query);