From 581cee897ecb7f1b6d4e873d82af12055492655e Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 25 Jul 2014 14:02:29 +0200 Subject: [PATCH] Google: remove SyncML template, combine CalDAV/CardDAV Google has turned off their SyncML server, so the corresponding "Google Contacts" template became useless and needs to be removed. It gets replaced by a "Google" template which combines the three different URLs currently used by Google for CalDAV/CardDAV. This new template can be used to configure a "target-config@google" with default calendar and address book database already enabled. The actual URL of these databases will be determined during the first sync using them. The template relies on the WebDAV backend's new capability to search multiple different entries in the syncURL property for databases. To avoid listing each calendar twice (once for the legacy URL, once with the new one) when using basic username/password authentication, the backend needs a special case for Google and detect that the legacy URL does not need to be checked. --- src/backends/webdav/WebDAVSource.cpp | 21 ++++++++++++++-- src/syncevo/Cmdline.cpp | 24 ++++++++++-------- src/templates/contexts/Google-Calendar.ini | 15 ----------- src/templates/contexts/Google.ini | 22 ++++++++++++++++ src/templates/servers/Google-Contacts.ini | 16 ------------ test/test-dbus.py | 29 +++++++++++----------- 6 files changed, 69 insertions(+), 58 deletions(-) delete mode 100644 src/templates/contexts/Google-Calendar.ini create mode 100644 src/templates/contexts/Google.ini delete mode 100644 src/templates/servers/Google-Contacts.ini diff --git a/src/backends/webdav/WebDAVSource.cpp b/src/backends/webdav/WebDAVSource.cpp index e9353230..4e61e4d9 100644 --- a/src/backends/webdav/WebDAVSource.cpp +++ b/src/backends/webdav/WebDAVSource.cpp @@ -967,6 +967,9 @@ bool WebDAVSource::findCollections(const boost::functiongetURI(); Neon::URI &newURI = candidate.m_uri; + bool success = false; + bool isWellKnown = boost::starts_with(candidate.m_uri.m_path, "/.well-known/"); + + // Special hack Google: if we already have results for the current CalDAV + // endpoint, then don't try the legacy one. + if (newURI.m_host == "www.google.com" && + (boost::starts_with(newURI.m_path, "/calendar/dav/") || newURI.m_path =="/calendar/dav") && + haveGoogleCalDAV2) { + SE_LOG_DEBUG(getDisplayName(), "skipping legacy Google CalDAV"); + goto next; + } // Accessing the well-known URIs should lead to a redirect, but // with Yahoo! Calendar all I got was a 502 "connection refused". @@ -1005,8 +1019,6 @@ bool WebDAVSource::findCollections(const boost::function