diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c
index 18c6fc5..1c41f5f 100644
--- a/obexd/plugins/phonebook-tracker.c
+++ b/obexd/plugins/phonebook-tracker.c
"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) " \
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
- "nco:postalcode(?p) nco:country(?p) " \
+ "nco:postalcode(?p) nco:country(?p) \"NOTACALL\" \"false\" " \
+ "\"false\" " \
"WHERE { " \
"?c a nco:Contact . " \
"OPTIONAL { ?c nco:hasPhoneNumber ?h . } " \
"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) " \
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
- "nco:postalcode(?p) nco:country(?p) " \
+ "nco:postalcode(?p) nco:country(?p) nmo:receivedDate(?call) " \
+ "nmo:isSent(?call) nmo:isAnswered(?call)" \
"WHERE { " \
"?call a nmo:Call ; " \
"nmo:from ?c ; " \
"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) " \
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
- "nco:postalcode(?p) nco:country(?p) " \
+ "nco:postalcode(?p) nco:country(?p) nmo:receivedDate(?call) " \
+ "nmo:isSent(?call) nmo:isAnswered(?call)" \
"WHERE { " \
"?call a nmo:Call ; " \
"nmo:from ?c ; " \
"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) " \
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
- "nco:postalcode(?p) nco:country(?p) " \
+ "nco:postalcode(?p) nco:country(?p) nmo:receivedDate(?call) " \
+ "nmo:isSent(?call) nmo:isAnswered(?call)" \
"WHERE { " \
"?call a nmo:Call ; " \
"nmo:to ?c ; " \
"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) " \
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
- "nco:postalcode(?p) nco:country(?p) " \
+ "nco:postalcode(?p) nco:country(?p) nmo:receivedDate(?call) " \
+ "nmo:isSent(?call) nmo:isAnswered(?call)" \
"WHERE { " \
"{ " \
"?call a nmo:Call ; " \
"nco:nameHonorificSuffix(<%s>) nco:emailAddress(?e) " \
"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \
"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \
- "nco:postalcode(?p) nco:country(?p) " \
+ "nco:postalcode(?p) nco:country(?p) \"NOTACALL\" \"false\" " \
+ "\"false\" " \
"WHERE { " \
"<%s> a nco:Contact . " \
"OPTIONAL { <%s> nco:hasPhoneNumber ?h . } " \
return 0;
}
+static void set_call_type(struct phonebook_contact *contact,
+ const char *datetime, const char *is_sent,
+ const char *is_answered)
+{
+ gboolean sent, answered;
+
+ if (g_strcmp0(datetime, "NOTACALL") == 0) {
+ contact->calltype = CALL_TYPE_NOT_A_CALL;
+ return;
+ }
+
+ sent = FALSE;
+ if (g_strcmp0(is_sent, "true") == 0)
+ sent = TRUE;
+
+ answered = FALSE;
+ if (g_strcmp0(is_answered, "true") == 0)
+ answered = TRUE;
+
+ if (sent == FALSE)
+ if (answered == FALSE)
+ contact->calltype = CALL_TYPE_MISSED;
+ else
+ contact->calltype = CALL_TYPE_INCOMING;
+ else
+ contact->calltype = CALL_TYPE_OUTGOING;
+
+ /* Tracker already gives time in the ISO 8601 format */
+ contact->datetime = g_strdup(datetime);
+}
+
static void pull_contacts(char **reply, int num_fields, void *user_data)
{
struct phonebook_data *data = user_data;
contact->postal = g_strdup(reply[14]);
contact->country = g_strdup(reply[15]);
+ set_call_type(contact, reply[16], reply[17], reply[18]);
+
number = g_new0(struct phonebook_number, 1);
number->tel = g_strdup(reply[0]);
number->type = 0; /* HOME */
data->user_data = user_data;
data->cb = cb;
- return query_tracker(query, 16, pull_contacts, data);
+ return query_tracker(query, 19, pull_contacts, data);
}
int phonebook_get_entry(const char *folder, const char *id,
query = g_strdup_printf(CONTACTS_QUERY_FROM_URI, id, id, id, id, id,
id, id, id, id, id, id);
- ret = query_tracker(query, 16, pull_contacts, data);
+ ret = query_tracker(query, 19, pull_contacts, data);
g_free(query);
diff --git a/obexd/plugins/vcard.c b/obexd/plugins/vcard.c
index dc6e283..0dd3b08 100644
--- a/obexd/plugins/vcard.c
+++ b/obexd/plugins/vcard.c
contact->postal, contact->country);
}
+static void vcard_printf_datetime(GString *vcards,
+ struct phonebook_contact *contact)
+{
+ const char *type;
+
+ switch (contact->calltype) {
+ case CALL_TYPE_MISSED:
+ type = "MISSED";
+ break;
+
+ case CALL_TYPE_INCOMING:
+ type = "RECEIVED";
+ break;
+
+ case CALL_TYPE_OUTGOING:
+ type = "DIALED";
+ break;
+
+ case CALL_TYPE_NOT_A_CALL:
+ default:
+ return;
+ }
+
+ vcard_printf(vcards, "X-IRMC-CALL-DATETIME;%s:%s", type,
+ contact->datetime);
+}
+
static void vcard_printf_end(GString *vcards)
{
vcard_printf(vcards, "END:VCARD");
if (filter & FILTER_ADR)
vcard_printf_adr(vcards, contact);
+ if (filter & FILTER_X_IRMC_CALL_DATETIME)
+ vcard_printf_datetime(vcards, contact);
+
vcard_printf_end(vcards);
}
g_free(contact->region);
g_free(contact->postal);
g_free(contact->country);
+ g_free(contact->datetime);
g_free(contact);
}
diff --git a/obexd/plugins/vcard.h b/obexd/plugins/vcard.h
index f2b5c09..06bcd35 100644
--- a/obexd/plugins/vcard.h
+++ b/obexd/plugins/vcard.h
TEL_TYPE_OTHER,
};
+enum phonebook_call_type {
+ CALL_TYPE_NOT_A_CALL,
+ CALL_TYPE_MISSED,
+ CALL_TYPE_INCOMING,
+ CALL_TYPE_OUTGOING,
+};
+
struct phonebook_number {
char *tel;
int type;
char *region;
char *postal;
char *country;
+ char *datetime;
+ int calltype;
};
void phonebook_add_contact(GString *vcards, struct phonebook_contact *contact,