From d688eb5196c2da4b9b5b7c83ce2195d73c453db8 Mon Sep 17 00:00:00 2001 From: Ricki Hirner Date: Sun, 18 Sep 2016 16:38:41 +0200 Subject: [PATCH] Always use PROPFIND instead of REPORT addressbook-query --- app/build.gradle | 5 ++-- .../syncadapter/ContactsSyncManager.java | 24 ++++++------------- app/src/main/res/layout/about_component.xml | 1 + cert4android | 2 +- dav4android | 2 +- ical4android | 2 +- vcard4android | 2 +- 7 files changed, 14 insertions(+), 24 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e9bcb19a..e12f1204 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,7 +10,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 24 - buildToolsVersion "24.0.1" + buildToolsVersion '24.0.2' defaultConfig { applicationId "at.bitfire.davdroid" @@ -62,6 +62,7 @@ android { } dependencies { + compile project(':cert4android') compile project(':dav4android') compile project(':ical4android') compile project(':vcard4android') @@ -72,13 +73,11 @@ dependencies { compile 'com.android.support:preference-v14:24.+' compile 'com.github.yukuku:ambilwarna:2.0.1' - compile project(':cert4android') compile 'dnsjava:dnsjava:2.1.7' compile 'org.apache.commons:commons-lang3:3.4' compile 'org.apache.commons:commons-collections4:4.1' provided 'org.projectlombok:lombok:1.16.10' - // for tests testCompile 'junit:junit:4.12' testCompile 'com.squareup.okhttp3:mockwebserver:3.4.1' diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java index 01c7735f..5cd207a4 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java @@ -47,6 +47,7 @@ import at.bitfire.dav4android.property.AddressData; import at.bitfire.dav4android.property.GetCTag; import at.bitfire.dav4android.property.GetContentType; import at.bitfire.dav4android.property.GetETag; +import at.bitfire.dav4android.property.ResourceType; import at.bitfire.dav4android.property.SupportedAddressData; import at.bitfire.davdroid.AccountSettings; import at.bitfire.davdroid.App; @@ -269,26 +270,15 @@ public class ContactsSyncManager extends SyncManager { @Override protected void listRemote() throws IOException, HttpException, DavException { // fetch list of remote VCards and build hash table to index file name - - try { - davAddressBook().addressbookQuery(); - } catch(HttpException e) { - /* non-successful responses to CARDDAV:addressbook-query with empty filter, tested on 2015/10/21 - * fastmail.com 403 Forbidden (DAV:error CARDDAV:supported-filter) - * mailbox.org (OpenXchange) 400 Bad Request - * SOGo 207 Multi-status, but without entries http://www.sogo.nu/bugs/view.php?id=3370 - * Zimbra ZCS 500 Server Error https://bugzilla.zimbra.com/show_bug.cgi?id=101902 - */ - if (e.status == 400 || e.status == 403 || e.status == 500 || e.status == 501) { - App.log.log(Level.WARNING, "Server error on REPORT addressbook-query, falling back to PROPFIND", e); - davAddressBook().propfind(1, GetETag.NAME); - } else - // no defined fallback, pass through exception - throw e; - } + davAddressBook().propfind(1, ResourceType.NAME, GetETag.NAME); remoteResources = new HashMap<>(davCollection.members.size()); for (DavResource vCard : davCollection.members) { + // ignore member collections + ResourceType type = (ResourceType)vCard.properties.get(ResourceType.NAME); + if (type != null && type.types.contains(ResourceType.COLLECTION)) + continue; + String fileName = vCard.fileName(); App.log.fine("Found remote VCard: " + fileName); remoteResources.put(fileName, vCard); diff --git a/app/src/main/res/layout/about_component.xml b/app/src/main/res/layout/about_component.xml index cf45d0c8..f030f766 100644 --- a/app/src/main/res/layout/about_component.xml +++ b/app/src/main/res/layout/about_component.xml @@ -51,6 +51,7 @@ android:layout_marginBottom="32dp"/>