[evolution-ews/gnome-3-28] Skip empty street addresses in contacts
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/gnome-3-28] Skip empty street addresses in contacts
- Date: Fri, 20 Apr 2018 10:19:25 +0000 (UTC)
commit 6da448607db5484649c4061be75daec67d4fe235
Author: Milan Crha <mcrha redhat com>
Date: Fri Apr 20 12:18:38 2018 +0200
Skip empty street addresses in contacts
Online GAL could return Contact information with empty street
addresses, which had been shown empty in Evolution as well, but
such addresses do not have much meaning, thus skip them.
src/addressbook/e-book-backend-ews.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 2cff479..1957a36 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -422,6 +422,24 @@ copy_ews_address_to_contact_address (EContactAddress *contact_addr,
contact_addr->code = g_strdup (address->postal_code);
contact_addr->country = g_strdup (address->country);
}
+
+static gboolean
+ews_address_is_empty (const EwsAddress *address)
+{
+ if (!address)
+ return TRUE;
+
+#define is_empty_str(x) (!(x) || (!*(x)))
+
+ return is_empty_str (address->street) &&
+ is_empty_str (address->city) &&
+ is_empty_str (address->state) &&
+ is_empty_str (address->postal_code) &&
+ is_empty_str (address->country);
+
+#undef is_empty_str
+}
+
static void
set_address (EContact *contact,
EContactField field,
@@ -431,7 +449,7 @@ set_address (EContact *contact,
const EwsAddress *address;
address = e_ews_item_get_physical_address (item, item_field);
- if (address) {
+ if (address && !ews_address_is_empty (address)) {
EContactAddress *addr;
addr = g_new0 (EContactAddress, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]