Fix proper type handling in contacts_query_all
PATCH 1/7 Fix proper type handling in contacts_query_all
Previously all phone numbers, addresses and emails was considered to be "work". Now there are three working types for emails and addresses: "work", "home", "other" and four for phone numbers - these three as well as "cell".
--- plugins/phonebook-tracker.c | 61 +++++++++++++++++++++++++++++++------------ 1 files changed, 44 insertions(+), 17 deletions(-)
plugins/phonebook-tracker.c +44 -17
@@ -43,8 +43,8 @@#define TRACKER_RESOURCES_INTERFACE "org.freedesktop.Tracker1.Resources"#define TRACKER_DEFAULT_CONTACT_ME "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#default-contact-me" -#define CONTACTS_ID_COL 38 -#define PULL_QUERY_COL_AMOUNT 39 +#define CONTACTS_ID_COL 47 +#define PULL_QUERY_COL_AMOUNT 48#define COUNT_QUERY_COL_AMOUNT 1#define COL_HOME_NUMBER 0#define COL_HOME_EMAIL 7
@@ -52,14 +52,16 @@#define COL_FAX_NUMBER 16#define COL_WORK_EMAIL 17#define COL_OTHER_NUMBER 34 -#define COL_DATE 35 -#define COL_SENT 36 -#define COL_ANSWERED 37 +#define COL_OTHER_EMAIL 42 +#define COL_CELL_NUMBER 43 +#define COL_DATE 44 +#define COL_SENT 45 +#define COL_ANSWERED 46#define ADDR_FIELD_AMOUNT 7#define CONTACT_ID_PREFIX "contact:"#define CONTACTS_QUERY_ALL \ - "SELECT ?v nco:fullname(?c) " \ + "SELECT nco:phoneNumber(?v) nco:fullname(?c) " \ "nco:nameFamily(?c) nco:nameGiven(?c) " \ "nco:nameAdditional(?c) nco:nameHonorificPrefix(?c) " \ "nco:nameHonorificSuffix(?c) nco:emailAddress(?e) " \
@@ -71,29 +73,43 @@"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(?c) " \ -"nco:title(?a) nco:phoneNumber(?t) " \ +"nco:title(?a) ?t nco:pobox(?po) nco:extendedAddress(?po) " \ +"nco:streetAddress(?po) nco:locality(?po) nco:region(?po) " \ +"nco:postalcode(?po) nco:country(?po) nco:emailAddress(?eo) " \ +"?vc " \"\"NOTACALL\" \"false\" \"false\" ?c " \"WHERE { " \"?c a nco:PersonContact . " \ -"OPTIONAL { ?c nco:hasPhoneNumber ?h . \ -OPTIONAL {" \ +"OPTIONAL { ?c nco:hasPhoneNumber ?h . " \ +"OPTIONAL {" \"?h a nco:FaxNumber ; " \"nco:phoneNumber ?f . " \"}" \"OPTIONAL {" \ +"?h a nco:CellPhoneNumber ; " \ +"nco:phoneNumber ?vc" \ +"}" \ +"OPTIONAL {" \"?h a nco:VoicePhoneNumber ; " \ -"nco:phoneNumber ?v" \ +"nco:phoneNumber ?t" \"}" \"}" \ -"OPTIONAL { ?c nco:hasEmailAddress ?e . } " \ -"OPTIONAL { ?c nco:hasPostalAddress ?p . } " \"OPTIONAL { " \"?c nco:hasAffiliation ?a . " \ -"OPTIONAL { ?a nco:hasPhoneNumber ?w . } " \ -"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ -"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ +"OPTIONAL { ?a rdfs:label \"Work\" . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ +"OPTIONAL { ?a nco:hasPhoneNumber ?w . } " \ +"}" \ +"OPTIONAL { ?a rdfs:label \"Home\" . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ +"OPTIONAL { ?a nco:hasPhoneNumber ?v . } " \ +"}" \"OPTIONAL { ?a nco:org ?o . } " \"} " \ +"OPTIONAL { ?c nco:hasPostalAddress ?po . } " \ +"OPTIONAL { ?c nco:hasEmailAddress ?eo . } " \"}" #define CONTACTS_QUERY_ALL_LIST \
@@ -1107,7 +1123,7 @@ static void pull_contacts(char **reply, int num_fields, void *user_data)GString *vcards;int last_index, i;gboolean cdata_present = FALSE; -char *home_addr, *work_addr; +char *home_addr, *work_addr, *other_addr;if (num_fields <0 ) { data->cb (NULL ,0 , num_fields,0 , data->user_data);
@@ -1178,11 +1194,16 @@ add_numbers:add_phone_number (contact, reply[COL_HOME_NUMBER ],TEL_TYPE_HOME );add_phone_number (contact, reply[COL_WORK_NUMBER ],TEL_TYPE_WORK );add_phone_number (contact, reply[COL_FAX_NUMBER ],TEL_TYPE_FAX ); -add_phone_number (contact, reply[COL_OTHER_NUMBER ],TEL_TYPE_OTHER ); +add_phone_number (contact, reply[COL_CELL_NUMBER ],TEL_TYPE_MOBILE ); +if ((g_strcmp0 (reply[COL_OTHER_NUMBER ], reply[COL_CELL_NUMBER ]) !=0 ) && + (g_strcmp0 (reply[COL_OTHER_NUMBER ], reply[COL_WORK_NUMBER ]) !=0 ) && + (g_strcmp0 (reply[COL_OTHER_NUMBER ], reply[COL_HOME_NUMBER ]) !=0 )) +add_phone_number (contact, reply[COL_OTHER_NUMBER ],TEL_TYPE_OTHER );/* Adding emails */ add_email (contact, reply[COL_HOME_EMAIL ],EMAIL_TYPE_HOME );add_email (contact, reply[COL_WORK_EMAIL ],EMAIL_TYPE_WORK ); +add_email (contact, reply[COL_OTHER_EMAIL ],EMAIL_TYPE_OTHER );/* Adding addresses */ home_addr = g_strdup_printf("%s;%s;%s;%s;%s;%s;%s",
@@ -1193,11 +1214,17 @@ add_numbers: reply[25 ], reply[26 ], reply[27 ], reply[28 ], reply[29], reply[30], reply[31]); + other_addr =g_strdup_printf ("%s;%s;%s;%s;%s;%s;%s" , + reply[35 ], reply[36 ], reply[37 ], reply[38 ], + reply[39 ], reply[40 ], reply[41 ]); +add_address (contact, home_addr,ADDR_TYPE_HOME );add_address (contact, work_addr,ADDR_TYPE_WORK ); +add_address (contact, other_addr,ADDR_TYPE_OTHER );g_free (home_addr);g_free (work_addr); +g_free (other_addr);/* Adding fields connected by nco:hasAffiliation - they may be in * separate replies */
Signature · 1 line
1.7.0.4
PATCH 2/7 Fix proper type handling in missed_calls_query
Previously all phone numbers, addresses and emails was considered to be "work". Now there are three working types for emails and addresses: "work", "home", "other" and four for phone numbers - these three as well as "cell".
--- plugins/phonebook-tracker.c | 84 +++++++++++++++++++++++++++++++++---------- 1 files changed, 65 insertions(+), 19 deletions(-)
plugins/phonebook-tracker.c +65 -19
@@ -127,11 +127,11 @@"} GROUP BY ?c" #define MISSED_CALLS_QUERY \ -"SELECT nco:phoneNumber(?h) nco:fullname(?c) " \ +"SELECT ?h nco:fullname(?c) " \"nco:nameFamily(?c) nco:nameGiven(?c) " \"nco:nameAdditional(?c) nco:nameHonorificPrefix(?c) " \"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) " \ -"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \ +"?w nco:pobox(?p) nco:extendedAddress(?p) " \"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \"nco:postalcode(?p) nco:country(?p) \"\" nco:emailAddress(?ew) " \"nco:birthDate(?c) nco:nickname(?c) nco:url(?c) " \
@@ -139,7 +139,11 @@"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(?c) " \ -"nco:title(?a) nco:phoneNumber(?t) nmo:receivedDate(?call) " \ +"nco:title(?a) nco:phoneNumber(?t) nco:pobox(?po) " \ +"nco:extendedAddress(?po) nco:streetAddress(?po) " \ +"nco:locality(?po) nco:region(?po) nco:postalcode(?po) " \ +"nco:country(?po) nco:emailAddress(?eo) ?vc " \ +"nmo:receivedDate(?call) " \"nmo:isSent(?call) nmo:isAnswered(?call) ?x " \"WHERE { " \"{ " \
@@ -149,40 +153,82 @@"nmo:from ?x ; " \"nmo:isSent false ; " \"nmo:isAnswered false . " \ +"?c a nco:PersonContact . " \ +"?c nco:hasPhoneNumber ?t . " \ +"OPTIONAL { " \ +"?t a nco:CellPhoneNumber ; " \ +"nco:phoneNumber ?vc . " \ +"} " \ +"OPTIONAL { ?c nco:hasPostalAddress ?po . } " \ +"OPTIONAL { ?c nco:hasEmailAddress ?eo . } " \ +"OPTIONAL { " \ +"?c nco:hasAffiliation ?a . " \ +"OPTIONAL { " \ +"?a rdfs:label \"Work\" . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ +"}" \ +"OPTIONAL { " \ +"?a rdfs:label \"Home\" . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ +"} " \ +"OPTIONAL { ?a nco:org ?o . } " \ +"} " \"} UNION { " \"?x a nco:Contact . " \ -"?x nco:hasPhoneNumber ?h . " \ +"?x nco:hasPhoneNumber ?tmp . " \"?call a nmo:Call ; " \"nmo:from ?x ; " \"nmo:isSent false ; " \"nmo:isAnswered false . " \"?c a nco:PersonContact . " \ -"?c nco:hasPhoneNumber ?h . " \ -"OPTIONAL { ?c nco:hasEmailAddress ?e . } " \ -"OPTIONAL { ?c nco:hasPostalAddress ?p . } " \ +"?c nco:hasAffiliation ?a . " \ +"?a nco:hasPhoneNumber ?tmp . " \"OPTIONAL { " \ -"?c nco:hasAffiliation ?a . " \ +"?a rdfs:label \"Work\" . " \ +"?tmp nco:phoneNumber ?w . " \"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \"OPTIONAL { ?a nco:org ?o . } " \ -"} " \ +"{ " \ +"SELECT ?p ?e ?c WHERE { " \ +"?c nco:hasAffiliation ?b . " \ +"?b rdfs:label \"Home\" . " \ +"OPTIONAL {?b nco:hasEmailAddress ?e . } " \ +"OPTIONAL {?b nco:hasPostalAddress ?p . }} " \ +"} " \ +"}" \ +"OPTIONAL { " \ +"?a rdfs:label \"Home\" . " \ +"?tmp nco:phoneNumber ?h . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ +"OPTIONAL { ?a nco:org ?o . } " \ +"{ " \ +"SELECT ?pw ?ew ?c WHERE { " \ +"?c nco:hasAffiliation ?b . " \ +"?b rdfs:label \"Work\" . " \ +"OPTIONAL {?b nco:hasEmailAddress ?ew . } " \ +"OPTIONAL {?b nco:hasPostalAddress ?pw . }} " \ +"} " \ +"}" \"} UNION { " \"?x a nco:Contact . " \ -"?x nco:hasPhoneNumber ?w . " \ +"?x nco:hasPhoneNumber ?t . " \"?call a nmo:Call ; " \"nmo:from ?x ; " \"nmo:isSent false ; " \"nmo:isAnswered false . " \ -"?c a nco:PersonContact . " \ -"OPTIONAL { ?c nco:hasEmailAddress ?e . } " \ -"OPTIONAL { ?c nco:hasPostalAddress ?p . } " \ -"?c nco:hasAffiliation ?a . " \ -"?a nco:hasPhoneNumber ?w . " \ -"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ -"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ -"OPTIONAL { ?a nco:org ?o . } " \ +"OPTIONAL {?c a nco:PersonContact ; " \ +"nco:hasPhoneNumber ?t . } " \ +"OPTIONAL {?c a nco:PersonContact ; " \ +"nco:hasAffiliation ?a . " \ +"?a nco:hasPhoneNumber ?t . } " \ +"FILTER ( !bound(?c) && !bound(?a) ) . " \"} " \ -"} GROUP BY ?call ORDER BY DESC(nmo:receivedDate(?call)) " +"} ORDER BY DESC(nmo:receivedDate(?call)) " + #define MISSED_CALLS_LIST \"SELECT ?c nco:nameFamily(?c) " \
Signature · 1 line
1.7.0.4
PATCH 3/7 Fix proper type handling in incoming_calls_query
In reply to Bartosz SzatkowskiPreviously all phone numbers, addresses and emails was considered to be "work". Now there are three working types for emails and addresses: "work", "home", "other" and four for phone numbers - these three as well as "cell".
--- plugins/phonebook-tracker.c | 83 +++++++++++++++++++++++++++++++++---------- 1 files changed, 64 insertions(+), 19 deletions(-)
plugins/phonebook-tracker.c +64 -19
@@ -266,11 +266,11 @@"} GROUP BY ?call ORDER BY DESC(nmo:receivedDate(?call))" #define INCOMING_CALLS_QUERY \ -"SELECT nco:phoneNumber(?h) nco:fullname(?c) " \ +"SELECT ?h nco:fullname(?c) " \"nco:nameFamily(?c) nco:nameGiven(?c) " \"nco:nameAdditional(?c) nco:nameHonorificPrefix(?c) " \"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) " \ -"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \ +"?w nco:pobox(?p) nco:extendedAddress(?p) " \"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \"nco:postalcode(?p) nco:country(?p) \"\" nco:emailAddress(?ew) " \"nco:birthDate(?c) nco:nickname(?c) nco:url(?c) " \
@@ -278,7 +278,11 @@"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(?c) " \ -"nco:title(?a) nco:phoneNumber(?t) nmo:receivedDate(?call) " \ +"nco:title(?a) nco:phoneNumber(?t) nco:pobox(?po) " \ +"nco:extendedAddress(?po) nco:streetAddress(?po) " \ +"nco:locality(?po) nco:region(?po) nco:postalcode(?po) " \ +"nco:country(?po) nco:emailAddress(?eo) ?vc " \ +"nmo:receivedDate(?call) " \"nmo:isSent(?call) nmo:isAnswered(?call) ?x " \"WHERE { " \"{ " \
@@ -288,40 +292,81 @@"nmo:from ?x ; " \"nmo:isSent false ; " \"nmo:isAnswered true . " \ +"?c a nco:PersonContact . " \ +"?c nco:hasPhoneNumber ?t . " \ +"OPTIONAL { " \ +"?t a nco:CellPhoneNumber ; " \ +"nco:phoneNumber ?vc . " \ +"} " \ +"OPTIONAL { ?c nco:hasPostalAddress ?po . } " \ +"OPTIONAL { ?c nco:hasEmailAddress ?eo . } " \ +"OPTIONAL { " \ +"?c nco:hasAffiliation ?a . " \ +"OPTIONAL { " \ +"?a rdfs:label \"Work\" . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ +"}" \ +"OPTIONAL { " \ +"?a rdfs:label \"Home\" . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ +"} " \ +"OPTIONAL { ?a nco:org ?o . } " \ +"} " \"} UNION { " \"?x a nco:Contact . " \ -"?x nco:hasPhoneNumber ?h . " \ +"?x nco:hasPhoneNumber ?tmp . " \"?call a nmo:Call ; " \"nmo:from ?x ; " \"nmo:isSent false ; " \"nmo:isAnswered true . " \"?c a nco:PersonContact . " \ -"?c nco:hasPhoneNumber ?h . " \ -"OPTIONAL { ?c nco:hasEmailAddress ?e . } " \ -"OPTIONAL { ?c nco:hasPostalAddress ?p . } " \ +"?c nco:hasAffiliation ?a . " \ +"?a nco:hasPhoneNumber ?tmp . " \"OPTIONAL { " \ -"?c nco:hasAffiliation ?a . " \ +"?a rdfs:label \"Work\" . " \ +"?tmp nco:phoneNumber ?w . " \"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \"OPTIONAL { ?a nco:org ?o . } " \ -"} " \ +"{ " \ +"SELECT ?p ?e ?c WHERE { " \ +"?c nco:hasAffiliation ?b . " \ +"?b rdfs:label \"Home\" . " \ +"OPTIONAL {?b nco:hasEmailAddress ?e . } " \ +"OPTIONAL {?b nco:hasPostalAddress ?p . }} " \ +"} " \ +"}" \ +"OPTIONAL { " \ +"?a rdfs:label \"Home\" . " \ +"?tmp nco:phoneNumber ?h . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ +"OPTIONAL { ?a nco:org ?o . } " \ +"{ " \ +"SELECT ?pw ?ew ?c WHERE { " \ +"?c nco:hasAffiliation ?b . " \ +"?b rdfs:label \"Work\" . " \ +"OPTIONAL {?b nco:hasEmailAddress ?ew . } " \ +"OPTIONAL {?b nco:hasPostalAddress ?pw . }} " \ +"} " \ +"}" \"} UNION { " \"?x a nco:Contact . " \ -"?x nco:hasPhoneNumber ?w . " \ +"?x nco:hasPhoneNumber ?t . " \"?call a nmo:Call ; " \"nmo:from ?x ; " \"nmo:isSent false ; " \"nmo:isAnswered true . " \ -"?c a nco:PersonContact . " \ -"OPTIONAL { ?c nco:hasEmailAddress ?e . } " \ -"OPTIONAL { ?c nco:hasPostalAddress ?p . } " \ -"?c nco:hasAffiliation ?a . " \ -"?a nco:hasPhoneNumber ?w . " \ -"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ -"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ -"OPTIONAL { ?a nco:org ?o . } " \ +"OPTIONAL {?c a nco:PersonContact ; " \ +"nco:hasPhoneNumber ?t . } " \ +"OPTIONAL {?c a nco:PersonContact ; " \ +"nco:hasAffiliation ?a . " \ +"?a nco:hasPhoneNumber ?t . } " \ +"FILTER ( !bound(?c) && !bound(?a) ) . " \"} " \ -"} GROUP BY ?call ORDER BY DESC(nmo:receivedDate(?call)) " +"} ORDER BY DESC(nmo:receivedDate(?call)) " #define INCOMING_CALLS_LIST \"SELECT ?c nco:nameFamily(?c) " \
Signature · 1 line
1.7.0.4
PATCH 4/7 Fix proper type handling in outgoing_calls_query
In reply to Bartosz SzatkowskiPreviously all phone numbers, addresses and emails was considered to be "work". Now there are three working types for emails and addresses: "work", "home", "other" and four for phone numbers - these three as well as "cell".
--- plugins/phonebook-tracker.c | 85 +++++++++++++++++++++++++++++++++---------- 1 files changed, 65 insertions(+), 20 deletions(-)
plugins/phonebook-tracker.c +65 -20
@@ -404,19 +404,23 @@"} GROUP BY ?call ORDER BY DESC(nmo:receivedDate(?call))" #define OUTGOING_CALLS_QUERY \ -"SELECT nco:phoneNumber(?h) nco:fullname(?c) " \ +"SELECT ?h nco:fullname(?c) " \"nco:nameFamily(?c) nco:nameGiven(?c) " \"nco:nameAdditional(?c) nco:nameHonorificPrefix(?c) " \"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) " \ -"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \ +"?w nco:pobox(?p) nco:extendedAddress(?p) " \"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \ -"nco:postalcode(?p) nco:country(?p) \"\" nco:emailAddress(?ew)" \ +"nco:postalcode(?p) nco:country(?p) \"\" nco:emailAddress(?ew) " \"nco:birthDate(?c) nco:nickname(?c) nco:url(?c) " \"nco:photo(?c) nco:fullname(?o) nco:department(?a) " \"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(?c) " \ -"nco:title(?a) nco:phoneNumber(?t) nmo:receivedDate(?call) " \ +"nco:title(?a) nco:phoneNumber(?t) nco:pobox(?po) " \ +"nco:extendedAddress(?po) nco:streetAddress(?po) " \ +"nco:locality(?po) nco:region(?po) nco:postalcode(?po) " \ +"nco:country(?po) nco:emailAddress(?eo) ?vc " \ +"nmo:receivedDate(?call) " \"nmo:isSent(?call) nmo:isAnswered(?call) ?x " \"WHERE { " \"{ " \
@@ -425,38 +429,79 @@"?call a nmo:Call ; " \"nmo:to ?x ; " \"nmo:isSent true . " \ +"?c a nco:PersonContact . " \ +"?c nco:hasPhoneNumber ?t . " \ +"OPTIONAL { " \ +"?t a nco:CellPhoneNumber ; " \ +"nco:phoneNumber ?vc . " \ +"} " \ +"OPTIONAL { ?c nco:hasPostalAddress ?po . } " \ +"OPTIONAL { ?c nco:hasEmailAddress ?eo . } " \ +"OPTIONAL { " \ +"?c nco:hasAffiliation ?a . " \ +"OPTIONAL { " \ +"?a rdfs:label \"Work\" . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ +"}" \ +"OPTIONAL { " \ +"?a rdfs:label \"Home\" . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ +"} " \ +"OPTIONAL { ?a nco:org ?o . } " \ +"} " \"} UNION { " \"?x a nco:Contact . " \ -"?x nco:hasPhoneNumber ?h . " \ +"?x nco:hasPhoneNumber ?tmp . " \"?call a nmo:Call ; " \"nmo:to ?x ; " \"nmo:isSent true . " \"?c a nco:PersonContact . " \ -"?c nco:hasPhoneNumber ?h . " \ -"OPTIONAL { ?c nco:hasEmailAddress ?e . } " \ -"OPTIONAL { ?c nco:hasPostalAddress ?p . } " \ +"?c nco:hasAffiliation ?a . " \ +"?a nco:hasPhoneNumber ?tmp . " \"OPTIONAL { " \ -"?c nco:hasAffiliation ?a . " \ +"?a rdfs:label \"Work\" . " \ +"?tmp nco:phoneNumber ?w . " \"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \"OPTIONAL { ?a nco:org ?o . } " \ -"} " \ +"{ " \ +"SELECT ?p ?e ?c WHERE { " \ +"?c nco:hasAffiliation ?b . " \ +"?b rdfs:label \"Home\" . " \ +"OPTIONAL {?b nco:hasEmailAddress ?e . } " \ +"OPTIONAL {?b nco:hasPostalAddress ?p . }} " \ +"} " \ +"}" \ +"OPTIONAL { " \ +"?a rdfs:label \"Home\" . " \ +"?tmp nco:phoneNumber ?h . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ +"OPTIONAL { ?a nco:org ?o . } " \ +"{ " \ +"SELECT ?pw ?ew ?c WHERE { " \ +"?c nco:hasAffiliation ?b . " \ +"?b rdfs:label \"Work\" . " \ +"OPTIONAL {?b nco:hasEmailAddress ?ew . } " \ +"OPTIONAL {?b nco:hasPostalAddress ?pw . }} " \ +"} " \ +"}" \"} UNION { " \"?x a nco:Contact . " \ -"?x nco:hasPhoneNumber ?w . " \ +"?x nco:hasPhoneNumber ?t . " \"?call a nmo:Call ; " \"nmo:to ?x ; " \"nmo:isSent true . " \ -"?c a nco:PersonContact . " \ -"OPTIONAL { ?c nco:hasEmailAddress ?e . } " \ -"OPTIONAL { ?c nco:hasPostalAddress ?p . } " \ -"?c nco:hasAffiliation ?a . " \ -"?a nco:hasPhoneNumber ?w . " \ -"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ -"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ -"OPTIONAL { ?a nco:org ?o . } " \ +"OPTIONAL {?c a nco:PersonContact ; " \ +"nco:hasPhoneNumber ?t . } " \ +"OPTIONAL {?c a nco:PersonContact ; " \ +"nco:hasAffiliation ?a . " \ +"?a nco:hasPhoneNumber ?t . } " \ +"FILTER ( !bound(?c) && !bound(?a) ) . " \"} " \ -"} GROUP BY ?call ORDER BY DESC(nmo:sentDate(?call)) " +"} ORDER BY DESC(nmo:sentDate(?call)) " #define OUTGOING_CALLS_LIST \"SELECT ?c nco:nameFamily(?c) " \
Signature · 1 line
1.7.0.4
PATCH 5/7 Fix proper type handling in combined_calls_query
In reply to Bartosz SzatkowskiPreviously all phone numbers, addresses and emails was considered to be "work". Now there are three working types for emails and addresses: "work", "home", "other" and four for phone numbers - these three as well as "cell".
--- plugins/phonebook-tracker.c | 152 +++++++++++++++++++++++++++++++++--------- 1 files changed, 119 insertions(+), 33 deletions(-)
plugins/phonebook-tracker.c +119 -33
@@ -536,11 +536,11 @@"} GROUP BY ?call ORDER BY DESC(nmo:sentDate(?call))" #define COMBINED_CALLS_QUERY \ -"SELECT nco:phoneNumber(?h) nco:fullname(?c) " \ +"SELECT ?h nco:fullname(?c) " \"nco:nameFamily(?c) nco:nameGiven(?c) " \"nco:nameAdditional(?c) nco:nameHonorificPrefix(?c) " \"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) " \ -"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) " \ +"?w nco:pobox(?p) nco:extendedAddress(?p) " \"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) " \"nco:postalcode(?p) nco:country(?p) \"\" nco:emailAddress(?ew) " \"nco:birthDate(?c) nco:nickname(?c) nco:url(?c) " \
@@ -548,7 +548,11 @@"nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \"nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \"nco:postalcode(?pw) nco:country(?pw) nco:contactUID(?c) " \ -"nco:title(?a) nco:phoneNumber(?t) nmo:receivedDate(?call) " \ +"nco:title(?a) nco:phoneNumber(?t) nco:pobox(?po) " \ +"nco:extendedAddress(?po) nco:streetAddress(?po) " \ +"nco:locality(?po) nco:region(?po) nco:postalcode(?po) " \ +"nco:country(?po) nco:emailAddress(?eo) ?vc " \ +"nmo:receivedDate(?call) " \"nmo:isSent(?call) nmo:isAnswered(?call) ?x " \"WHERE { " \"{ " \
@@ -557,74 +561,156 @@"?call a nmo:Call ; " \"nmo:to ?x ; " \"nmo:isSent true . " \ -"} UNION { " \ -"?x a nco:Contact . " \ -"?x nco:hasPhoneNumber ?h . " \ -"?call a nmo:Call ; " \ -"nmo:to ?x ; " \ -"nmo:isSent true . " \"?c a nco:PersonContact . " \ -"?c nco:hasPhoneNumber ?h . " \ -"OPTIONAL { ?c nco:hasEmailAddress ?e . } " \ -"OPTIONAL { ?c nco:hasPostalAddress ?p . } " \ +"?c nco:hasPhoneNumber ?t . " \ +"OPTIONAL { " \ +"?t a nco:CellPhoneNumber ; " \ +"nco:phoneNumber ?vc . " \ +"} " \ +"OPTIONAL { ?c nco:hasPostalAddress ?po . } " \ +"OPTIONAL { ?c nco:hasEmailAddress ?eo . } " \"OPTIONAL { " \"?c nco:hasAffiliation ?a . " \ +"OPTIONAL { " \ +"?a rdfs:label \"Work\" . " \"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ +"}" \ +"OPTIONAL { " \ +"?a rdfs:label \"Home\" . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ +"} " \"OPTIONAL { ?a nco:org ?o . } " \"} " \"} UNION { " \"?x a nco:Contact . " \ -"?x nco:hasPhoneNumber ?w . " \ +"?x nco:hasPhoneNumber ?tmp . " \"?call a nmo:Call ; " \"nmo:to ?x ; " \"nmo:isSent true . " \"?c a nco:PersonContact . " \ -"OPTIONAL { ?c nco:hasEmailAddress ?e . } " \ -"OPTIONAL { ?c nco:hasPostalAddress ?p . } " \"?c nco:hasAffiliation ?a . " \ -"?a nco:hasPhoneNumber ?w . " \ -"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ -"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ -"OPTIONAL { ?a nco:org ?o . } " \ +"?a nco:hasPhoneNumber ?tmp . " \ +"OPTIONAL { " \ +"?a rdfs:label \"Work\" . " \ +"?tmp nco:phoneNumber ?w . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ +"OPTIONAL { ?a nco:org ?o . } " \ +"{ " \ +"SELECT ?p ?e ?c WHERE { " \ +"?c nco:hasAffiliation ?b . " \ +"?b rdfs:label \"Home\" . " \ +"OPTIONAL {?b nco:hasEmailAddress ?e . } " \ +"OPTIONAL {?b nco:hasPostalAddress ?p . }} " \ +"} " \ +"}" \ +"OPTIONAL { " \ +"?a rdfs:label \"Home\" . " \ +"?tmp nco:phoneNumber ?h . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ +"OPTIONAL { ?a nco:org ?o . } " \ +"{ " \ +"SELECT ?pw ?ew ?c WHERE { " \ +"?c nco:hasAffiliation ?b . " \ +"?b rdfs:label \"Work\" . " \ +"OPTIONAL {?b nco:hasEmailAddress ?ew . } " \ +"OPTIONAL {?b nco:hasPostalAddress ?pw . }} " \ +"} " \ +"}" \"} UNION { " \"?x a nco:Contact . " \"?x nco:hasPhoneNumber ?t . " \"?call a nmo:Call ; " \ -"nmo:from ?x ; " \ -"nmo:isSent false . " \ +"nmo:to ?x ; " \ +"nmo:isSent true . " \ +"OPTIONAL {?c a nco:PersonContact ; " \ +"nco:hasPhoneNumber ?t . } " \ +"OPTIONAL {?c a nco:PersonContact ; " \ +"nco:hasAffiliation ?a . " \ +"?a nco:hasPhoneNumber ?t . } " \ +"FILTER ( !bound(?c) && !bound(?a) ) . " \"} UNION { " \"?x a nco:Contact . " \ -"?x nco:hasPhoneNumber ?h . " \ +"?x nco:hasPhoneNumber ?t . " \"?call a nmo:Call ; " \"nmo:from ?x ; " \"nmo:isSent false . " \"?c a nco:PersonContact . " \ -"?c nco:hasPhoneNumber ?h . " \ -"OPTIONAL { ?c nco:hasEmailAddress ?e . } " \ -"OPTIONAL { ?c nco:hasPostalAddress ?p . } " \ +"?c nco:hasPhoneNumber ?t . " \ +"OPTIONAL { " \ +"?t a nco:CellPhoneNumber ; " \ +"nco:phoneNumber ?vc . " \ +"} " \ +"OPTIONAL { ?c nco:hasPostalAddress ?po . } " \ +"OPTIONAL { ?c nco:hasEmailAddress ?eo . } " \"OPTIONAL { " \"?c nco:hasAffiliation ?a . " \ +"OPTIONAL { " \ +"?a rdfs:label \"Work\" . " \"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ +"}" \ +"OPTIONAL { " \ +"?a rdfs:label \"Home\" . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ +"} " \"OPTIONAL { ?a nco:org ?o . } " \"} " \"} UNION { " \"?x a nco:Contact . " \ -"?x nco:hasPhoneNumber ?w . " \ +"?x nco:hasPhoneNumber ?tmp . " \"?call a nmo:Call ; " \"nmo:from ?x ; " \"nmo:isSent false . " \"?c a nco:PersonContact . " \ -"OPTIONAL { ?c nco:hasEmailAddress ?e . } " \ -"OPTIONAL { ?c nco:hasPostalAddress ?p . } " \"?c nco:hasAffiliation ?a . " \ -"?a nco:hasPhoneNumber ?w . " \ -"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ -"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ -"OPTIONAL { ?a nco:org ?o . } " \ +"?a nco:hasPhoneNumber ?tmp . " \ +"OPTIONAL { " \ +"?a rdfs:label \"Work\" . " \ +"?tmp nco:phoneNumber ?w . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ +"OPTIONAL { ?a nco:org ?o . } " \ +"{ " \ +"SELECT ?p ?e ?c WHERE { " \ +"?c nco:hasAffiliation ?b . " \ +"?b rdfs:label \"Home\" . " \ +"OPTIONAL {?b nco:hasEmailAddress ?e . } " \ +"OPTIONAL {?b nco:hasPostalAddress ?p . }} " \ +"} " \ +"}" \ +"OPTIONAL { " \ +"?a rdfs:label \"Home\" . " \ +"?tmp nco:phoneNumber ?h . " \ +"OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ +"OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ +"OPTIONAL { ?a nco:org ?o . } " \ +"{ " \ +"SELECT ?pw ?ew ?c WHERE { " \ +"?c nco:hasAffiliation ?b . " \ +"?b rdfs:label \"Work\" . " \ +"OPTIONAL {?b nco:hasEmailAddress ?ew . } " \ +"OPTIONAL {?b nco:hasPostalAddress ?pw . }} " \ +"} " \ +"}" \ +"} UNION { " \ +"?x a nco:Contact . " \ +"?x nco:hasPhoneNumber ?t . " \ +"?call a nmo:Call ; " \ +"nmo:from ?x ; " \ +"nmo:isSent false . " \ +"OPTIONAL {?c a nco:PersonContact ; " \ +"nco:hasPhoneNumber ?t . } " \ +"OPTIONAL {?c a nco:PersonContact ; " \ +"nco:hasAffiliation ?a . " \ +"?a nco:hasPhoneNumber ?t . } " \ +"FILTER ( !bound(?c) && !bound(?a) ) . " \"} " \ -"} GROUP BY ?call ORDER BY DESC(nmo:receivedDate(?call)) " +"} ORDER BY DESC(nmo:receivedDate(?call)) " #define COMBINED_CALLS_LIST \"SELECT ?c nco:nameFamily(?c) nco:nameGiven(?c) " \
Signature · 1 line
1.7.0.4
PATCH 6/7 Fix proper type handling in contact_query_from_uri
In reply to Bartosz SzatkowskiPreviously all phone numbers, addresses and emails was considered to be "work". Now there are three working types for emails and addresses: "work", "home", "other" and four for phone numbers - these three as well as "cell".
--- plugins/phonebook-tracker.c | 38 ++++++++++++++++++++++++++------------ 1 files changed, 26 insertions(+), 12 deletions(-)
plugins/phonebook-tracker.c +26 -12
@@ -767,41 +767,55 @@ "} GROUP BY ?call ORDER BY DESC(nmo:receivedDate(?call))"#define CONTACTS_QUERY_FROM_URI \ - "SELECT ?v nco:fullname(<%s>) " \ + "SELECT nco:phoneNumber(?v) nco:fullname(<%s>) " \ "nco:nameFamily(<%s>) nco:nameGiven(<%s>) " \ "nco:nameAdditional(<%s>) nco:nameHonorificPrefix(<%s>) " \ "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) ?f nco:emailAddress(?ew)" \ + "nco:postalcode(?p) nco:country(?p) ?f nco:emailAddress(?ew) " \ "nco:birthDate(<%s>) nco:nickname(<%s>) nco:url(<%s>) " \ "nco:photo(<%s>) nco:fullname(?o) nco:department(?a) " \ "nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \ "nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \ "nco:postalcode(?pw) nco:country(?pw) nco:contactUID(<%s>) " \ - "nco:title(?a) nco:phoneNumber(?t) " \ + "nco:title(?a) ?t nco:pobox(?po) nco:extendedAddress(?po) " \ + "nco:streetAddress(?po) nco:locality(?po) nco:region(?po) " \ + "nco:postalcode(?po) nco:country(?po) nco:emailAddress(?eo) " \ + "?vc " \ "\"NOTACALL\" \"false\" \"false\" <%s> " \ "WHERE { " \ - "<%s> a nco:Contact . " \ - "OPTIONAL { <%s> nco:hasPhoneNumber ?h . \ - OPTIONAL {" \ + "<%s> a nco:PersonContact . " \ + "OPTIONAL { <%s> nco:hasPhoneNumber ?h . " \ + "OPTIONAL {" \ "?h a nco:FaxNumber ; " \ "nco:phoneNumber ?f . " \ "}" \ "OPTIONAL {" \ + "?h a nco:CellPhoneNumber ; " \ + "nco:phoneNumber ?vc" \ + "}" \ + "OPTIONAL {" \ "?h a nco:VoicePhoneNumber ; " \ - "nco:phoneNumber ?v" \ + "nco:phoneNumber ?t" \ "}" \ "}" \ - "OPTIONAL { <%s> nco:hasEmailAddress ?e . } " \ - "OPTIONAL { <%s> nco:hasPostalAddress ?p . } " \ "OPTIONAL { " \ "<%s> nco:hasAffiliation ?a . " \ - "OPTIONAL { ?a nco:hasPhoneNumber ?w . }" \ - "OPTIONAL { ?a nco:hasEmailAddress ?ew . }" \ - "OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ + "OPTIONAL { ?a rdfs:label \"Work\" . " \ + "OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \ + "OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \ + "OPTIONAL { ?a nco:hasPhoneNumber ?w . } " \ + "}" \ + "OPTIONAL { ?a rdfs:label \"Home\" . " \ + "OPTIONAL { ?a nco:hasEmailAddress ?e . } " \ + "OPTIONAL { ?a nco:hasPostalAddress ?p . } " \ + "OPTIONAL { ?a nco:hasPhoneNumber ?v . } " \ + "}" \ "OPTIONAL { ?a nco:org ?o . } " \ "} " \ + "OPTIONAL { <%s> nco:hasPostalAddress ?po . } " \ + "OPTIONAL { <%s> nco:hasEmailAddress ?eo . } " \ "}"#define CONTACTS_OTHER_QUERY_FROM_URI \
Signature · 1 line
1.7.0.4
PATCH 7/7 Changed number of fields selected via pbap queries
In reply to Bartosz SzatkowskiAfter fixing type handling in PBAP, there are more fields selected in each query, contacts_other_query_from_uri needed to be adjusted.
--- plugins/phonebook-tracker.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
plugins/phonebook-tracker.c +1 -0
@@ -822,6 +822,7 @@"SELECT \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" " \"\"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" " \"\"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" " \ +"\"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" " \"nco:phoneNumber(?t) \"NOTACALL\" \"false\" \"false\" <%s> " \"WHERE { " \"<%s> a nco:Contact . " \
Signature · 1 line
1.7.0.4
Hi Bartosz,
Quoted 6 lines · Bartosz Szatkowski
Previously all phone numbers, addresses and emails was considered to be "work". Now there are three working types for emails and addresses: "work", "home", "other" and four for phone numbers - these three as well as "cell".
--- plugins/phonebook-tracker.c | 61 +++++++++++++++++++++++++++++++------------ 1 files changed, 44 insertions(+), 17 deletions(-)
All seven patches have been pushed upstream. Thanks.
Johan