Disabled support Yandex contacs in Evolution due to strange behaviour of Yandex carddav

i9
Alexey Berezhok 2 years ago
parent d07e341d7e
commit e6d1745934

@ -1,4 +1,4 @@
From 1c142459975a8703b6a5771f576a1e3736360954 Mon Sep 17 00:00:00 2001 From 0ce2679b7840f69ce6f632959b2e7789cffca13a Mon Sep 17 00:00:00 2001
From: Alexey Berezhok <alexey.berezhok@softline.com> From: Alexey Berezhok <alexey.berezhok@softline.com>
Date: Mon, 15 May 2023 19:07:27 +0300 Date: Mon, 15 May 2023 19:07:27 +0300
Subject: [PATCH] Added yandex backend support(prebuild) Subject: [PATCH] Added yandex backend support(prebuild)
@ -29,8 +29,8 @@ Subject: [PATCH] Added yandex backend support(prebuild)
src/modules/CMakeLists.txt | 1 + src/modules/CMakeLists.txt | 1 +
.../module-gnome-online-accounts.c | 3 + .../module-gnome-online-accounts.c | 3 +
src/modules/yandex-backend/CMakeLists.txt | 23 + src/modules/yandex-backend/CMakeLists.txt | 23 +
.../yandex-backend/module-yandex-backend.c | 727 ++++++++++++++++++ .../yandex-backend/module-yandex-backend.c | 619 ++++++++++++++++++
26 files changed, 1229 insertions(+), 3 deletions(-) 26 files changed, 1121 insertions(+), 3 deletions(-)
create mode 100644 src/camel/camel-sasl-xoauth2-yandex.c create mode 100644 src/camel/camel-sasl-xoauth2-yandex.c
create mode 100644 src/camel/camel-sasl-xoauth2-yandex.h create mode 100644 src/camel/camel-sasl-xoauth2-yandex.h
create mode 100644 src/libedataserver/e-oauth2-service-yandex.c create mode 100644 src/libedataserver/e-oauth2-service-yandex.c
@ -873,10 +873,10 @@ index 0000000..2416fa1
+) +)
diff --git a/src/modules/yandex-backend/module-yandex-backend.c b/src/modules/yandex-backend/module-yandex-backend.c diff --git a/src/modules/yandex-backend/module-yandex-backend.c b/src/modules/yandex-backend/module-yandex-backend.c
new file mode 100644 new file mode 100644
index 0000000..bb6dfc1 index 0000000..a99d35c
--- /dev/null --- /dev/null
+++ b/src/modules/yandex-backend/module-yandex-backend.c +++ b/src/modules/yandex-backend/module-yandex-backend.c
@@ -0,0 +1,727 @@ @@ -0,0 +1,619 @@
+/* +/*
+ * module-yandex-backend.c + * module-yandex-backend.c
+ * + *
@ -1039,57 +1039,6 @@ index 0000000..bb6dfc1
+ return result; + return result;
+} +}
+ +
+static void
+yandex_backend_add_contacts (ECollectionBackend *backend)
+{
+ ESource *source;
+ ESource *collection_source;
+ ESourceRegistryServer *server;
+ ESourceExtension *extension;
+ ESourceCollection *collection_extension;
+ const gchar *backend_name;
+ const gchar *extension_name;
+ const gchar *resource_id;
+
+ collection_source = e_backend_get_source (E_BACKEND (backend));
+
+ resource_id = YANDEX_CONTACTS_RESOURCE_ID;
+ source = e_collection_backend_new_child (backend, resource_id);
+ e_source_set_display_name (source, _("Contacts"));
+
+ /* Add the address book source to the collection. */
+ collection_extension = e_source_get_extension (
+ collection_source, E_SOURCE_EXTENSION_COLLECTION);
+
+ /* Configure the address book source. */
+
+ backend_name = YANDEX_CONTACTS_BACKEND_NAME;
+
+ extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
+ extension = e_source_get_extension (source, extension_name);
+
+ e_source_backend_set_backend_name (
+ E_SOURCE_BACKEND (extension), backend_name);
+
+ extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
+ extension = e_source_get_extension (source, extension_name);
+
+ e_source_authentication_set_host (
+ E_SOURCE_AUTHENTICATION (extension),
+ YANDEX_CONTACTS_HOST);
+
+ e_binding_bind_property (
+ collection_extension, "identity",
+ extension, "user",
+ G_BINDING_SYNC_CREATE);
+
+ server = e_collection_backend_ref_server (backend);
+ e_source_registry_server_add_source (server, source);
+ g_object_unref (server);
+
+ g_object_unref (source);
+}
+
+static gchar * +static gchar *
+yandex_backend_get_resource_id (EWebDAVCollectionBackend *webdav_backend, +yandex_backend_get_resource_id (EWebDAVCollectionBackend *webdav_backend,
+ ESource *source) + ESource *source)
@ -1136,14 +1085,6 @@ index 0000000..bb6dfc1
+ /* Chain up to parent's method. */ + /* Chain up to parent's method. */
+ E_COLLECTION_BACKEND_CLASS (e_yandex_backend_parent_class)->populate (backend); + E_COLLECTION_BACKEND_CLASS (e_yandex_backend_parent_class)->populate (backend);
+ +
+ if (e_source_collection_get_contacts_enabled (collection_extension)) {
+ GList *list;
+
+ list = e_collection_backend_list_contacts_sources (backend);
+ if (list == NULL)
+ yandex_backend_add_contacts (backend);
+ g_list_free_full (list, (GDestroyNotify) g_object_unref);
+ }
+} +}
+ +
+static gboolean +static gboolean
@ -1264,41 +1205,6 @@ index 0000000..bb6dfc1
+ yandex_backend_calendar_update_auth_method (E_COLLECTION_BACKEND (backend), child_source, e_backend_get_source (backend)); + yandex_backend_calendar_update_auth_method (E_COLLECTION_BACKEND (backend), child_source, e_backend_get_source (backend));
+} +}
+ +
+static void
+yandex_backend_contacts_update_auth_method (ESource *child_source,
+ ESource *master_source)
+{
+ EOAuth2Support *oauth2_support;
+ ESourceAuthentication *extension;
+ const gchar *method;
+
+ extension = e_source_get_extension (child_source, E_SOURCE_EXTENSION_AUTHENTICATION);
+
+ if (!yandex_backend_is_yandex_host (extension, NULL))
+ return;
+
+ oauth2_support = e_server_side_source_ref_oauth2_support (E_SERVER_SIDE_SOURCE (child_source));
+ if (!oauth2_support && master_source)
+ oauth2_support = e_server_side_source_ref_oauth2_support (E_SERVER_SIDE_SOURCE (master_source));
+
+ if (oauth2_support)
+ method = "OAuth2";
+ else
+ method = NULL;
+
+ e_source_authentication_set_method (extension, method);
+
+ g_clear_object (&oauth2_support);
+}
+
+static void
+yandex_backend_contacts_update_auth_method_cb (ESource *child_source,
+ GParamSpec *param,
+ EBackend *backend)
+{
+ yandex_backend_contacts_update_auth_method (child_source, e_backend_get_source (backend));
+}
+
+static gchar * +static gchar *
+yandex_backend_dup_resource_id (ECollectionBackend *backend, +yandex_backend_dup_resource_id (ECollectionBackend *backend,
+ ESource *child_source) + ESource *child_source)
@ -1398,20 +1304,6 @@ index 0000000..bb6dfc1
+ backend); + backend);
+ } + }
+ +
+ extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
+ if (e_source_has_extension (child_source, extension_name)) {
+ yandex_backend_contacts_update_auth_method (child_source, collection_source);
+ g_signal_connect (
+ child_source, "notify::oauth2-support",
+ G_CALLBACK (yandex_backend_contacts_update_auth_method_cb),
+ backend);
+
+ if (!has_external_auth) {
+ /* Even the book is part of the collection it can be removed
+ separately, if not configured through GOA or UOA. */
+ e_server_side_source_set_removable (E_SERVER_SIDE_SOURCE (child_source), TRUE);
+ }
+ }
+} +}
+ +
+static void +static void

Loading…
Cancel
Save