Introduce new source discoverer

The new source discoverer is a complete overhaul of
the current code. It is async-only, correctly threaded,
and easier to maintain.

A major new feature of this web source discoverer is
that it now pings the server to see if the URL feeds
us back with an iCalendar file.

Furthermore, it continues to use E-D-S WebDAV discovery
functions as a fallback mechanism.

Fixes #380
This commit is contained in:
Georges Basile Stavracas Neto
2019-07-13 16:04:30 -03:00
parent 2aa9bc1f61
commit 371fdbc881
6 changed files with 650 additions and 1 deletions
+52
View File
@@ -0,0 +1,52 @@
/* gcal-source-discoverer.h
*
* Copyright 2019 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include <gio/gio.h>
G_BEGIN_DECLS
/**
* GcalDiscovererError:
* @GCAL_SOURCE_DISCOVERER_ERROR_UNAUTHORIZED: indicated an invalid start date
*
* Errors that can generate.
*/
typedef enum
{
GCAL_SOURCE_DISCOVERER_ERROR_UNAUTHORIZED,
} GcalSourceDiscovererError;
#define GCAL_SOURCE_DISCOVERER_ERROR (gcal_source_discoverer_error_quark ())
GQuark gcal_source_discoverer_error_quark (void);
void gcal_discover_sources_from_uri (const gchar *uri,
const gchar *username,
const gchar *password,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GPtrArray* gcal_discover_sources_from_uri_finish (GAsyncResult *result,
GError **error);
G_END_DECLS