1 /* 2 * Copyright (C) 2015 Red Hat, Inc. (www.redhat.com) 3 * 4 * This library is free software: you can redistribute it and/or modify it 5 * under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation. 7 * 8 * This library is distributed in the hope that it will be useful, but 9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 11 * for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this library. If not, see <http://www.gnu.org/licenses/>. 15 * 16 */ 17 18 #if !defined (__LIBEDATASERVER_H_INSIDE__) && !defined (LIBEDATASERVER_COMPILATION) 19 #error "Only <libedataserver/libedataserver.h> should be included directly." 20 #endif 21 22 #ifndef E_WEBDAV_DISCOVER_H 23 #define E_WEBDAV_DISCOVER_H 24 25 #include <glib.h> 26 27 #include <libedataserver/e-source.h> 28 #include <libedataserver/e-webdav-session.h> 29 30 #define E_TYPE_WEBDAV_DISCOVERED_SOURCE (e_webdav_discovered_source_get_type ()) 31 32 G_BEGIN_DECLS 33 34 typedef enum { 35 E_WEBDAV_DISCOVER_SUPPORTS_NONE = E_WEBDAV_RESOURCE_SUPPORTS_NONE, 36 E_WEBDAV_DISCOVER_SUPPORTS_CONTACTS = E_WEBDAV_RESOURCE_SUPPORTS_CONTACTS, 37 E_WEBDAV_DISCOVER_SUPPORTS_EVENTS = E_WEBDAV_RESOURCE_SUPPORTS_EVENTS, 38 E_WEBDAV_DISCOVER_SUPPORTS_MEMOS = E_WEBDAV_RESOURCE_SUPPORTS_MEMOS, 39 E_WEBDAV_DISCOVER_SUPPORTS_TASKS = E_WEBDAV_RESOURCE_SUPPORTS_TASKS, 40 E_WEBDAV_DISCOVER_SUPPORTS_WEBDAV_NOTES = E_WEBDAV_RESOURCE_SUPPORTS_WEBDAV_NOTES, 41 E_WEBDAV_DISCOVER_SUPPORTS_CALENDAR_AUTO_SCHEDULE = E_WEBDAV_RESOURCE_SUPPORTS_LAST << 1, 42 E_WEBDAV_DISCOVER_SUPPORTS_SUBSCRIBED_ICALENDAR = E_WEBDAV_DISCOVER_SUPPORTS_CALENDAR_AUTO_SCHEDULE << 1 43 } EWebDAVDiscoverSupports; 44 45 typedef struct _EWebDAVDiscoveredSource { 46 gchar *href; 47 guint32 supports; 48 gchar *display_name; 49 gchar *description; 50 gchar *color; 51 guint order; 52 } EWebDAVDiscoveredSource; 53 54 void e_webdav_discover_free_discovered_sources 55 (GSList *discovered_sources); 56 57 void e_webdav_discover_sources (ESource *source, 58 const gchar *url_use_path, 59 guint32 only_supports, 60 const ENamedParameters *credentials, 61 GCancellable *cancellable, 62 GAsyncReadyCallback callback, 63 gpointer user_data); 64 65 gboolean e_webdav_discover_sources_finish (ESource *source, 66 GAsyncResult *result, 67 gchar **out_certificate_pem, 68 GTlsCertificateFlags *out_certificate_errors, 69 GSList **out_discovered_sources, 70 GSList **out_calendar_user_addresses, 71 GError **error); 72 73 gboolean e_webdav_discover_sources_sync (ESource *source, 74 const gchar *url_use_path, 75 guint32 only_supports, 76 const ENamedParameters *credentials, 77 gchar **out_certificate_pem, 78 GTlsCertificateFlags *out_certificate_errors, 79 GSList **out_discovered_sources, 80 GSList **out_calendar_user_addresses, 81 GCancellable *cancellable, 82 GError **error); 83 84 GType e_webdav_discovered_source_get_type (void) G_GNUC_CONST; 85 EWebDAVDiscoveredSource * 86 e_webdav_discovered_source_copy (EWebDAVDiscoveredSource *discovered_source); 87 void e_webdav_discovered_source_free (EWebDAVDiscoveredSource *discovered_source); 88 89 /** 90 * EWebDAVDiscoverRefSourceFunc: 91 * @user_data: user data, as passed to e_webdav_discover_sources_full() or 92 * e_webdav_discover_sources_full_sync() 93 * @uid: an #ESource UID to return 94 * 95 * Returns: (transfer full) (nullable): an #ESource with UID @uid, or %NULL, if not found. 96 * Dereference the returned non-NULL #ESource with g_object_unref(), when no longer needed. 97 * 98 * Since: 3.30 99 **/ 100 typedef ESource * (* EWebDAVDiscoverRefSourceFunc) (gpointer user_data, 101 const gchar *uid); 102 103 void e_webdav_discover_sources_full (ESource *source, 104 const gchar *url_use_path, 105 guint32 only_supports, 106 const ENamedParameters *credentials, 107 EWebDAVDiscoverRefSourceFunc ref_source_func, 108 gpointer ref_source_func_user_data, 109 GCancellable *cancellable, 110 GAsyncReadyCallback callback, 111 gpointer user_data); 112 113 gboolean e_webdav_discover_sources_full_sync (ESource *source, 114 const gchar *url_use_path, 115 guint32 only_supports, 116 const ENamedParameters *credentials, 117 EWebDAVDiscoverRefSourceFunc ref_source_func, 118 gpointer ref_source_func_user_data, 119 gchar **out_certificate_pem, 120 GTlsCertificateFlags *out_certificate_errors, 121 GSList **out_discovered_sources, 122 GSList **out_calendar_user_addresses, 123 GCancellable *cancellable, 124 GError **error); 125 126 G_END_DECLS 127 128 #endif /* E_WEBDAV_DISCOVER_H */ 129