utils/source-discoverer: Set security method

Set the security method of the discovered source into the newly
created source. This should preserve the TLS security method in
these sources.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/40
This commit is contained in:
Georges Basile Stavracas Neto
2023-03-03 19:50:30 -03:00
parent 02c2119c39
commit 98f6ccdb88
+23
View File
@@ -97,6 +97,13 @@ create_source_for_uri (DiscovererData *data)
webdav = e_source_get_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
e_source_webdav_set_uri (webdav, guri);
/* Security */
if (g_strcmp0 (g_uri_get_scheme (guri), "https") == 0)
{
ESourceSecurity *security = e_source_get_extension (source, E_SOURCE_EXTENSION_SECURITY);
e_source_security_set_secure (security, TRUE);
}
return source;
}
@@ -154,6 +161,22 @@ create_discovered_source (ESource *source,
e_source_backend_set_backend_name (E_SOURCE_BACKEND (ext), "webcal");
}
/* Security */
if (e_source_has_extension (source, E_SOURCE_EXTENSION_SECURITY))
{
ESourceSecurity *new_security, *parent_security;
const gchar *method;
parent_security = e_source_get_extension (source, E_SOURCE_EXTENSION_SECURITY);
new_security = e_source_get_extension (new_source, E_SOURCE_EXTENSION_SECURITY);
method = e_source_security_get_method (parent_security);
GCAL_TRACE_MSG ("New source '%s' has security method \"%s\"", e_source_get_display_name (new_source), method);
e_source_security_set_method (new_security, method);
}
/* build up the new source */
e_source_set_display_name (new_source, discovered_source->display_name);