=?utf-8?q?=5Bevolution-data-server=5D_google=3A_Make_=E2=80=98rel?= =?utf-8?b?4oCZIGFuZCDigJhsYWJlbOKAmSBtdXR1YWxseSBleGNsdXNpdmUgZm9yIGNl?= =?utf-8?q?rtain_elements?=



commit fb69c042a35a6e578b76d5b6073905384ded5b47
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Jun 16 11:45:56 2012 +0100

    google: Make ârelâ and âlabelâ mutually exclusive for certain elements
    
    Google lovingly decided to add an extra restriction on use of ârelâ and
    âlabelâ properties of elements in their Google Contacts API[1], meaning that
    we need to prefer vCard X-GOOGLE-LABEL values over TYPE values and ignore
    the TYPE values. If we donât, the server will reject contact entries.
    
    Closes: https://bugzilla.gnome.org/show_bug.cgi?id=675712
    
    [1]: https://developers.google.com/google-apps/contacts/v3/reference#extraRestrictionsOnSomeElements

 addressbook/backends/google/e-book-google-utils.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/addressbook/backends/google/e-book-google-utils.c b/addressbook/backends/google/e-book-google-utils.c
index b8cba06..8d63e66 100644
--- a/addressbook/backends/google/e-book-google-utils.c
+++ b/addressbook/backends/google/e-book-google-utils.c
@@ -1278,7 +1278,7 @@ gdata_gd_email_address_from_attribute (EVCardAttribute *attr,
 	values = e_vcard_attribute_get_values (attr);
 	if (values) {
 		GList *types;
-		gchar *rel;
+		gchar *rel = NULL;
 		const gchar *label;
 		gboolean primary;
 
@@ -1288,7 +1288,8 @@ gdata_gd_email_address_from_attribute (EVCardAttribute *attr,
 		else
 			primary = FALSE;
 
-		rel = google_rel_from_types (types);
+		if (label == NULL) /* rel and label are mutually exclusive (bgo#675712) */
+			rel = google_rel_from_types (types);
 		email = gdata_gd_email_address_new (values->data, rel, label, primary);
 		g_free (rel);
 
@@ -1353,7 +1354,7 @@ gdata_gd_phone_number_from_attribute (EVCardAttribute *attr,
 	if (values) {
 		GList *types;
 		gboolean primary;
-		gchar *rel;
+		gchar *rel = NULL;
 		const gchar *label;
 
 		types = get_google_primary_type_label (attr, &primary, &label);
@@ -1362,7 +1363,8 @@ gdata_gd_phone_number_from_attribute (EVCardAttribute *attr,
 		else
 			primary = FALSE;
 
-		rel = google_rel_from_types_phone (types);
+		if (label == NULL) /* rel and label are mutually exclusive (bgo#675712) */
+			rel = google_rel_from_types_phone (types);
 		number = gdata_gd_phone_number_new (values->data, rel, label, NULL, primary);
 		g_free (rel);
 
@@ -1386,7 +1388,7 @@ gdata_gd_postal_address_from_attribute (EVCardAttribute *attr,
 	values = e_vcard_attribute_get_values (attr);
 	if (values && values->data) {
 		GList *types, *value;
-		gchar *rel;
+		gchar *rel = NULL;
 		const gchar *label;
 		gboolean primary;
 
@@ -1396,7 +1398,8 @@ gdata_gd_postal_address_from_attribute (EVCardAttribute *attr,
 		else
 			primary = FALSE;
 
-		rel = google_rel_from_types (types);
+		if (label == NULL) /* rel and label are mutually exclusive (bgo#675712) */
+			rel = google_rel_from_types (types);
 		address = gdata_gd_postal_address_new (rel, label, primary);
 		g_free (rel);
 
@@ -1458,7 +1461,7 @@ gdata_gd_organization_from_attribute (EVCardAttribute *attr,
 	if (values) {
 		GList *types;
 		gboolean primary;
-		gchar *rel;
+		gchar *rel = NULL;
 		const gchar *label;
 
 		types = get_google_primary_type_label (attr, &primary, &label);
@@ -1467,7 +1470,8 @@ gdata_gd_organization_from_attribute (EVCardAttribute *attr,
 		else
 			primary = FALSE;
 
-		rel = google_rel_from_types (types);
+		if (label == NULL) /* rel and label are mutually exclusive (bgo#675712) */
+			rel = google_rel_from_types (types);
 		org = gdata_gd_organization_new (values->data, NULL, rel, label, primary);
 		if (values->next != NULL && values->next->data != NULL && *((gchar *) values->next->data) != '\0')
 			gdata_gd_organization_set_department (org, values->next->data);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]