diff options
author | Milan Crha <mcrha@redhat.com> | 2015-08-13 13:00:36 +0200 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2015-08-13 13:00:36 +0200 |
commit | 5dd2bdddb1d4dedd21982851c94c7b0dadcf05bc (patch) | |
tree | 5eb53132c76515cbeac7ae51911406ac73a5f6fc /addressbook | |
parent | 6668200ca90db865ca610037e4a9aa1e81d46787 (diff) | |
download | evolution-data-server-5dd2bdddb1d4dedd21982851c94c7b0dadcf05bc.tar.gz |
Bug 684456 - Google Contacts: Support vCard REV attribute
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/backends/google/e-book-backend-google.c | 8 | ||||
-rw-r--r-- | addressbook/backends/google/e-book-google-utils.c | 22 |
2 files changed, 27 insertions, 3 deletions
diff --git a/addressbook/backends/google/e-book-backend-google.c b/addressbook/backends/google/e-book-backend-google.c index b3e402254..7e106c526 100644 --- a/addressbook/backends/google/e-book-backend-google.c +++ b/addressbook/backends/google/e-book-backend-google.c @@ -199,10 +199,10 @@ migrate_cache (EBookBackendCache *cache) g_return_if_fail (cache != NULL); version = e_file_cache_get_object (E_FILE_CACHE (cache), version_key); - if (!version || atoi (version) < 1) { - /* not versioned yet, dump the cache and reload it from a server */ + if (!version || atoi (version) < 2) { + /* not versioned yet or too old, dump the cache and reload it from the server */ e_file_cache_clean (E_FILE_CACHE (cache)); - e_file_cache_add_object (E_FILE_CACHE (cache), version_key, "1"); + e_file_cache_add_object (E_FILE_CACHE (cache), version_key, "2"); } } @@ -1516,6 +1516,8 @@ book_backend_google_get_backend_property (EBookBackend *backend, } else if (g_str_equal (prop_name, BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS)) { return g_strjoin ( ",", + e_contact_field_name (E_CONTACT_UID), + e_contact_field_name (E_CONTACT_REV), e_contact_field_name (E_CONTACT_FULL_NAME), e_contact_field_name (E_CONTACT_EMAIL_1), diff --git a/addressbook/backends/google/e-book-google-utils.c b/addressbook/backends/google/e-book-google-utils.c index c8e5b4d43..6544b02eb 100644 --- a/addressbook/backends/google/e-book-google-utils.c +++ b/addressbook/backends/google/e-book-google-utils.c @@ -600,6 +600,28 @@ e_contact_new_from_gdata_entry (GDataEntry *entry, attr = e_vcard_attribute_new (NULL, EVC_UID); e_vcard_add_attribute_with_value (vcard, attr, uid); + /* REV */ + attr = e_vcard_attribute_new (NULL, EVC_REV); + if (gdata_entry_get_etag (entry)) { + e_vcard_add_attribute_with_value (vcard, attr, gdata_entry_get_etag (entry)); + } else { + GDateTime *dt; + gchar *rev = NULL; + + dt = g_date_time_new_from_unix_utc (gdata_entry_get_updated (entry)); + if (dt) { + rev = g_date_time_format (dt, "%Y-%m-%dT%H:%M:%S"); + g_date_time_unref (dt); + } + + if (!rev) + rev = g_strdup_printf ("%" G_GINT64_FORMAT, gdata_entry_get_updated (entry)); + + e_vcard_add_attribute_with_value (vcard, attr, rev); + + g_free (rev); + } + /* FN, N */ name = gdata_contacts_contact_get_name (GDATA_CONTACTS_CONTACT (entry)); if (name) { |