diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c
index cab3822..d1f4cd7 100644
--- a/obexd/plugins/phonebook-tracker.c
+++ b/obexd/plugins/phonebook-tracker.c
#define COL_ANSWERED 21
#define CONTACTS_ID_COL 22
#define CONTACT_ID_PREFIX "urn:uuid:"
+#define CALL_ID_PREFIX "message:"
#define FAX_NUM_TYPE "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#FaxNumber"
#define MOBILE_NUM_TYPE "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#CellPhoneNumber"
"} "
#define CALLS_LIST(CONSTRAINT) \
-"SELECT ?_contact nco:nameFamily(?_contact) " \
+"SELECT ?_call nco:nameFamily(?_contact) " \
"nco:nameGiven(?_contact) nco:nameAdditional(?_contact) " \
"nco:nameHonorificPrefix(?_contact) " \
"nco:nameHonorificSuffix(?_contact) " \
" ?_call nmo:isSent true " \
"} "
+#define CALL_URI_CONSTRAINT \
+COMBINED_CONSTRAINT \
+"FILTER (?_call = <%s>) "
+
#define MISSED_CALLS_QUERY CALLS_QUERY(MISSED_CONSTRAINT)
#define MISSED_CALLS_LIST CALLS_LIST(MISSED_CONSTRAINT)
#define INCOMING_CALLS_QUERY CALLS_QUERY(INCOMING_CONSTRAINT)
#define OUTGOING_CALLS_LIST CALLS_LIST(OUTGOING_CONSTRAINT)
#define COMBINED_CALLS_QUERY CALLS_QUERY(COMBINED_CONSTRAINT)
#define COMBINED_CALLS_LIST CALLS_LIST(COMBINED_CONSTRAINT)
+#define CONTACT_FROM_CALL_QUERY CALLS_QUERY(CALL_URI_CONSTRAINT)
#define CONTACTS_QUERY_FROM_URI \
"SELECT " \
g_strcmp0(id, TRACKER_DEFAULT_CONTACT_ME) == 0)
query = g_strdup_printf(CONTACTS_QUERY_FROM_URI, id, id, id, id,
id, id, id, id, id, id, id, id, id);
+ else if (g_str_has_prefix(id, CALL_ID_PREFIX) == TRUE)
+ query = g_strdup_printf(CONTACT_FROM_CALL_QUERY, id);
else
query = g_strdup_printf(CONTACTS_OTHER_QUERY_FROM_URI,
id, id, id);