1
0
mirror of https://github.com/etesync/android synced 2024-11-29 11:28:19 +00:00

Find collections when they're identical with their home set

This commit is contained in:
Ricki Hirner 2016-04-18 00:04:18 +02:00
parent 03c15a6924
commit fb0552de46
2 changed files with 8 additions and 3 deletions

View File

@ -228,7 +228,9 @@ public class DavService extends Service {
DavResource dav = new DavResource(httpClient, homeSet); DavResource dav = new DavResource(httpClient, homeSet);
try { try {
dav.propfind(1, CollectionInfo.DAV_PROPERTIES); dav.propfind(1, CollectionInfo.DAV_PROPERTIES);
for (DavResource member : dav.members) { Set<DavResource> selfAndMembers = new HashSet<>(dav.members);
selfAndMembers.add(dav);
for (DavResource member : selfAndMembers) {
CollectionInfo info = CollectionInfo.fromDavResource(member); CollectionInfo info = CollectionInfo.fromDavResource(member);
info.confirmed = true; info.confirmed = true;
App.log.log(Level.FINE, "Found collection", info); App.log.log(Level.FINE, "Found collection", info);

View File

@ -209,8 +209,11 @@ public class DavResourceFinder {
// Does the collection refer to address book homesets? // Does the collection refer to address book homesets?
AddressbookHomeSet homeSets = (AddressbookHomeSet)dav.properties.get(AddressbookHomeSet.NAME); AddressbookHomeSet homeSets = (AddressbookHomeSet)dav.properties.get(AddressbookHomeSet.NAME);
if (homeSets != null) if (homeSets != null)
for (String href : homeSets.hrefs) for (String href : homeSets.hrefs) {
config.homeSets.add(UrlUtils.withTrailingSlash(dav.location.resolve(href)).uri()); HttpUrl location = UrlUtils.withTrailingSlash(dav.location.resolve(href));
log.info("Found addressbook home-set at " + location);
config.homeSets.add(location.uri());
}
} }
protected void rememberIfCalendarOrHomeset(@NonNull DavResource dav, @NonNull Configuration.ServiceInfo config) { protected void rememberIfCalendarOrHomeset(@NonNull DavResource dav, @NonNull Configuration.ServiceInfo config) {