Diff between 6b7ddd9de2589e6739d1f0e1930d9694431af307 and 52edd787fdaed77d59bb40494892754a451b675a

Changed Files

File Additions Deletions Status
obexd/plugins/phonebook-tracker.c +41 -15 modified
obexd/plugins/vcard.c +18 -0 modified
obexd/plugins/vcard.h +7 -0 modified

Full Patch

diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c
index f28b234..ee8c42d 100644
--- a/obexd/plugins/phonebook-tracker.c
+++ b/obexd/plugins/phonebook-tracker.c
@@ -47,14 +47,17 @@
 	"nco:nameFamily(?c) nco:nameGiven(?c) "				\
 	"nco:nameAdditional(?c) nco:nameHonorificPrefix(?c) "		\
 	"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) "		\
-	"nco:phoneNumber(?w) "						\
+	"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) "	\
+	"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) "	\
+	"nco:postalcode(?p) nco:country(?p) "				\
 	"WHERE { "							\
 		"?c a nco:PersonContact ; "				\
 		"nco:hasPhoneNumber ?h . "				\
 	"OPTIONAL { "							\
 		"?c nco:hasAffiliation ?a . "				\
 		"?a nco:hasPhoneNumber ?w . "				\
-		"?c nco:hasEmailAddress ?e"				\
+		"?c nco:hasEmailAddress ?e . "				\
+		"?c nco:hasPostalAddress ?p . "				\
 	"} "								\
 	"}"
 
@@ -73,7 +76,9 @@
 	"nco:nameFamily(?c) nco:nameGiven(?c) "				\
 	"nco:nameAdditional(?c) nco:nameHonorificPrefix(?c) "		\
 	"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) "		\
-	"nco:phoneNumber(?w) "						\
+	"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) "	\
+	"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) "	\
+	"nco:postalcode(?p) nco:country(?p) "				\
 	"WHERE { "							\
 		"?call a nmo:Call ; "					\
 		"nmo:from ?c ; "					\
@@ -84,7 +89,8 @@
 	"OPTIONAL { "							\
 		"?c nco:hasAffiliation ?a . "				\
 		"?a nco:hasPhoneNumber ?w . "				\
-		"?c nco:hasEmailAddress ?e"				\
+		"?c nco:hasEmailAddress ?e . "				\
+		"?c nco:hasPostalAddress ?p . "				\
 	"} "								\
 	"} ORDER BY DESC(nmo:receivedDate(?call))"
 
@@ -107,7 +113,9 @@
 	"nco:nameFamily(?c) nco:nameGiven(?c) "				\
 	"nco:nameAdditional(?c) nco:nameHonorificPrefix(?c) "		\
 	"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) "		\
-	"nco:phoneNumber(?w) "						\
+	"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) "	\
+	"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) "	\
+	"nco:postalcode(?p) nco:country(?p) "				\
 	"WHERE { "							\
 		"?call a nmo:Call ; "					\
 		"nmo:from ?c ; "					\
@@ -117,7 +125,8 @@
 	"OPTIONAL { "							\
 		"?c nco:hasAffiliation ?a . "				\
 		"?a nco:hasPhoneNumber ?w . "				\
-		"?c nco:hasEmailAddress ?e"				\
+		"?c nco:hasEmailAddress ?e . "				\
+		"?c nco:hasPostalAddress ?p . "				\
 	"} "								\
 	"} ORDER BY DESC(nmo:receivedDate(?call))"
 
@@ -139,7 +148,9 @@
 	"nco:nameFamily(?c) nco:nameGiven(?c) "				\
 	"nco:nameAdditional(?c) nco:nameHonorificPrefix(?c) "		\
 	"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) "		\
-	"nco:phoneNumber(?w) "						\
+	"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) "	\
+	"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) "	\
+	"nco:postalcode(?p) nco:country(?p) "				\
 	"WHERE { "							\
 		"?call a nmo:Call ; "					\
 		"nmo:to ?c ; "						\
@@ -149,7 +160,8 @@
 	"OPTIONAL { "							\
 		"?c nco:hasAffiliation ?a . "				\
 		"?a nco:hasPhoneNumber ?w . "				\
-		"?c nco:hasEmailAddress ?e"				\
+		"?c nco:hasEmailAddress ?e . "				\
+		"?c nco:hasPostalAddress ?p . "				\
 	"} "								\
 	"} ORDER BY DESC(nmo:sentDate(?call))"
 
@@ -171,7 +183,9 @@
 	"nco:nameFamily(?c) nco:nameGiven(?c) "				\
 	"nco:nameAdditional(?c) nco:nameHonorificPrefix(?c) "		\
 	"nco:nameHonorificSuffix(?c) nco:emailAddress(?e) "		\
-	"nco:phoneNumber(?w) "						\
+	"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) "	\
+	"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) "	\
+	"nco:postalcode(?p) nco:country(?p) "				\
 	"WHERE { "							\
 	"{ "								\
 		"?call a nmo:Call ; "					\
@@ -182,7 +196,8 @@
 		"OPTIONAL { "						\
 			"?c nco:hasAffiliation ?a . "			\
 			"?a nco:hasPhoneNumber ?w . "			\
-			"?c nco:hasEmailAddress ?e"			\
+			"?c nco:hasEmailAddress ?e . "			\
+			"?c nco:hasPostalAddress ?p . "			\
 		"} "							\
 	"} UNION { "							\
 		"?call a nmo:Call ; "					\
@@ -193,7 +208,8 @@
 		"OPTIONAL { "						\
 			"?c nco:hasAffiliation ?a . "			\
 			"?a nco:hasPhoneNumber ?w . "			\
-			"?c nco:hasEmailAddress ?e"			\
+			"?c nco:hasEmailAddress ?e . "			\
+			"?c nco:hasPostalAddress ?p . "			\
 		"} "							\
 	"} } "
 
@@ -223,7 +239,9 @@
 	"nco:nameFamily(?c) nco:nameGiven(?c) nco:nameAdditional(?c) "	\
 	"nco:nameHonorificPrefix(?c) nco:nameHonorificSuffix(?c)  "	\
 	"nco:emailAddress(?e) "						\
-	"nco:phoneNumber(?w) "						\
+	"nco:phoneNumber(?w) nco:pobox(?p) nco:extendedAddress(?p) "	\
+	"nco:streetAddress(?p) nco:locality(?p) nco:region(?p) "	\
+	"nco:postalcode(?p) nco:country(?p) "				\
 	"WHERE { "							\
 		"?c a nco:PersonContact ; "				\
 		"nco:contactUID <%s> ; "				\
@@ -231,7 +249,8 @@
 	"OPTIONAL { "							\
 		"?c nco:hasAffiliation ?a . "				\
 		"?a nco:hasPhoneNumber ?w . "				\
-		"?c nco:hasEmailAddress ?e"				\
+		"?c nco:hasEmailAddress ?e . "				\
+		"?c nco:hasPostalAddress ?p . "				\
 	"} "								\
 	"}"
 
@@ -486,6 +505,13 @@ add_entry:
 	contact->prefix = g_strdup(reply[5]);
 	contact->suffix = g_strdup(reply[6]);
 	contact->email = g_strdup(reply[7]);
+	contact->pobox = g_strdup(reply[9]);
+	contact->extended = g_strdup(reply[10]);
+	contact->street = g_strdup(reply[11]);
+	contact->locality = g_strdup(reply[12]);
+	contact->region = g_strdup(reply[13]);
+	contact->postal = g_strdup(reply[14]);
+	contact->country = g_strdup(reply[15]);
 
 	number = g_new0(struct phonebook_number, 1);
 	number->tel = g_strdup(reply[0]);
@@ -650,7 +676,7 @@ int phonebook_pull(const char *name, const struct apparam_field *params,
 	data->user_data = user_data;
 	data->cb = cb;
 
-	return query_tracker(query, 9, pull_contacts, data);
+	return query_tracker(query, 16, pull_contacts, data);
 }
 
 int phonebook_get_entry(const char *folder, const char *id,
@@ -672,7 +698,7 @@ int phonebook_get_entry(const char *folder, const char *id,
 
 	query = g_strdup_printf(CONTACTS_QUERY_FROM_URI, id);
 
-	ret = query_tracker(query, 9, pull_contacts, data);
+	ret = query_tracker(query, 16, pull_contacts, data);
 
 	g_free(query);
 
diff --git a/obexd/plugins/vcard.c b/obexd/plugins/vcard.c
index 0bd2052..6c2445c 100644
--- a/obexd/plugins/vcard.c
+++ b/obexd/plugins/vcard.c
@@ -198,6 +198,14 @@ static void vcard_printf_email(GString *vcards, const char *email)
 	}
 }
 
+static void vcard_printf_adr(GString *vcards, struct phonebook_contact *contact)
+{
+	vcard_printf(vcards, "ADR:%s;%s;%s;%s;%s;%s;%s", contact->pobox,
+					contact->extended, contact->street,
+					contact->locality, contact->region,
+					contact->postal, contact->country);
+}
+
 static void vcard_printf_end(GString *vcards)
 {
 	vcard_printf(vcards, "END:VCARD");
@@ -249,6 +257,9 @@ void phonebook_add_contact(GString *vcards, struct phonebook_contact *contact,
 	if (filter & FILTER_EMAIL)
 		vcard_printf_email(vcards, contact->email);
 
+	if (filter & FILTER_ADR)
+		vcard_printf_adr(vcards, contact);
+
 	vcard_printf_end(vcards);
 }
 
@@ -275,5 +286,12 @@ void phonebook_contact_free(struct phonebook_contact *contact)
 	g_free(contact->email);
 	g_free(contact->prefix);
 	g_free(contact->suffix);
+	g_free(contact->pobox);
+	g_free(contact->extended);
+	g_free(contact->street);
+	g_free(contact->locality);
+	g_free(contact->region);
+	g_free(contact->postal);
+	g_free(contact->country);
 	g_free(contact);
 }
diff --git a/obexd/plugins/vcard.h b/obexd/plugins/vcard.h
index 45b82d7..f2b5c09 100644
--- a/obexd/plugins/vcard.h
+++ b/obexd/plugins/vcard.h
@@ -41,6 +41,13 @@ struct phonebook_contact {
 	char *email;
 	char *prefix;
 	char *suffix;
+	char *pobox;
+	char *extended;
+	char *street;
+	char *locality;
+	char *region;
+	char *postal;
+	char *country;
 };
 
 void phonebook_add_contact(GString *vcards, struct phonebook_contact *contact,