[evolution-data-server] EWebDAVDiscover: Returns address books when asked for calendars only
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] EWebDAVDiscover: Returns address books when asked for calendars only
- Date: Thu, 13 Feb 2020 16:47:54 +0000 (UTC)
commit 67d2e8d33268fb33d34a3281922faa0469065990
Author: Milan Crha <mcrha redhat com>
Date: Thu Feb 13 17:48:12 2020 +0100
EWebDAVDiscover: Returns address books when asked for calendars only
Fix a bug that address books could be returned together with calendars,
even when had been asked to return calendars only. Found in gnome-calendar.
src/libedataserver/e-webdav-discover.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/libedataserver/e-webdav-discover.c b/src/libedataserver/e-webdav-discover.c
index 938d10b93..c0db831d7 100644
--- a/src/libedataserver/e-webdav-discover.c
+++ b/src/libedataserver/e-webdav-discover.c
@@ -41,6 +41,22 @@ typedef struct _WebDAVDiscoverData {
#define CUSTOM_SUPPORTS_FLAGS (E_WEBDAV_DISCOVER_SUPPORTS_CALENDAR_AUTO_SCHEDULE |
E_WEBDAV_DISCOVER_SUPPORTS_SUBSCRIBED_ICALENDAR)
+static gboolean
+e_webdav_discovery_already_discovered (const gchar *href,
+ const GSList *discovered_sources)
+{
+ GSList *link;
+
+ for (link = (GSList *) discovered_sources; link; link = g_slist_next (link)) {
+ EWebDAVDiscoveredSource *discovered = link->data;
+
+ if (discovered && g_strcmp0 (href, discovered->href) == 0)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
e_webdav_discover_split_resources (WebDAVDiscoverData *wdd,
const GSList *resources)
@@ -58,11 +74,14 @@ e_webdav_discover_split_resources (WebDAVDiscoverData *wdd,
resource->kind == E_WEBDAV_RESOURCE_KIND_SUBSCRIBED_ICALENDAR)) {
EWebDAVDiscoveredSource *discovered;
- if ((resource->kind == E_WEBDAV_RESOURCE_KIND_CALENDAR || resource->kind ==
E_WEBDAV_RESOURCE_KIND_SUBSCRIBED_ICALENDAR) &&
- (wdd->only_supports & (~CUSTOM_SUPPORTS_FLAGS)) !=
E_WEBDAV_DISCOVER_SUPPORTS_NONE &&
+ if ((wdd->only_supports & (~CUSTOM_SUPPORTS_FLAGS)) !=
E_WEBDAV_DISCOVER_SUPPORTS_NONE &&
(resource->supports & wdd->only_supports) == 0)
continue;
+ if (e_webdav_discovery_already_discovered (resource->href,
+ resource->kind == E_WEBDAV_RESOURCE_KIND_ADDRESSBOOK ? wdd->addressbooks :
wdd->calendars))
+ continue;
+
discovered = g_slice_new0 (EWebDAVDiscoveredSource);
discovered->href = g_strdup (resource->href);
discovered->supports = resource->supports;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]