[evolution-ews/wip/mcrha/office365: 43/50] Rename 'Office365' to 'Microsoft365', to match the service name
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/wip/mcrha/office365: 43/50] Rename 'Office365' to 'Microsoft365', to match the service name
- Date: Mon, 3 Aug 2020 15:24:08 +0000 (UTC)
commit 25d1ccf32d42141de90baa448add277d1e999368
Author: Milan Crha <mcrha redhat com>
Date: Fri Jul 24 12:58:15 2020 +0200
Rename 'Office365' to 'Microsoft365', to match the service name
CMakeLists.txt | 26 +-
config.h.in | 12 +-
po/POTFILES.in | 16 +-
src/CMakeLists.txt | 2 +-
src/{Office365 => Microsoft365}/CMakeLists.txt | 8 +-
.../addressbook/CMakeLists.txt | 30 +-
.../addressbook/e-book-backend-m365-factory.c | 73 +
.../addressbook/e-book-backend-m365.c} | 707 ++---
src/Microsoft365/addressbook/e-book-backend-m365.h | 32 +
src/Microsoft365/calendar/CMakeLists.txt | 61 +
.../calendar/e-cal-backend-m365-factory.c | 137 +
.../calendar/e-cal-backend-m365.c} | 969 +++---
src/Microsoft365/calendar/e-cal-backend-m365.h | 37 +
src/Microsoft365/camel/CMakeLists.txt | 75 +
.../camel/camel-m365-folder-summary.c} | 155 +-
src/Microsoft365/camel/camel-m365-folder-summary.h | 72 +
.../camel/camel-m365-folder.c} | 675 ++--
src/Microsoft365/camel/camel-m365-folder.h | 60 +
.../camel/camel-m365-message-info.c} | 161 +-
src/Microsoft365/camel/camel-m365-message-info.h | 70 +
.../camel/camel-m365-provider.c} | 57 +-
.../camel/camel-m365-store-summary.c} | 345 +-
src/Microsoft365/camel/camel-m365-store-summary.h | 189 ++
.../camel/camel-m365-store.c} | 753 +++--
src/Microsoft365/camel/camel-m365-store.h | 70 +
.../camel/camel-m365-transport.c} | 179 +-
src/Microsoft365/camel/camel-m365-transport.h | 50 +
.../camel/camel-m365-utils.c} | 213 +-
src/Microsoft365/camel/camel-m365-utils.h | 48 +
src/Microsoft365/camel/libcamelmicrosoft365.urls | 1 +
src/Microsoft365/common/CMakeLists.txt | 69 +
.../common/camel-m365-settings.c} | 287 +-
src/Microsoft365/common/camel-m365-settings.h | 126 +
.../common/camel-sasl-xoauth2-microsoft365.c | 45 +
.../common/camel-sasl-xoauth2-microsoft365.h | 54 +
.../common/e-m365-connection.c} | 1215 ++++---
.../common/e-m365-connection.h} | 411 ++-
src/Microsoft365/common/e-m365-enums.h | 26 +
src/Microsoft365/common/e-m365-json-utils.c | 3343 +++++++++++++++++++
src/Microsoft365/common/e-m365-json-utils.h | 919 ++++++
.../common/e-oauth2-service-microsoft365.c | 374 +++
.../common/e-oauth2-service-microsoft365.h | 54 +
.../common/e-source-m365-folder.c} | 113 +-
src/Microsoft365/common/e-source-m365-folder.h | 70 +
.../evolution/CMakeLists.txt | 16 +-
src/Microsoft365/evolution/e-book-config-m365.c | 66 +
src/Microsoft365/evolution/e-book-config-m365.h | 51 +
.../evolution/e-cal-config-m365.c} | 39 +-
src/Microsoft365/evolution/e-cal-config-m365.h | 51 +
.../evolution/e-mail-config-m365-backend.c} | 177 +-
.../evolution/e-mail-config-m365-backend.h | 53 +
.../evolution/module-m365-configuration.c | 41 +
src/Microsoft365/registry/CMakeLists.txt | 24 +
src/Microsoft365/registry/e-m365-backend-factory.c | 78 +
src/Microsoft365/registry/e-m365-backend-factory.h | 52 +
.../registry/e-m365-backend.c} | 419 ++-
src/Microsoft365/registry/e-m365-backend.h | 51 +
.../registry/e-source-m365-deltas.c} | 73 +-
src/Microsoft365/registry/e-source-m365-deltas.h | 61 +
src/Microsoft365/registry/module-m365-backend.c | 39 +
.../addressbook/e-book-backend-o365-factory.c | 84 -
src/Office365/addressbook/e-book-backend-o365.h | 43 -
src/Office365/calendar/CMakeLists.txt | 61 -
.../calendar/e-cal-backend-o365-factory.c | 148 -
src/Office365/calendar/e-cal-backend-o365.h | 48 -
src/Office365/camel/CMakeLists.txt | 75 -
src/Office365/camel/camel-o365-folder-summary.h | 83 -
src/Office365/camel/camel-o365-folder.h | 71 -
src/Office365/camel/camel-o365-message-info.h | 81 -
src/Office365/camel/camel-o365-store-summary.h | 200 --
src/Office365/camel/camel-o365-store.h | 81 -
src/Office365/camel/camel-o365-transport.h | 61 -
src/Office365/camel/camel-o365-utils.h | 59 -
src/Office365/camel/libcameloffice365.urls | 1 -
src/Office365/common/CMakeLists.txt | 69 -
src/Office365/common/camel-o365-settings.h | 137 -
src/Office365/common/e-o365-enums.h | 37 -
src/Office365/common/e-o365-json-utils.c | 3354 --------------------
src/Office365/common/e-o365-json-utils.h | 930 ------
src/Office365/common/e-source-o365-folder.h | 81 -
src/Office365/evolution/e-book-config-o365.c | 77 -
src/Office365/evolution/e-book-config-o365.h | 62 -
src/Office365/evolution/e-cal-config-o365.h | 62 -
.../evolution/e-mail-config-o365-backend.h | 64 -
.../evolution/module-o365-configuration.c | 52 -
src/Office365/registry/CMakeLists.txt | 24 -
src/Office365/registry/e-o365-backend-factory.c | 89 -
src/Office365/registry/e-o365-backend-factory.h | 63 -
src/Office365/registry/e-o365-backend.h | 62 -
src/Office365/registry/e-source-o365-deltas.h | 72 -
src/Office365/registry/module-o365-backend.c | 50 -
src/configuration/e-mail-config-ews-backend.c | 14 +-
src/server/CMakeLists.txt | 4 +
.../camel-sasl-xoauth2-office365.c | 0
.../camel-sasl-xoauth2-office365.h | 0
.../common => server}/e-oauth2-service-office365.c | 89 +-
.../common => server}/e-oauth2-service-office365.h | 0
97 files changed, 10106 insertions(+), 10062 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dd49041d..1d009c22 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -179,26 +179,26 @@ if(ENABLE_TESTS)
endif(ENABLE_TESTS)
# ******************************
-# Office365 OAuth2 support
+# Microsoft365 OAuth2 support
# ******************************
-add_printable_variable(WITH_OFFICE365_TENANT "Office365.com OAuth 2.0 tenant" "")
+add_printable_variable(WITH_MICROSOFT365_TENANT "Microsoft 365 OAuth 2.0 tenant" "")
-if(WITH_OFFICE365_TENANT STREQUAL "")
- set(WITH_OFFICE365_TENANT "common")
-endif(WITH_OFFICE365_TENANT STREQUAL "")
+if(WITH_MICROSOFT365_TENANT STREQUAL "")
+ set(WITH_MICROSOFT365_TENANT "common")
+endif(WITH_MICROSOFT365_TENANT STREQUAL "")
-add_printable_variable(WITH_OFFICE365_CLIENT_ID "Office365.com OAuth 2.0 client ID" "")
+add_printable_variable(WITH_MICROSOFT365_CLIENT_ID "Microsoft 365 OAuth 2.0 client ID" "")
-if(WITH_OFFICE365_CLIENT_ID STREQUAL "")
- set(WITH_OFFICE365_CLIENT_ID "20460e5d-ce91-49af-a3a5-70b6be7486d1")
-endif(WITH_OFFICE365_CLIENT_ID STREQUAL "")
+if(WITH_MICROSOFT365_CLIENT_ID STREQUAL "")
+ set(WITH_MICROSOFT365_CLIENT_ID "20460e5d-ce91-49af-a3a5-70b6be7486d1")
+endif(WITH_MICROSOFT365_CLIENT_ID STREQUAL "")
-add_printable_variable(WITH_OFFICE365_REDIRECT_URI "Office365.com OAuth 2.0 redirect URI" "")
+add_printable_variable(WITH_MICROSOFT365_REDIRECT_URI "Microsoft 365 OAuth 2.0 redirect URI" "")
-if(WITH_OFFICE365_REDIRECT_URI STREQUAL "")
- set(WITH_OFFICE365_REDIRECT_URI "https://login.microsoftonline.com/common/oauth2/nativeclient")
-endif(WITH_OFFICE365_REDIRECT_URI STREQUAL "")
+if(WITH_MICROSOFT365_REDIRECT_URI STREQUAL "")
+ set(WITH_MICROSOFT365_REDIRECT_URI "https://login.microsoftonline.com/common/oauth2/nativeclient")
+endif(WITH_MICROSOFT365_REDIRECT_URI STREQUAL "")
# ******************************
# Special directories
diff --git a/config.h.in b/config.h.in
index d755ed53..e20d5c96 100644
--- a/config.h.in
+++ b/config.h.in
@@ -24,11 +24,11 @@
/* libmspack has OAB support */
#cmakedefine WITH_MSPACK 1
-/* Define Office365 OAuth 2.0 default Tenant to use */
-#define OFFICE365_TENANT "@WITH_OFFICE365_TENANT@"
+/* Define Microsoft 365 OAuth 2.0 default Tenant to use */
+#define MICROSOFT365_TENANT "@WITH_MICROSOFT365_TENANT@"
-/* Define Office365 OAuth 2.0 default Client ID to use */
-#define OFFICE365_CLIENT_ID "@WITH_OFFICE365_CLIENT_ID@"
+/* Define Microsoft 365 OAuth 2.0 default Client ID to use */
+#define MICROSOFT365_CLIENT_ID "@WITH_MICROSOFT365_CLIENT_ID@"
-/* Define Office365 OAuth 2.0 default Redirect URI to use */
-#define OFFICE365_REDIRECT_URI "@WITH_OFFICE365_REDIRECT_URI@"
+/* Define Microsoft 365 OAuth 2.0 default Redirect URI to use */
+#define MICROSOFT365_REDIRECT_URI "@WITH_MICROSOFT365_REDIRECT_URI@"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2ca8abb5..0c3e1a0b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -27,11 +27,21 @@ src/configuration/e-mail-config-ews-folder-sizes-page.c
src/configuration/e-mail-config-ews-gal.c
src/configuration/e-mail-config-ews-ooo-page.c
src/configuration/module-ews-configuration.error.xml
+src/server/camel-sasl-xoauth2-office365.c
src/server/e-ews-calendar-utils.c
src/server/e-ews-camel-common.c
src/server/e-ews-connection.c
src/server/e-ews-connection-utils.c
src/server/e-ews-folder.c
-src/Office365/camel/camel-o365-provider.c
-src/Office365/common/camel-sasl-xoauth2-office365.c
-src/Office365/common/e-oauth2-service-office365.c
+src/server/e-oauth2-service-office365.c
+src/Microsoft365/addressbook/e-book-backend-m365.c
+src/Microsoft365/calendar/e-cal-backend-m365.c
+src/Microsoft365/camel/camel-m365-folder.c
+src/Microsoft365/camel/camel-m365-provider.c
+src/Microsoft365/camel/camel-m365-store.c
+src/Microsoft365/camel/camel-m365-transport.c
+src/Microsoft365/common/camel-sasl-xoauth2-microsoft365.c
+src/Microsoft365/common/e-oauth2-service-microsoft365.c
+src/Microsoft365/common/e-m365-connection.c
+src/Microsoft365/evolution/e-mail-config-m365-backend.c
+src/Microsoft365/registry/e-m365-backend.c
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 40579bf1..79c8c939 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -62,4 +62,4 @@ add_subdirectory(camel)
add_subdirectory(collection)
add_subdirectory(configuration)
add_subdirectory(server)
-add_subdirectory(Office365)
+add_subdirectory(Microsoft365)
diff --git a/src/Office365/CMakeLists.txt b/src/Microsoft365/CMakeLists.txt
similarity index 86%
rename from src/Office365/CMakeLists.txt
rename to src/Microsoft365/CMakeLists.txt
index 76469509..2c187fec 100644
--- a/src/Office365/CMakeLists.txt
+++ b/src/Microsoft365/CMakeLists.txt
@@ -1,6 +1,6 @@
-macro(add_simple_module_o365 _name _sourcesvar _depsvar _defsvar _cflagsvar _incdirsvar _ldflagsvar
_destination)
+macro(add_simple_module_m365 _name _sourcesvar _depsvar _defsvar _cflagsvar _incdirsvar _ldflagsvar
_destination)
set(DEPENDENCIES
- evolution-office365
+ evolution-microsoft365
)
set(SOURCES
@@ -22,7 +22,7 @@ macro(add_simple_module_o365 _name _sourcesvar _depsvar _defsvar _cflagsvar _inc
target_compile_definitions(${_name} PRIVATE
-DG_LOG_DOMAIN=\"${_name}\"
- -DO365_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
+ -DM365_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
${${_defsvar}}
)
@@ -54,7 +54,7 @@ macro(add_simple_module_o365 _name _sourcesvar _depsvar _defsvar _cflagsvar _inc
install(TARGETS ${_name}
DESTINATION ${_destination}
)
-endmacro(add_simple_module_o365)
+endmacro(add_simple_module_m365)
add_subdirectory(addressbook)
add_subdirectory(calendar)
diff --git a/src/Office365/addressbook/CMakeLists.txt b/src/Microsoft365/addressbook/CMakeLists.txt
similarity index 56%
rename from src/Office365/addressbook/CMakeLists.txt
rename to src/Microsoft365/addressbook/CMakeLists.txt
index 8886cebd..2789a140 100644
--- a/src/Office365/addressbook/CMakeLists.txt
+++ b/src/Microsoft365/addressbook/CMakeLists.txt
@@ -1,28 +1,28 @@
set(DEPENDENCIES
- evolution-office365
+ evolution-microsoft365
)
set(SOURCES
- e-book-backend-o365.c
- e-book-backend-o365.h
- e-book-backend-o365-factory.c
+ e-book-backend-m365.c
+ e-book-backend-m365.h
+ e-book-backend-m365-factory.c
)
-add_library(ebookbackendoffice365 MODULE
+add_library(ebookbackendmicrosoft365 MODULE
${SOURCES}
)
-add_dependencies(ebookbackendoffice365
+add_dependencies(ebookbackendmicrosoft365
${DEPENDENCIES}
)
-target_compile_definitions(ebookbackendoffice365 PRIVATE
- -DG_LOG_DOMAIN=\"ebookbackendoffice365\"
+target_compile_definitions(ebookbackendmicrosoft365 PRIVATE
+ -DG_LOG_DOMAIN=\"ebookbackendmicrosoft365\"
-DBACKENDDIR=\"${ebook_backenddir}\"
- -DO365_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
+ -DM365_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
)
-target_compile_options(ebookbackendoffice365 PUBLIC
+target_compile_options(ebookbackendmicrosoft365 PUBLIC
${LIBEBACKEND_CFLAGS}
${LIBEBOOK_CFLAGS}
${LIBEDATABOOK_CFLAGS}
@@ -32,11 +32,11 @@ target_compile_options(ebookbackendoffice365 PUBLIC
${SOUP_CFLAGS}
)
-target_include_directories(ebookbackendoffice365 PUBLIC
+target_include_directories(ebookbackendmicrosoft365 PUBLIC
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}
- ${CMAKE_BINARY_DIR}/src/Office365
- ${CMAKE_SOURCE_DIR}/src/Office365
+ ${CMAKE_BINARY_DIR}/src/Microsoft365
+ ${CMAKE_SOURCE_DIR}/src/Microsoft365
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${LIBEBACKEND_INCLUDE_DIRS}
@@ -48,7 +48,7 @@ target_include_directories(ebookbackendoffice365 PUBLIC
${SOUP_INCLUDE_DIRS}
)
-target_link_libraries(ebookbackendoffice365
+target_link_libraries(ebookbackendmicrosoft365
${DEPENDENCIES}
${LIBEBACKEND_LDFLAGS}
${LIBEBOOK_LDFLAGS}
@@ -60,6 +60,6 @@ target_link_libraries(ebookbackendoffice365
${SOUP_LDFLAGS}
)
-install(TARGETS ebookbackendoffice365
+install(TARGETS ebookbackendmicrosoft365
DESTINATION ${ebook_backenddir}
)
diff --git a/src/Microsoft365/addressbook/e-book-backend-m365-factory.c
b/src/Microsoft365/addressbook/e-book-backend-m365-factory.c
new file mode 100644
index 00000000..57e52a56
--- /dev/null
+++ b/src/Microsoft365/addressbook/e-book-backend-m365-factory.c
@@ -0,0 +1,73 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "evolution-ews-config.h"
+
+#include <glib/gi18n-lib.h>
+
+#include <libedata-book/libedata-book.h>
+
+#include "common/e-oauth2-service-microsoft365.h"
+#include "common/e-source-m365-folder.h"
+
+#include "e-book-backend-m365.h"
+
+typedef EBookBackendFactory EBookBackendM365Factory;
+typedef EBookBackendFactoryClass EBookBackendM365FactoryClass;
+
+static EModule *e_module;
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+/* Forward Declarations */
+GType e_book_backend_m365_factory_get_type (void);
+
+G_DEFINE_DYNAMIC_TYPE (EBookBackendM365Factory, e_book_backend_m365_factory, E_TYPE_BOOK_BACKEND_FACTORY)
+
+static void
+e_book_backend_m365_factory_class_init (EBookBackendFactoryClass *class)
+{
+ EBackendFactoryClass *backend_factory_class;
+
+ backend_factory_class = E_BACKEND_FACTORY_CLASS (class);
+ backend_factory_class->e_module = e_module;
+ backend_factory_class->share_subprocess = TRUE;
+
+ class->factory_name = "microsoft365";
+ class->backend_type = E_TYPE_BOOK_BACKEND_M365;
+}
+
+static void
+e_book_backend_m365_factory_class_finalize (EBookBackendFactoryClass *class)
+{
+}
+
+static void
+e_book_backend_m365_factory_init (EBookBackendFactory *factory)
+{
+}
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ bindtextdomain (GETTEXT_PACKAGE, M365_LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+ e_module = E_MODULE (type_module);
+
+ e_oauth2_service_microsoft365_type_register (type_module);
+ e_source_m365_folder_type_register (type_module);
+
+ e_book_backend_m365_factory_register_type (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+ e_module = NULL;
+}
diff --git a/src/Office365/addressbook/e-book-backend-o365.c
b/src/Microsoft365/addressbook/e-book-backend-m365.c
similarity index 64%
rename from src/Office365/addressbook/e-book-backend-o365.c
rename to src/Microsoft365/addressbook/e-book-backend-m365.c
index f2bd068d..05d8a567 100644
--- a/src/Office365/addressbook/e-book-backend-o365.c
+++ b/src/Microsoft365/addressbook/e-book-backend-m365.c
@@ -1,18 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
@@ -25,11 +14,11 @@
#include <libedata-book/libedata-book.h>
-#include "common/camel-o365-settings.h"
-#include "common/e-o365-connection.h"
-#include "common/e-source-o365-folder.h"
+#include "common/camel-m365-settings.h"
+#include "common/e-m365-connection.h"
+#include "common/e-source-m365-folder.h"
-#include "e-book-backend-o365.h"
+#include "e-book-backend-m365.h"
#ifdef G_OS_WIN32
#ifdef gmtime_r
@@ -46,48 +35,48 @@
#define LOCK(_bb) g_rec_mutex_lock (&_bb->priv->property_lock)
#define UNLOCK(_bb) g_rec_mutex_unlock (&_bb->priv->property_lock)
-struct _EBookBackendO365Private {
+struct _EBookBackendM365Private {
GRecMutex property_lock;
- EO365Connection *cnc;
+ EM365Connection *cnc;
gchar *folder_id;
};
-G_DEFINE_TYPE_WITH_PRIVATE (EBookBackendO365, e_book_backend_o365, E_TYPE_BOOK_META_BACKEND)
+G_DEFINE_TYPE_WITH_PRIVATE (EBookBackendM365, e_book_backend_m365, E_TYPE_BOOK_META_BACKEND)
static void
-ebb_o365_contact_get_string_attribute (EO365Contact *o365_contact,
+ebb_m365_contact_get_string_attribute (EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- const gchar * (*o365_get_func) (EO365Contact *contact))
+ const gchar * (*m365_get_func) (EM365Contact *contact))
{
- e_contact_set (inout_contact, field_id, o365_get_func (o365_contact));
+ e_contact_set (inout_contact, field_id, m365_get_func (m365_contact));
}
static void
-ebb_o365_contact_add_string_attribute (EContact *new_contact,
+ebb_m365_contact_add_string_attribute (EContact *new_contact,
EContact *old_contact,
EContactField field_id,
JsonBuilder *builder,
- void (* o365_add_func) (JsonBuilder *builder,
+ void (* m365_add_func) (JsonBuilder *builder,
const gchar *value))
{
const gchar *new_value, *old_value;
- g_return_if_fail (o365_add_func != NULL);
+ g_return_if_fail (m365_add_func != NULL);
new_value = e_contact_get_const (new_contact, field_id);
old_value = old_contact ? e_contact_get_const (old_contact, field_id) : NULL;
if (g_strcmp0 (new_value, old_value) != 0)
- o365_add_func (builder, new_value);
+ m365_add_func (builder, new_value);
}
static gboolean
-ebb_o365_contact_get_rev (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ebb_m365_contact_get_rev (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
@@ -95,7 +84,7 @@ ebb_o365_contact_get_rev (EBookBackendO365 *bbo365,
struct tm stm;
time_t value;
- value = e_o365_contact_get_last_modified_date_time (o365_contact);
+ value = e_m365_contact_get_last_modified_date_time (m365_contact);
if (value <= (time_t) 0)
value = time (NULL);
@@ -109,17 +98,17 @@ ebb_o365_contact_get_rev (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_get_birthday (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ebb_m365_contact_get_birthday (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
time_t value;
- value = e_o365_contact_get_birthday (o365_contact);
+ value = e_m365_contact_get_birthday (m365_contact);
if (value > (time_t) 0) {
EContactDate dt;
@@ -138,11 +127,11 @@ ebb_o365_contact_get_birthday (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_add_birthday (EBookBackendO365 *bbo365,
+ebb_m365_contact_add_birthday (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact,
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
@@ -168,9 +157,9 @@ ebb_o365_contact_add_birthday (EBookBackendO365 *bbo365,
g_date_time_unref (gdt);
}
- e_o365_contact_add_birthday (builder, value);
+ e_m365_contact_add_birthday (builder, value);
} else {
- e_o365_contact_add_birthday (builder, (time_t) 0);
+ e_m365_contact_add_birthday (builder, (time_t) 0);
}
}
@@ -181,22 +170,22 @@ ebb_o365_contact_add_birthday (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_get_address (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ebb_m365_contact_get_address (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
- EO365PhysicalAddress *phys_address = NULL;
+ EM365PhysicalAddress *phys_address = NULL;
if (field_id == E_CONTACT_ADDRESS_WORK)
- phys_address = e_o365_contact_get_business_address (o365_contact);
+ phys_address = e_m365_contact_get_business_address (m365_contact);
else if (field_id == E_CONTACT_ADDRESS_HOME)
- phys_address = e_o365_contact_get_home_address (o365_contact);
+ phys_address = e_m365_contact_get_home_address (m365_contact);
else if (field_id == E_CONTACT_ADDRESS_OTHER)
- phys_address = e_o365_contact_get_other_address (o365_contact);
+ phys_address = e_m365_contact_get_other_address (m365_contact);
else
g_warning ("%s: Uncaught field '%s'", G_STRFUNC, e_contact_vcard_attribute (field_id));
@@ -205,11 +194,11 @@ ebb_o365_contact_get_address (EBookBackendO365 *bbo365,
memset (&addr, 0, sizeof (EContactAddress));
- addr.locality = (gchar *) e_o365_physical_address_get_city (phys_address);
- addr.country = (gchar *) e_o365_physical_address_get_country_or_region (phys_address);
- addr.code = (gchar *) e_o365_physical_address_get_postal_code (phys_address);
- addr.region = (gchar *) e_o365_physical_address_get_state (phys_address);
- addr.street = (gchar *) e_o365_physical_address_get_street (phys_address);
+ addr.locality = (gchar *) e_m365_physical_address_get_city (phys_address);
+ addr.country = (gchar *) e_m365_physical_address_get_country_or_region (phys_address);
+ addr.code = (gchar *) e_m365_physical_address_get_postal_code (phys_address);
+ addr.region = (gchar *) e_m365_physical_address_get_state (phys_address);
+ addr.street = (gchar *) e_m365_physical_address_get_street (phys_address);
if (addr.locality || addr.country || addr.code || addr.region || addr.street)
e_contact_set (inout_contact, field_id, &addr);
@@ -221,7 +210,7 @@ ebb_o365_contact_get_address (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_address_equal (const EContactAddress *addr1,
+ebb_m365_contact_address_equal (const EContactAddress *addr1,
const EContactAddress *addr2)
{
if (!addr1 && !addr2)
@@ -241,11 +230,11 @@ ebb_o365_contact_address_equal (const EContactAddress *addr1,
}
static gboolean
-ebb_o365_contact_add_address (EBookBackendO365 *bbo365,
+ebb_m365_contact_add_address (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact,
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
@@ -255,7 +244,7 @@ ebb_o365_contact_add_address (EBookBackendO365 *bbo365,
new_addr = e_contact_get (new_contact, field_id);
old_addr = old_contact ? e_contact_get (old_contact, field_id) : NULL;
- if (!ebb_o365_contact_address_equal (new_addr, old_addr)) {
+ if (!ebb_m365_contact_address_equal (new_addr, old_addr)) {
void (* add_func) (JsonBuilder *builder,
const gchar *city,
const gchar *country_or_region,
@@ -264,11 +253,11 @@ ebb_o365_contact_add_address (EBookBackendO365 *bbo365,
const gchar *street) = NULL;
if (field_id == E_CONTACT_ADDRESS_WORK)
- add_func = e_o365_contact_add_business_address;
+ add_func = e_m365_contact_add_business_address;
else if (field_id == E_CONTACT_ADDRESS_HOME)
- add_func = e_o365_contact_add_home_address;
+ add_func = e_m365_contact_add_home_address;
else if (field_id == E_CONTACT_ADDRESS_OTHER)
- add_func = e_o365_contact_add_other_address;
+ add_func = e_m365_contact_add_other_address;
else
g_warning ("%s: Uncaught field '%s'", G_STRFUNC, e_contact_vcard_attribute
(field_id));
@@ -288,7 +277,7 @@ ebb_o365_contact_add_address (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_string_values_equal (GSList *new_values, /* const gchar * */
+ebb_m365_string_values_equal (GSList *new_values, /* const gchar * */
GSList *old_values) /* const gchar * */
{
GHashTable *values;
@@ -322,7 +311,7 @@ ebb_o365_string_values_equal (GSList *new_values, /* const gchar * */
}
static gboolean
-ebb_o365_string_list_values_equal (GList *new_values, /* const gchar * */
+ebb_m365_string_list_values_equal (GList *new_values, /* const gchar * */
GList *old_values) /* const gchar * */
{
GHashTable *values;
@@ -356,11 +345,11 @@ ebb_o365_string_list_values_equal (GList *new_values, /* const gchar * */
}
static gboolean
-ebb_o365_contact_get_phone (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ebb_m365_contact_get_phone (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
@@ -368,10 +357,10 @@ ebb_o365_contact_get_phone (EBookBackendO365 *bbo365,
const gchar *type_val = NULL;
if (field_id == E_CONTACT_PHONE_BUSINESS) {
- values = e_o365_contact_get_business_phones (o365_contact);
+ values = e_m365_contact_get_business_phones (m365_contact);
type_val = "WORK";
} else if (field_id == E_CONTACT_PHONE_HOME) {
- values = e_o365_contact_get_home_phones (o365_contact);
+ values = e_m365_contact_get_home_phones (m365_contact);
type_val = "HOME";
} else {
g_warning ("%s: Uncaught field '%s'", G_STRFUNC, e_contact_vcard_attribute (field_id));
@@ -403,7 +392,7 @@ ebb_o365_contact_get_phone (EBookBackendO365 *bbo365,
}
static GSList * /* gchar * */
-ebb_o365_extract_phones (EContact *contact,
+ebb_m365_extract_phones (EContact *contact,
const gchar *only_type) /* NULL for anything but known types */
{
GSList *phones = NULL;
@@ -437,11 +426,11 @@ ebb_o365_extract_phones (EContact *contact,
}
static gboolean
-ebb_o365_contact_add_phone (EBookBackendO365 *bbo365,
+ebb_m365_contact_add_phone (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact,
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
@@ -453,23 +442,23 @@ ebb_o365_contact_add_phone (EBookBackendO365 *bbo365,
GSList *new_values, *old_values;
if (field_id == E_CONTACT_PHONE_BUSINESS) {
- begin_func = e_o365_contact_begin_business_phones;
- end_func = e_o365_contact_end_business_phones;
- add_func = e_o365_contact_add_business_phone;
+ begin_func = e_m365_contact_begin_business_phones;
+ end_func = e_m365_contact_end_business_phones;
+ add_func = e_m365_contact_add_business_phone;
type_val = "WORK";
} else if (field_id == E_CONTACT_PHONE_HOME) {
- begin_func = e_o365_contact_begin_home_phones;
- end_func = e_o365_contact_end_home_phones;
- add_func = e_o365_contact_add_home_phone;
+ begin_func = e_m365_contact_begin_home_phones;
+ end_func = e_m365_contact_end_home_phones;
+ add_func = e_m365_contact_add_home_phone;
type_val = NULL; /* everything else is treated as "HOME" phone */
} else {
g_warning ("%s: Uncaught field '%s'", G_STRFUNC, e_contact_vcard_attribute (field_id));
}
- new_values = ebb_o365_extract_phones (new_contact, type_val);
- old_values = ebb_o365_extract_phones (old_contact, type_val);
+ new_values = ebb_m365_extract_phones (new_contact, type_val);
+ old_values = ebb_m365_extract_phones (old_contact, type_val);
- if (!ebb_o365_string_values_equal (new_values, old_values)) {
+ if (!ebb_m365_string_values_equal (new_values, old_values)) {
GSList *link;
begin_func (builder);
@@ -490,17 +479,17 @@ ebb_o365_contact_add_phone (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_get_categories (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ebb_m365_contact_get_categories (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
JsonArray *values;
- values = e_o365_contact_get_categories (o365_contact);
+ values = e_m365_contact_get_categories (m365_contact);
if (values) {
GString *categories_str = NULL;
@@ -531,7 +520,7 @@ ebb_o365_contact_get_categories (EBookBackendO365 *bbo365,
}
static GSList *
-ebb_o365_extract_categories (EContact *contact,
+ebb_m365_extract_categories (EContact *contact,
EContactField field_id)
{
GSList *categories = NULL;
@@ -566,32 +555,32 @@ ebb_o365_extract_categories (EContact *contact,
}
static gboolean
-ebb_o365_contact_add_categories (EBookBackendO365 *bbo365,
+ebb_m365_contact_add_categories (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact,
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
{
GSList *new_values, *old_values;
- new_values = ebb_o365_extract_categories (new_contact, field_id);
- old_values = ebb_o365_extract_categories (old_contact, field_id);
+ new_values = ebb_m365_extract_categories (new_contact, field_id);
+ old_values = ebb_m365_extract_categories (old_contact, field_id);
- if (!ebb_o365_string_values_equal (new_values, old_values)) {
+ if (!ebb_m365_string_values_equal (new_values, old_values)) {
GSList *link;
- e_o365_contact_begin_categories (builder);
+ e_m365_contact_begin_categories (builder);
for (link = new_values; link; link = g_slist_next (link)) {
const gchar *value = link->data;
- e_o365_contact_add_category (builder, value);
+ e_m365_contact_add_category (builder, value);
}
- e_o365_contact_end_categories (builder);
+ e_m365_contact_end_categories (builder);
}
g_slist_free_full (new_values, g_free);
@@ -601,17 +590,17 @@ ebb_o365_contact_add_categories (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_get_emails (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ebb_m365_contact_get_emails (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
JsonArray *values;
- values = e_o365_contact_get_email_addresses (o365_contact);
+ values = e_m365_contact_get_email_addresses (m365_contact);
if (values) {
EVCard *vcard = E_VCARD (inout_contact);
@@ -620,7 +609,7 @@ ebb_o365_contact_get_emails (EBookBackendO365 *bbo365,
len = json_array_get_length (values);
for (ii = 0; ii < len; ii++) {
- EO365EmailAddress *address = json_array_get_object_element (values, len - ii - 1);
+ EM365EmailAddress *address = json_array_get_object_element (values, len - ii - 1);
if (address) {
EVCardAttribute *attr;
@@ -628,14 +617,14 @@ ebb_o365_contact_get_emails (EBookBackendO365 *bbo365,
attr = e_vcard_attribute_new (NULL, EVC_EMAIL);
e_vcard_attribute_add_param_with_value (attr, e_vcard_attribute_param_new
(EVC_TYPE), "OTHER");
- if (g_strcmp0 (e_o365_email_address_get_name (address),
e_o365_email_address_get_address (address)) == 0) {
- e_vcard_add_attribute_with_value (vcard, attr,
e_o365_email_address_get_address (address));
+ if (g_strcmp0 (e_m365_email_address_get_name (address),
e_m365_email_address_get_address (address)) == 0) {
+ e_vcard_add_attribute_with_value (vcard, attr,
e_m365_email_address_get_address (address));
} else {
gchar *formatted;
formatted = camel_internet_address_format_address (
- e_o365_email_address_get_name (address),
- e_o365_email_address_get_address (address));
+ e_m365_email_address_get_name (address),
+ e_m365_email_address_get_address (address));
if (formatted && *formatted)
e_vcard_add_attribute_with_value (vcard, attr, formatted);
@@ -652,7 +641,7 @@ ebb_o365_contact_get_emails (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_parse_qp_email (const gchar *string,
+ebb_m365_parse_qp_email (const gchar *string,
gchar **name,
gchar **email)
{
@@ -691,11 +680,11 @@ ebb_o365_parse_qp_email (const gchar *string,
}
static gboolean
-ebb_o365_contact_add_emails (EBookBackendO365 *bbo365,
+ebb_m365_contact_add_emails (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact,
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
@@ -705,25 +694,25 @@ ebb_o365_contact_add_emails (EBookBackendO365 *bbo365,
new_values = e_contact_get (new_contact, field_id);
old_values = old_contact ? e_contact_get (old_contact, field_id) : NULL;
- if (!ebb_o365_string_list_values_equal (new_values, old_values)) {
+ if (!ebb_m365_string_list_values_equal (new_values, old_values)) {
GList *link;
- e_o365_contact_begin_email_addresses (builder);
+ e_m365_contact_begin_email_addresses (builder);
for (link = new_values; link; link = g_list_next (link)) {
const gchar *value = link->data;
gchar *name = NULL, *address = NULL;
- if (ebb_o365_parse_qp_email (value, &name, &address))
- e_o365_add_email_address (builder, NULL, name, address);
+ if (ebb_m365_parse_qp_email (value, &name, &address))
+ e_m365_add_email_address (builder, NULL, name, address);
else
- e_o365_add_email_address (builder, NULL, NULL, value);
+ e_m365_add_email_address (builder, NULL, NULL, value);
g_free (name);
g_free (address);
}
- e_o365_contact_end_email_addresses (builder);
+ e_m365_contact_end_email_addresses (builder);
}
g_list_free_full (new_values, g_free);
@@ -733,39 +722,39 @@ ebb_o365_contact_add_emails (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_add_file_as (EBookBackendO365 *bbo365,
+ebb_m365_contact_add_file_as (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact,
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
{
const gchar *new_value;
- ebb_o365_contact_add_string_attribute (new_contact, old_contact, field_id, builder,
e_o365_contact_add_file_as);
+ ebb_m365_contact_add_string_attribute (new_contact, old_contact, field_id, builder,
e_m365_contact_add_file_as);
new_value = e_contact_get_const (new_contact, E_CONTACT_FILE_AS);
/* Set it always, to not be overwritten by server re-calculations on other property changes */
- e_o365_contact_add_display_name (builder, new_value);
+ e_m365_contact_add_display_name (builder, new_value);
return TRUE;
}
static gboolean
-ebb_o365_contact_get_generation (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ebb_m365_contact_get_generation (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
const gchar *value;
- value = e_o365_contact_get_generation (o365_contact);
+ value = e_m365_contact_get_generation (m365_contact);
if (value && *value) {
EContactName *name = e_contact_get (inout_contact, field_id);
@@ -787,11 +776,11 @@ ebb_o365_contact_get_generation (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_add_generation (EBookBackendO365 *bbo365,
+ebb_m365_contact_add_generation (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact,
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
@@ -802,7 +791,7 @@ ebb_o365_contact_add_generation (EBookBackendO365 *bbo365,
old_value = old_contact ? e_contact_get (old_contact, field_id) : NULL;
if (!(new_value && old_value && g_strcmp0 (new_value->suffixes, old_value->suffixes) == 0))
- e_o365_contact_add_generation (builder, new_value ? new_value->suffixes : NULL);
+ e_m365_contact_add_generation (builder, new_value ? new_value->suffixes : NULL);
e_contact_name_free (new_value);
e_contact_name_free (old_value);
@@ -811,17 +800,17 @@ ebb_o365_contact_add_generation (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_get_im_addresses (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ebb_m365_contact_get_im_addresses (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
JsonArray *values;
- values = e_o365_contact_get_im_addresses (o365_contact);
+ values = e_m365_contact_get_im_addresses (m365_contact);
if (values) {
EVCard *vcard = E_VCARD (inout_contact);
@@ -847,7 +836,7 @@ ebb_o365_contact_get_im_addresses (EBookBackendO365 *bbo365,
}
static GSList * /* gchar * */
-ebb_o365_extract_im_addresses (EContact *contact)
+ebb_m365_extract_im_addresses (EContact *contact)
{
GSList *ims = NULL;
GList *attrs, *link;
@@ -885,33 +874,33 @@ ebb_o365_extract_im_addresses (EContact *contact)
}
static gboolean
-ebb_o365_contact_add_im_addresses (EBookBackendO365 *bbo365,
+ebb_m365_contact_add_im_addresses (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact,
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
{
GSList *new_values, *old_values;
- new_values = ebb_o365_extract_im_addresses (new_contact);
- old_values = ebb_o365_extract_im_addresses (old_contact);
+ new_values = ebb_m365_extract_im_addresses (new_contact);
+ old_values = ebb_m365_extract_im_addresses (old_contact);
- if (!ebb_o365_string_values_equal (new_values, old_values)) {
+ if (!ebb_m365_string_values_equal (new_values, old_values)) {
GSList *link;
- e_o365_contact_begin_im_addresses (builder);
+ e_m365_contact_begin_im_addresses (builder);
for (link = new_values; link; link = g_slist_next (link)) {
const gchar *value = link->data;
if (value && *value)
- e_o365_contact_add_im_address (builder, value);
+ e_m365_contact_add_im_address (builder, value);
}
- e_o365_contact_end_im_addresses (builder);
+ e_m365_contact_end_im_addresses (builder);
}
g_slist_free_full (new_values, g_free);
@@ -921,17 +910,17 @@ ebb_o365_contact_add_im_addresses (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_get_middle_name (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ebb_m365_contact_get_middle_name (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
const gchar *value;
- value = e_o365_contact_get_middle_name (o365_contact);
+ value = e_m365_contact_get_middle_name (m365_contact);
if (value && *value) {
EContactName *name = e_contact_get (inout_contact, field_id);
@@ -953,11 +942,11 @@ ebb_o365_contact_get_middle_name (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_add_middle_name (EBookBackendO365 *bbo365,
+ebb_m365_contact_add_middle_name (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact,
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
@@ -968,7 +957,7 @@ ebb_o365_contact_add_middle_name (EBookBackendO365 *bbo365,
old_value = old_contact ? e_contact_get (old_contact, field_id) : NULL;
if (!(new_value && old_value && g_strcmp0 (new_value->additional, old_value->additional) == 0))
- e_o365_contact_add_middle_name (builder, new_value ? new_value->additional : NULL);
+ e_m365_contact_add_middle_name (builder, new_value ? new_value->additional : NULL);
e_contact_name_free (new_value);
e_contact_name_free (old_value);
@@ -977,17 +966,17 @@ ebb_o365_contact_add_middle_name (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_get_title (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ebb_m365_contact_get_title (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
const gchar *value;
- value = e_o365_contact_get_title (o365_contact);
+ value = e_m365_contact_get_title (m365_contact);
if (value && *value) {
EContactName *name = e_contact_get (inout_contact, field_id);
@@ -1009,11 +998,11 @@ ebb_o365_contact_get_title (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_add_title (EBookBackendO365 *bbo365,
+ebb_m365_contact_add_title (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact,
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
@@ -1024,7 +1013,7 @@ ebb_o365_contact_add_title (EBookBackendO365 *bbo365,
old_value = old_contact ? e_contact_get (old_contact, field_id) : NULL;
if (!(new_value && old_value && g_strcmp0 (new_value->prefixes, old_value->prefixes) == 0))
- e_o365_contact_add_title (builder, new_value ? new_value->prefixes : NULL);
+ e_m365_contact_add_title (builder, new_value ? new_value->prefixes : NULL);
e_contact_name_free (new_value);
e_contact_name_free (old_value);
@@ -1033,21 +1022,21 @@ ebb_o365_contact_add_title (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_get_photo (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ebb_m365_contact_get_photo (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
GByteArray *photo_data = NULL;
GError *local_error = NULL;
- LOCK (bbo365);
+ LOCK (bbm365);
- if (e_o365_connection_get_contact_photo_sync (cnc, NULL, bbo365->priv->folder_id,
- e_o365_contact_get_id (o365_contact), &photo_data, cancellable, &local_error) &&
+ if (e_m365_connection_get_contact_photo_sync (cnc, NULL, bbm365->priv->folder_id,
+ e_m365_contact_get_id (m365_contact), &photo_data, cancellable, &local_error) &&
photo_data && photo_data->len) {
EContactPhoto *photo;
@@ -1058,7 +1047,7 @@ ebb_o365_contact_get_photo (EBookBackendO365 *bbo365,
e_contact_photo_free (photo);
}
- UNLOCK (bbo365);
+ UNLOCK (bbm365);
if (photo_data)
g_byte_array_unref (photo_data);
@@ -1069,7 +1058,7 @@ ebb_o365_contact_get_photo (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_photo_equal (EContactPhoto *photo1,
+ebb_m365_contact_photo_equal (EContactPhoto *photo1,
EContactPhoto *photo2)
{
const guchar *data1, *data2;
@@ -1092,11 +1081,11 @@ ebb_o365_contact_photo_equal (EContactPhoto *photo1,
}
static gboolean
-ebb_o365_contact_add_photo (EBookBackendO365 *bbo365,
+ebb_m365_contact_add_photo (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact,
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
@@ -1106,7 +1095,7 @@ ebb_o365_contact_add_photo (EBookBackendO365 *bbo365,
new_value = e_contact_get (new_contact, field_id);
old_value = old_contact ? e_contact_get (old_contact, field_id) : NULL;
- if (!ebb_o365_contact_photo_equal (new_value, old_value)) {
+ if (!ebb_m365_contact_photo_equal (new_value, old_value)) {
GByteArray *jpeg_photo = NULL, tmp;
GError *local_error = NULL;
@@ -1121,17 +1110,17 @@ ebb_o365_contact_add_photo (EBookBackendO365 *bbo365,
}
}
- LOCK (bbo365);
+ LOCK (bbm365);
- if (!e_o365_connection_update_contact_photo_sync (bbo365->priv->cnc, NULL,
bbo365->priv->folder_id,
- o365_id ? o365_id : e_contact_get_const (new_contact, E_CONTACT_UID), jpeg_photo,
cancellable, &local_error)) {
+ if (!e_m365_connection_update_contact_photo_sync (bbm365->priv->cnc, NULL,
bbm365->priv->folder_id,
+ m365_id ? m365_id : e_contact_get_const (new_contact, E_CONTACT_UID), jpeg_photo,
cancellable, &local_error)) {
if (local_error) {
g_propagate_error (error, local_error);
local_error = NULL;
}
}
- UNLOCK (bbo365);
+ UNLOCK (bbm365);
g_clear_error (&local_error);
}
@@ -1150,65 +1139,65 @@ ebb_o365_contact_add_photo (EBookBackendO365 *bbo365,
struct _mappings {
EContactField field_id;
gboolean add_in_second_go;
- const gchar * (* o365_get_func) (EO365Contact *o365_contact);
- gboolean (* get_func) (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
+ const gchar * (* m365_get_func) (EM365Contact *m365_contact);
+ gboolean (* get_func) (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
EContact *inout_contact,
EContactField field_id,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error);
- void (* o365_add_func) (JsonBuilder *builder,
+ void (* m365_add_func) (JsonBuilder *builder,
const gchar *value);
- gboolean (* add_func) (EBookBackendO365 *bbo365,
+ gboolean (* add_func) (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact, /* nullable */
EContactField field_id,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error);
} mappings[] = {
- STRING_FIELD (E_CONTACT_UID, e_o365_contact_get_id, NULL),
- COMPLEX_FIELD (E_CONTACT_REV, ebb_o365_contact_get_rev, NULL),
- STRING_FIELD (E_CONTACT_ASSISTANT, e_o365_contact_get_assistant_name,
e_o365_contact_add_assistant_name),
- COMPLEX_FIELD (E_CONTACT_BIRTH_DATE, ebb_o365_contact_get_birthday,
ebb_o365_contact_add_birthday),
- COMPLEX_FIELD (E_CONTACT_ADDRESS_WORK, ebb_o365_contact_get_address,
ebb_o365_contact_add_address),
- STRING_FIELD (E_CONTACT_HOMEPAGE_URL, e_o365_contact_get_business_home_page,
e_o365_contact_add_business_home_page),
- COMPLEX_FIELD (E_CONTACT_PHONE_BUSINESS, ebb_o365_contact_get_phone,
ebb_o365_contact_add_phone),
- COMPLEX_FIELD (E_CONTACT_CATEGORIES, ebb_o365_contact_get_categories,
ebb_o365_contact_add_categories),
- STRING_FIELD (E_CONTACT_ORG, e_o365_contact_get_company_name,
e_o365_contact_add_company_name),
- STRING_FIELD (E_CONTACT_ORG_UNIT, e_o365_contact_get_department,
e_o365_contact_add_department),
- COMPLEX_FIELD (E_CONTACT_EMAIL, ebb_o365_contact_get_emails,
ebb_o365_contact_add_emails),
- COMPLEX_FIELD (E_CONTACT_NAME, ebb_o365_contact_get_generation,
ebb_o365_contact_add_generation),
- STRING_FIELD (E_CONTACT_GIVEN_NAME, e_o365_contact_get_given_name,
e_o365_contact_add_given_name),
- COMPLEX_FIELD (E_CONTACT_ADDRESS_HOME, ebb_o365_contact_get_address,
ebb_o365_contact_add_address),
- COMPLEX_FIELD (E_CONTACT_PHONE_HOME, ebb_o365_contact_get_phone,
ebb_o365_contact_add_phone),
- COMPLEX_FIELD (E_CONTACT_IM_MSN, ebb_o365_contact_get_im_addresses,
ebb_o365_contact_add_im_addresses),
- /* STRING_FIELD (???, e_o365_contact_get_initials,
e_o365_contact_add_initials), */
- STRING_FIELD (E_CONTACT_TITLE, e_o365_contact_get_job_title,
e_o365_contact_add_job_title),
- STRING_FIELD (E_CONTACT_MANAGER, e_o365_contact_get_manager,
e_o365_contact_add_manager),
- COMPLEX_FIELD (E_CONTACT_NAME, ebb_o365_contact_get_middle_name,
ebb_o365_contact_add_middle_name),
- STRING_FIELD (E_CONTACT_PHONE_MOBILE, e_o365_contact_get_mobile_phone,
e_o365_contact_add_mobile_phone),
- STRING_FIELD (E_CONTACT_NICKNAME, e_o365_contact_get_nick_name,
e_o365_contact_add_nick_name),
- STRING_FIELD (E_CONTACT_OFFICE, e_o365_contact_get_office_location,
e_o365_contact_add_office_location),
- COMPLEX_FIELD (E_CONTACT_ADDRESS_OTHER, ebb_o365_contact_get_address,
ebb_o365_contact_add_address),
- STRING_FIELD (E_CONTACT_NOTE, e_o365_contact_get_personal_notes,
e_o365_contact_add_personal_notes),
- STRING_FIELD (E_CONTACT_ROLE, e_o365_contact_get_profession,
e_o365_contact_add_profession),
- STRING_FIELD (E_CONTACT_SPOUSE, e_o365_contact_get_spouse_name,
e_o365_contact_add_spouse_name),
- STRING_FIELD (E_CONTACT_FAMILY_NAME, e_o365_contact_get_surname,
e_o365_contact_add_surname),
- COMPLEX_FIELD (E_CONTACT_NAME, ebb_o365_contact_get_title,
ebb_o365_contact_add_title),
- /* STRING_FIELD (???, e_o365_contact_get_yomi_company_name,
e_o365_contact_add_yomi_company_name), */
- /* STRING_FIELD (???, e_o365_contact_get_yomi_given_name,
e_o365_contact_add_yomi_given_name), */
- /* STRING_FIELD (???, e_o365_contact_get_yomi_surname,
e_o365_contact_add_yomi_surname), */
- COMPLEX_ADDFN (E_CONTACT_FILE_AS, e_o365_contact_get_file_as,
ebb_o365_contact_add_file_as),
- COMPLEX_FIELD_2 (E_CONTACT_PHOTO, ebb_o365_contact_get_photo,
ebb_o365_contact_add_photo)
+ STRING_FIELD (E_CONTACT_UID, e_m365_contact_get_id, NULL),
+ COMPLEX_FIELD (E_CONTACT_REV, ebb_m365_contact_get_rev, NULL),
+ STRING_FIELD (E_CONTACT_ASSISTANT, e_m365_contact_get_assistant_name,
e_m365_contact_add_assistant_name),
+ COMPLEX_FIELD (E_CONTACT_BIRTH_DATE, ebb_m365_contact_get_birthday,
ebb_m365_contact_add_birthday),
+ COMPLEX_FIELD (E_CONTACT_ADDRESS_WORK, ebb_m365_contact_get_address,
ebb_m365_contact_add_address),
+ STRING_FIELD (E_CONTACT_HOMEPAGE_URL, e_m365_contact_get_business_home_page,
e_m365_contact_add_business_home_page),
+ COMPLEX_FIELD (E_CONTACT_PHONE_BUSINESS, ebb_m365_contact_get_phone,
ebb_m365_contact_add_phone),
+ COMPLEX_FIELD (E_CONTACT_CATEGORIES, ebb_m365_contact_get_categories,
ebb_m365_contact_add_categories),
+ STRING_FIELD (E_CONTACT_ORG, e_m365_contact_get_company_name,
e_m365_contact_add_company_name),
+ STRING_FIELD (E_CONTACT_ORG_UNIT, e_m365_contact_get_department,
e_m365_contact_add_department),
+ COMPLEX_FIELD (E_CONTACT_EMAIL, ebb_m365_contact_get_emails,
ebb_m365_contact_add_emails),
+ COMPLEX_FIELD (E_CONTACT_NAME, ebb_m365_contact_get_generation,
ebb_m365_contact_add_generation),
+ STRING_FIELD (E_CONTACT_GIVEN_NAME, e_m365_contact_get_given_name,
e_m365_contact_add_given_name),
+ COMPLEX_FIELD (E_CONTACT_ADDRESS_HOME, ebb_m365_contact_get_address,
ebb_m365_contact_add_address),
+ COMPLEX_FIELD (E_CONTACT_PHONE_HOME, ebb_m365_contact_get_phone,
ebb_m365_contact_add_phone),
+ COMPLEX_FIELD (E_CONTACT_IM_MSN, ebb_m365_contact_get_im_addresses,
ebb_m365_contact_add_im_addresses),
+ /* STRING_FIELD (???, e_m365_contact_get_initials,
e_m365_contact_add_initials), */
+ STRING_FIELD (E_CONTACT_TITLE, e_m365_contact_get_job_title,
e_m365_contact_add_job_title),
+ STRING_FIELD (E_CONTACT_MANAGER, e_m365_contact_get_manager,
e_m365_contact_add_manager),
+ COMPLEX_FIELD (E_CONTACT_NAME, ebb_m365_contact_get_middle_name,
ebb_m365_contact_add_middle_name),
+ STRING_FIELD (E_CONTACT_PHONE_MOBILE, e_m365_contact_get_mobile_phone,
e_m365_contact_add_mobile_phone),
+ STRING_FIELD (E_CONTACT_NICKNAME, e_m365_contact_get_nick_name,
e_m365_contact_add_nick_name),
+ STRING_FIELD (E_CONTACT_OFFICE, e_m365_contact_get_office_location,
e_m365_contact_add_office_location),
+ COMPLEX_FIELD (E_CONTACT_ADDRESS_OTHER, ebb_m365_contact_get_address,
ebb_m365_contact_add_address),
+ STRING_FIELD (E_CONTACT_NOTE, e_m365_contact_get_personal_notes,
e_m365_contact_add_personal_notes),
+ STRING_FIELD (E_CONTACT_ROLE, e_m365_contact_get_profession,
e_m365_contact_add_profession),
+ STRING_FIELD (E_CONTACT_SPOUSE, e_m365_contact_get_spouse_name,
e_m365_contact_add_spouse_name),
+ STRING_FIELD (E_CONTACT_FAMILY_NAME, e_m365_contact_get_surname,
e_m365_contact_add_surname),
+ COMPLEX_FIELD (E_CONTACT_NAME, ebb_m365_contact_get_title,
ebb_m365_contact_add_title),
+ /* STRING_FIELD (???, e_m365_contact_get_yomi_company_name,
e_m365_contact_add_yomi_company_name), */
+ /* STRING_FIELD (???, e_m365_contact_get_yomi_given_name,
e_m365_contact_add_yomi_given_name), */
+ /* STRING_FIELD (???, e_m365_contact_get_yomi_surname,
e_m365_contact_add_yomi_surname), */
+ COMPLEX_ADDFN (E_CONTACT_FILE_AS, e_m365_contact_get_file_as,
ebb_m365_contact_add_file_as),
+ COMPLEX_FIELD_2 (E_CONTACT_PHOTO, ebb_m365_contact_get_photo,
ebb_m365_contact_add_photo)
};
static EContact *
-ebb_o365_json_contact_to_vcard (EBookBackendO365 *bbo365,
- EO365Contact *o365_contact,
- EO365Connection *cnc,
+ebb_m365_json_contact_to_vcard (EBookBackendM365 *bbm365,
+ EM365Contact *m365_contact,
+ EM365Connection *cnc,
gchar **out_object,
GCancellable *cancellable,
GError **error)
@@ -1217,7 +1206,7 @@ ebb_o365_json_contact_to_vcard (EBookBackendO365 *bbo365,
gint ii;
gboolean success = TRUE;
- g_return_val_if_fail (o365_contact != NULL, NULL);
+ g_return_val_if_fail (m365_contact != NULL, NULL);
g_return_val_if_fail (out_object != NULL, NULL);
*out_object = NULL;
@@ -1225,10 +1214,10 @@ ebb_o365_json_contact_to_vcard (EBookBackendO365 *bbo365,
contact = e_contact_new ();
for (ii = 0; success && ii < G_N_ELEMENTS (mappings); ii++) {
- if (mappings[ii].o365_get_func) {
- ebb_o365_contact_get_string_attribute (o365_contact, contact, mappings[ii].field_id,
mappings[ii].o365_get_func);
+ if (mappings[ii].m365_get_func) {
+ ebb_m365_contact_get_string_attribute (m365_contact, contact, mappings[ii].field_id,
mappings[ii].m365_get_func);
} else if (mappings[ii].get_func) {
- success = mappings[ii].get_func (bbo365, o365_contact, contact,
mappings[ii].field_id, cnc, cancellable, error);
+ success = mappings[ii].get_func (bbm365, m365_contact, contact,
mappings[ii].field_id, cnc, cancellable, error);
}
}
@@ -1241,7 +1230,7 @@ ebb_o365_json_contact_to_vcard (EBookBackendO365 *bbo365,
}
static JsonBuilder *
-ebb_o365_contact_to_json_locked (EBookBackendO365 *bbo365,
+ebb_m365_contact_to_json_locked (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact, /* nullable */
GCancellable *cancellable,
@@ -1254,17 +1243,17 @@ ebb_o365_contact_to_json_locked (EBookBackendO365 *bbo365,
g_return_val_if_fail (new_contact != NULL, NULL);
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
+ e_m365_json_begin_object_member (builder, NULL);
for (ii = 0; success && ii < G_N_ELEMENTS (mappings); ii++) {
- if (mappings[ii].o365_add_func) {
- ebb_o365_contact_add_string_attribute (new_contact, old_contact,
mappings[ii].field_id, builder, mappings[ii].o365_add_func);
+ if (mappings[ii].m365_add_func) {
+ ebb_m365_contact_add_string_attribute (new_contact, old_contact,
mappings[ii].field_id, builder, mappings[ii].m365_add_func);
} else if (!mappings[ii].add_in_second_go && mappings[ii].add_func) {
- success = mappings[ii].add_func (bbo365, new_contact, old_contact,
mappings[ii].field_id, NULL, builder, cancellable, error);
+ success = mappings[ii].add_func (bbm365, new_contact, old_contact,
mappings[ii].field_id, NULL, builder, cancellable, error);
}
}
- e_o365_json_end_object_member (builder);
+ e_m365_json_end_object_member (builder);
if (!success)
g_clear_object (&builder);
@@ -1273,10 +1262,10 @@ ebb_o365_contact_to_json_locked (EBookBackendO365 *bbo365,
}
static gboolean
-ebb_o365_contact_to_json_2nd_go_locked (EBookBackendO365 *bbo365,
+ebb_m365_contact_to_json_2nd_go_locked (EBookBackendM365 *bbm365,
EContact *new_contact,
EContact *old_contact, /* nullable */
- const gchar *o365_id,
+ const gchar *m365_id,
GCancellable *cancellable,
GError **error)
{
@@ -1287,7 +1276,7 @@ ebb_o365_contact_to_json_2nd_go_locked (EBookBackendO365 *bbo365,
for (ii = 0; success && ii < G_N_ELEMENTS (mappings); ii++) {
if (mappings[ii].add_in_second_go && mappings[ii].add_func) {
- success = mappings[ii].add_func (bbo365, new_contact, old_contact,
mappings[ii].field_id, o365_id, NULL, cancellable, error);
+ success = mappings[ii].add_func (bbm365, new_contact, old_contact,
mappings[ii].field_id, m365_id, NULL, cancellable, error);
}
}
@@ -1295,7 +1284,7 @@ ebb_o365_contact_to_json_2nd_go_locked (EBookBackendO365 *bbo365,
}
static void
-ebb_o365_convert_error_to_client_error (GError **perror)
+ebb_m365_convert_error_to_client_error (GError **perror)
{
GError *error = NULL;
@@ -1333,45 +1322,45 @@ ebb_o365_convert_error_to_client_error (GError **perror)
}
static void
-ebb_o365_maybe_disconnect_sync (EBookBackendO365 *bbo365,
+ebb_m365_maybe_disconnect_sync (EBookBackendM365 *bbm365,
GError **in_perror,
GCancellable *cancellable)
{
- g_return_if_fail (E_IS_BOOK_BACKEND_O365 (bbo365));
+ g_return_if_fail (E_IS_BOOK_BACKEND_M365 (bbm365));
if (in_perror && g_error_matches (*in_perror, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) {
- e_book_meta_backend_disconnect_sync (E_BOOK_META_BACKEND (bbo365), cancellable, NULL);
- e_backend_schedule_credentials_required (E_BACKEND (bbo365),
E_SOURCE_CREDENTIALS_REASON_REJECTED, NULL, 0, NULL, NULL, G_STRFUNC);
+ e_book_meta_backend_disconnect_sync (E_BOOK_META_BACKEND (bbm365), cancellable, NULL);
+ e_backend_schedule_credentials_required (E_BACKEND (bbm365),
E_SOURCE_CREDENTIALS_REASON_REJECTED, NULL, 0, NULL, NULL, G_STRFUNC);
}
}
static gboolean
-ebb_o365_unset_connection_sync (EBookBackendO365 *bbo365,
+ebb_m365_unset_connection_sync (EBookBackendM365 *bbm365,
gboolean is_disconnect,
GCancellable *cancellable,
GError **error)
{
gboolean success = TRUE;
- g_return_val_if_fail (E_IS_BOOK_BACKEND_O365 (bbo365), FALSE);
+ g_return_val_if_fail (E_IS_BOOK_BACKEND_M365 (bbm365), FALSE);
- LOCK (bbo365);
+ LOCK (bbm365);
- if (bbo365->priv->cnc) {
+ if (bbm365->priv->cnc) {
if (is_disconnect)
- success = e_o365_connection_disconnect_sync (bbo365->priv->cnc, cancellable, error);
+ success = e_m365_connection_disconnect_sync (bbm365->priv->cnc, cancellable, error);
}
- g_clear_object (&bbo365->priv->cnc);
- g_clear_pointer (&bbo365->priv->folder_id, g_free);
+ g_clear_object (&bbm365->priv->cnc);
+ g_clear_pointer (&bbm365->priv->folder_id, g_free);
- UNLOCK (bbo365);
+ UNLOCK (bbm365);
return success;
}
static gboolean
-ebb_o365_connect_sync (EBookMetaBackend *meta_backend,
+ebb_m365_connect_sync (EBookMetaBackend *meta_backend,
const ENamedParameters *credentials,
ESourceAuthenticationResult *out_auth_result,
gchar **out_certificate_pem,
@@ -1379,18 +1368,18 @@ ebb_o365_connect_sync (EBookMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- EBookBackendO365 *bbo365;
+ EBookBackendM365 *bbm365;
gboolean success = FALSE;
- g_return_val_if_fail (E_IS_BOOK_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_BOOK_BACKEND_M365 (meta_backend), FALSE);
g_return_val_if_fail (out_auth_result != NULL, FALSE);
- bbo365 = E_BOOK_BACKEND_O365 (meta_backend);
+ bbm365 = E_BOOK_BACKEND_M365 (meta_backend);
- LOCK (bbo365);
+ LOCK (bbm365);
- if (bbo365->priv->cnc) {
- UNLOCK (bbo365);
+ if (bbm365->priv->cnc) {
+ UNLOCK (bbm365);
*out_auth_result = E_SOURCE_AUTHENTICATION_ACCEPTED;
@@ -1399,38 +1388,38 @@ ebb_o365_connect_sync (EBookMetaBackend *meta_backend,
EBackend *backend;
ESourceRegistry *registry;
ESource *source;
- EO365Connection *cnc;
- ESourceO365Folder *o365_folder_extension;
- CamelO365Settings *o365_settings;
+ EM365Connection *cnc;
+ ESourceM365Folder *m365_folder_extension;
+ CamelM365Settings *m365_settings;
gchar *folder_id;
- backend = E_BACKEND (bbo365);
+ backend = E_BACKEND (bbm365);
source = e_backend_get_source (backend);
- registry = e_book_backend_get_registry (E_BOOK_BACKEND (bbo365));
- o365_settings = camel_o365_settings_get_from_backend (backend, registry);
- g_warn_if_fail (o365_settings != NULL);
+ registry = e_book_backend_get_registry (E_BOOK_BACKEND (bbm365));
+ m365_settings = camel_m365_settings_get_from_backend (backend, registry);
+ g_warn_if_fail (m365_settings != NULL);
- o365_folder_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_O365_FOLDER);
- folder_id = e_source_o365_folder_dup_id (o365_folder_extension);
+ m365_folder_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_M365_FOLDER);
+ folder_id = e_source_m365_folder_dup_id (m365_folder_extension);
if (folder_id) {
- cnc = e_o365_connection_new_for_backend (backend, registry, source, o365_settings);
+ cnc = e_m365_connection_new_for_backend (backend, registry, source, m365_settings);
- *out_auth_result = e_o365_connection_authenticate_sync (cnc, NULL,
E_O365_FOLDER_KIND_CONTACTS, NULL, folder_id,
+ *out_auth_result = e_m365_connection_authenticate_sync (cnc, NULL,
E_M365_FOLDER_KIND_CONTACTS, NULL, folder_id,
out_certificate_pem, out_certificate_errors, cancellable, error);
if (*out_auth_result == E_SOURCE_AUTHENTICATION_ACCEPTED) {
- bbo365->priv->cnc = g_object_ref (cnc);
+ bbm365->priv->cnc = g_object_ref (cnc);
- g_warn_if_fail (bbo365->priv->folder_id == NULL);
+ g_warn_if_fail (bbm365->priv->folder_id == NULL);
- g_free (bbo365->priv->folder_id);
- bbo365->priv->folder_id = folder_id;
+ g_free (bbm365->priv->folder_id);
+ bbm365->priv->folder_id = folder_id;
folder_id = NULL;
success = TRUE;
- e_book_backend_set_writable (E_BOOK_BACKEND (bbo365), TRUE);
+ e_book_backend_set_writable (E_BOOK_BACKEND (bbm365), TRUE);
}
} else {
*out_auth_result = E_SOURCE_AUTHENTICATION_ERROR;
@@ -1441,25 +1430,25 @@ ebb_o365_connect_sync (EBookMetaBackend *meta_backend,
g_free (folder_id);
}
- UNLOCK (bbo365);
+ UNLOCK (bbm365);
- ebb_o365_convert_error_to_client_error (error);
+ ebb_m365_convert_error_to_client_error (error);
return success;
}
static gboolean
-ebb_o365_disconnect_sync (EBookMetaBackend *meta_backend,
+ebb_m365_disconnect_sync (EBookMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (E_IS_BOOK_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_BOOK_BACKEND_M365 (meta_backend), FALSE);
- return ebb_o365_unset_connection_sync (E_BOOK_BACKEND_O365 (meta_backend), TRUE, cancellable, error);
+ return ebb_m365_unset_connection_sync (E_BOOK_BACKEND_M365 (meta_backend), TRUE, cancellable, error);
}
typedef struct _ObjectsDeltaData {
- EBookBackendO365 *bbo365;
+ EBookBackendM365 *bbm365;
ECache *cache;
GSList **out_created_objects;
GSList **out_modified_objects;
@@ -1467,7 +1456,7 @@ typedef struct _ObjectsDeltaData {
} ObjectsDeltaData;
static gboolean
-ebb_o365_get_objects_delta_cb (EO365Connection *cnc,
+ebb_m365_get_objects_delta_cb (EM365Connection *cnc,
const GSList *results, /* JsonObject * - the returned objects from the server
*/
gpointer user_data,
GCancellable *cancellable,
@@ -1479,18 +1468,18 @@ ebb_o365_get_objects_delta_cb (EO365Connection *cnc,
g_return_val_if_fail (odd != NULL, FALSE);
for (link = (GSList *) results; link && !g_cancellable_is_cancelled (cancellable); link =
g_slist_next (link)) {
- EO365Contact *contact = link->data;
+ EM365Contact *contact = link->data;
const gchar *id;
if (!contact)
continue;
- id = e_o365_contact_get_id (contact);
+ id = e_m365_contact_get_id (contact);
if (!id)
continue;
- if (e_o365_delta_is_removed_object (contact)) {
+ if (e_m365_delta_is_removed_object (contact)) {
*(odd->out_removed_objects) = g_slist_prepend (*(odd->out_removed_objects),
e_book_meta_backend_info_new (id, NULL, NULL, NULL));
} else {
@@ -1503,7 +1492,7 @@ ebb_o365_get_objects_delta_cb (EO365Connection *cnc,
else
out_slist = odd->out_created_objects;
- vcard = ebb_o365_json_contact_to_vcard (odd->bbo365, contact, cnc, &object,
cancellable, error);
+ vcard = ebb_m365_json_contact_to_vcard (odd->bbm365, contact, cnc, &object,
cancellable, error);
g_clear_object (&vcard);
@@ -1514,7 +1503,7 @@ ebb_o365_get_objects_delta_cb (EO365Connection *cnc,
EBookMetaBackendInfo *nfo;
nfo = e_book_meta_backend_info_new (id,
- e_o365_contact_get_change_key (contact),
+ e_m365_contact_get_change_key (contact),
object, NULL);
nfo->extra = object; /* assumes ownership, to avoid unnecessary re-allocation
*/
@@ -1528,7 +1517,7 @@ ebb_o365_get_objects_delta_cb (EO365Connection *cnc,
}
static gboolean
-ebb_o365_get_changes_sync (EBookMetaBackend *meta_backend,
+ebb_m365_get_changes_sync (EBookMetaBackend *meta_backend,
const gchar *last_sync_tag,
gboolean is_repeat,
gchar **out_new_sync_tag,
@@ -1539,13 +1528,13 @@ ebb_o365_get_changes_sync (EBookMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- EBookBackendO365 *bbo365;
+ EBookBackendM365 *bbm365;
EBookCache *book_cache;
ObjectsDeltaData odd;
gboolean success;
GError *local_error = NULL;
- g_return_val_if_fail (E_IS_BOOK_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_BOOK_BACKEND_M365 (meta_backend), FALSE);
g_return_val_if_fail (out_new_sync_tag != NULL, FALSE);
g_return_val_if_fail (out_repeat != NULL, FALSE);
g_return_val_if_fail (out_created_objects != NULL, FALSE);
@@ -1556,25 +1545,25 @@ ebb_o365_get_changes_sync (EBookMetaBackend *meta_backend,
*out_modified_objects = NULL;
*out_removed_objects = NULL;
- bbo365 = E_BOOK_BACKEND_O365 (meta_backend);
+ bbm365 = E_BOOK_BACKEND_M365 (meta_backend);
book_cache = e_book_meta_backend_ref_cache (meta_backend);
g_return_val_if_fail (E_IS_BOOK_CACHE (book_cache), FALSE);
- odd.bbo365 = bbo365;
+ odd.bbm365 = bbm365;
odd.cache = E_CACHE (book_cache);
odd.out_created_objects = out_created_objects;
odd.out_modified_objects = out_modified_objects;
odd.out_removed_objects = out_removed_objects;
- LOCK (bbo365);
+ LOCK (bbm365);
- success = e_o365_connection_get_objects_delta_sync (bbo365->priv->cnc, NULL,
- E_O365_FOLDER_KIND_CONTACTS, bbo365->priv->folder_id, NULL, last_sync_tag, 0,
- ebb_o365_get_objects_delta_cb, &odd,
+ success = e_m365_connection_get_objects_delta_sync (bbm365->priv->cnc, NULL,
+ E_M365_FOLDER_KIND_CONTACTS, bbm365->priv->folder_id, NULL, last_sync_tag, 0,
+ ebb_m365_get_objects_delta_cb, &odd,
out_new_sync_tag, cancellable, &local_error);
- if (e_o365_connection_util_delta_token_failed (local_error)) {
+ if (e_m365_connection_util_delta_token_failed (local_error)) {
GSList *known_uids = NULL, *link;
g_clear_error (&local_error);
@@ -1594,18 +1583,18 @@ ebb_o365_get_changes_sync (EBookMetaBackend *meta_backend,
g_slist_free_full (known_uids, g_free);
- success = e_o365_connection_get_objects_delta_sync (bbo365->priv->cnc, NULL,
- E_O365_FOLDER_KIND_CONTACTS, bbo365->priv->folder_id, NULL, NULL, 0,
- ebb_o365_get_objects_delta_cb, &odd,
+ success = e_m365_connection_get_objects_delta_sync (bbm365->priv->cnc, NULL,
+ E_M365_FOLDER_KIND_CONTACTS, bbm365->priv->folder_id, NULL, NULL, 0,
+ ebb_m365_get_objects_delta_cb, &odd,
out_new_sync_tag, cancellable, &local_error);
} else if (local_error) {
g_propagate_error (error, local_error);
}
- UNLOCK (bbo365);
+ UNLOCK (bbm365);
- ebb_o365_convert_error_to_client_error (error);
- ebb_o365_maybe_disconnect_sync (bbo365, error, cancellable);
+ ebb_m365_convert_error_to_client_error (error);
+ ebb_m365_maybe_disconnect_sync (bbm365, error, cancellable);
g_clear_object (&book_cache);
@@ -1613,7 +1602,7 @@ ebb_o365_get_changes_sync (EBookMetaBackend *meta_backend,
}
static gboolean
-ebb_o365_load_contact_sync (EBookMetaBackend *meta_backend,
+ebb_m365_load_contact_sync (EBookMetaBackend *meta_backend,
const gchar *uid,
const gchar *extra,
EContact **out_contact,
@@ -1621,39 +1610,39 @@ ebb_o365_load_contact_sync (EBookMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- EBookBackendO365 *bbo365;
- EO365Contact *contact = NULL;
+ EBookBackendM365 *bbm365;
+ EM365Contact *contact = NULL;
gboolean success;
- g_return_val_if_fail (E_IS_BOOK_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_BOOK_BACKEND_M365 (meta_backend), FALSE);
g_return_val_if_fail (uid != NULL, FALSE);
g_return_val_if_fail (out_contact, FALSE);
g_return_val_if_fail (out_extra != NULL, FALSE);
- bbo365 = E_BOOK_BACKEND_O365 (meta_backend);
+ bbm365 = E_BOOK_BACKEND_M365 (meta_backend);
- LOCK (bbo365);
+ LOCK (bbm365);
- success = e_o365_connection_get_contact_sync (bbo365->priv->cnc, NULL,
- bbo365->priv->folder_id, uid, &contact, cancellable, error);
+ success = e_m365_connection_get_contact_sync (bbm365->priv->cnc, NULL,
+ bbm365->priv->folder_id, uid, &contact, cancellable, error);
if (success) {
- *out_contact = ebb_o365_json_contact_to_vcard (bbo365, contact, bbo365->priv->cnc, out_extra,
cancellable, error);
+ *out_contact = ebb_m365_json_contact_to_vcard (bbm365, contact, bbm365->priv->cnc, out_extra,
cancellable, error);
if (contact)
json_object_unref (contact);
}
- UNLOCK (bbo365);
+ UNLOCK (bbm365);
- ebb_o365_convert_error_to_client_error (error);
- ebb_o365_maybe_disconnect_sync (bbo365, error, cancellable);
+ ebb_m365_convert_error_to_client_error (error);
+ ebb_m365_maybe_disconnect_sync (bbm365, error, cancellable);
return success;
}
static gboolean
-ebb_o365_save_contact_sync (EBookMetaBackend *meta_backend,
+ebb_m365_save_contact_sync (EBookMetaBackend *meta_backend,
gboolean overwrite_existing,
EConflictResolution conflict_resolution,
/* const */ EContact *contact,
@@ -1664,12 +1653,12 @@ ebb_o365_save_contact_sync (EBookMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- EBookBackendO365 *bbo365;
+ EBookBackendM365 *bbm365;
EContact *tmp_contact = NULL, *old_contact = NULL;
JsonBuilder *builder;
gboolean success = FALSE;
- g_return_val_if_fail (E_IS_BOOK_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_BOOK_BACKEND_M365 (meta_backend), FALSE);
g_return_val_if_fail (E_IS_CONTACT (contact), FALSE);
g_return_val_if_fail (out_new_uid != NULL, FALSE);
g_return_val_if_fail (out_new_extra != NULL, FALSE);
@@ -1679,9 +1668,9 @@ ebb_o365_save_contact_sync (EBookMetaBackend *meta_backend,
return FALSE;
}
- bbo365 = E_BOOK_BACKEND_O365 (meta_backend);
+ bbm365 = E_BOOK_BACKEND_M365 (meta_backend);
- LOCK (bbo365);
+ LOCK (bbm365);
if (e_vcard_get_attribute (E_VCARD (contact), EVC_PHOTO)) {
tmp_contact = e_contact_duplicate (contact);
@@ -1693,38 +1682,38 @@ ebb_o365_save_contact_sync (EBookMetaBackend *meta_backend,
if (extra && *extra)
old_contact = e_contact_new_from_vcard (extra);
- builder = ebb_o365_contact_to_json_locked (bbo365, contact, old_contact, cancellable, error);
+ builder = ebb_m365_contact_to_json_locked (bbm365, contact, old_contact, cancellable, error);
if (builder) {
if (overwrite_existing) {
const gchar *uid = e_contact_get_const (contact, E_CONTACT_UID);
- success = e_o365_connection_update_contact_sync (bbo365->priv->cnc, NULL,
bbo365->priv->folder_id,
+ success = e_m365_connection_update_contact_sync (bbm365->priv->cnc, NULL,
bbm365->priv->folder_id,
uid, builder, cancellable, error);
if (success)
- success = ebb_o365_contact_to_json_2nd_go_locked (bbo365, contact,
old_contact, uid, cancellable, error);
+ success = ebb_m365_contact_to_json_2nd_go_locked (bbm365, contact,
old_contact, uid, cancellable, error);
if (success)
*out_new_extra = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
} else {
- EO365Contact *created_contact = NULL;
+ EM365Contact *created_contact = NULL;
- success = e_o365_connection_create_contact_sync (bbo365->priv->cnc, NULL,
bbo365->priv->folder_id,
+ success = e_m365_connection_create_contact_sync (bbm365->priv->cnc, NULL,
bbm365->priv->folder_id,
builder, &created_contact, cancellable, error);
if (success && created_contact) {
- const gchar *o365_id = e_o365_contact_get_id (created_contact);
+ const gchar *m365_id = e_m365_contact_get_id (created_contact);
- success = ebb_o365_contact_to_json_2nd_go_locked (bbo365, contact,
old_contact, o365_id, cancellable, error);
+ success = ebb_m365_contact_to_json_2nd_go_locked (bbm365, contact,
old_contact, m365_id, cancellable, error);
}
if (success && created_contact) {
EContact *vcard;
- *out_new_uid = g_strdup (e_o365_contact_get_id (created_contact));
+ *out_new_uid = g_strdup (e_m365_contact_get_id (created_contact));
- vcard = ebb_o365_json_contact_to_vcard (bbo365, created_contact,
bbo365->priv->cnc, out_new_extra, cancellable, error);
+ vcard = ebb_m365_json_contact_to_vcard (bbm365, created_contact,
bbm365->priv->cnc, out_new_extra, cancellable, error);
if (!vcard)
success = FALSE;
@@ -1739,10 +1728,10 @@ ebb_o365_save_contact_sync (EBookMetaBackend *meta_backend,
g_clear_object (&builder);
}
- UNLOCK (bbo365);
+ UNLOCK (bbm365);
- ebb_o365_convert_error_to_client_error (error);
- ebb_o365_maybe_disconnect_sync (bbo365, error, cancellable);
+ ebb_m365_convert_error_to_client_error (error);
+ ebb_m365_maybe_disconnect_sync (bbm365, error, cancellable);
g_clear_object (&old_contact);
g_clear_object (&tmp_contact);
@@ -1751,7 +1740,7 @@ ebb_o365_save_contact_sync (EBookMetaBackend *meta_backend,
}
static gboolean
-ebb_o365_remove_contact_sync (EBookMetaBackend *meta_backend,
+ebb_m365_remove_contact_sync (EBookMetaBackend *meta_backend,
EConflictResolution conflict_resolution,
const gchar *uid,
const gchar *extra,
@@ -1760,65 +1749,65 @@ ebb_o365_remove_contact_sync (EBookMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- EBookBackendO365 *bbo365;
+ EBookBackendM365 *bbm365;
gboolean success;
- g_return_val_if_fail (E_IS_BOOK_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_BOOK_BACKEND_M365 (meta_backend), FALSE);
- bbo365 = E_BOOK_BACKEND_O365 (meta_backend);
+ bbm365 = E_BOOK_BACKEND_M365 (meta_backend);
- LOCK (bbo365);
+ LOCK (bbm365);
- success = e_o365_connection_delete_contact_sync (bbo365->priv->cnc, NULL,
- bbo365->priv->folder_id, uid, cancellable, error);
+ success = e_m365_connection_delete_contact_sync (bbm365->priv->cnc, NULL,
+ bbm365->priv->folder_id, uid, cancellable, error);
- UNLOCK (bbo365);
+ UNLOCK (bbm365);
- ebb_o365_convert_error_to_client_error (error);
- ebb_o365_maybe_disconnect_sync (bbo365, error, cancellable);
+ ebb_m365_convert_error_to_client_error (error);
+ ebb_m365_maybe_disconnect_sync (bbm365, error, cancellable);
return success;
}
static gboolean
-ebb_o365_search_sync (EBookMetaBackend *meta_backend,
+ebb_m365_search_sync (EBookMetaBackend *meta_backend,
const gchar *expr,
gboolean meta_contact,
GSList **out_contacts,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (E_IS_BOOK_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_BOOK_BACKEND_M365 (meta_backend), FALSE);
/* Ignore errors, just try its best */
- /*ebb_o365_update_cache_for_expression (E_BOOK_BACKEND_O365 (meta_backend), expr, cancellable,
NULL);*/
+ /*ebb_m365_update_cache_for_expression (E_BOOK_BACKEND_M365 (meta_backend), expr, cancellable,
NULL);*/
/* Chain up to parent's method */
- return E_BOOK_META_BACKEND_CLASS (e_book_backend_o365_parent_class)->search_sync (meta_backend, expr,
meta_contact, out_contacts, cancellable, error);
+ return E_BOOK_META_BACKEND_CLASS (e_book_backend_m365_parent_class)->search_sync (meta_backend, expr,
meta_contact, out_contacts, cancellable, error);
}
static gboolean
-ebb_o365_search_uids_sync (EBookMetaBackend *meta_backend,
+ebb_m365_search_uids_sync (EBookMetaBackend *meta_backend,
const gchar *expr,
GSList **out_uids,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (E_IS_BOOK_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_BOOK_BACKEND_M365 (meta_backend), FALSE);
/* Ignore errors, just try its best */
- /*ebb_o365_update_cache_for_expression (E_BOOK_BACKEND_O365 (meta_backend), expr, cancellable,
NULL);*/
+ /*ebb_m365_update_cache_for_expression (E_BOOK_BACKEND_M365 (meta_backend), expr, cancellable,
NULL);*/
/* Chain up to parent's method */
- return E_BOOK_META_BACKEND_CLASS (e_book_backend_o365_parent_class)->search_uids_sync (meta_backend,
expr,
+ return E_BOOK_META_BACKEND_CLASS (e_book_backend_m365_parent_class)->search_uids_sync (meta_backend,
expr,
out_uids, cancellable, error);
}
static gchar *
-ebb_o365_get_backend_property (EBookBackend *book_backend,
+ebb_m365_get_backend_property (EBookBackend *book_backend,
const gchar *prop_name)
{
- g_return_val_if_fail (E_IS_BOOK_BACKEND_O365 (book_backend), NULL);
+ g_return_val_if_fail (E_IS_BOOK_BACKEND_M365 (book_backend), NULL);
g_return_val_if_fail (prop_name != NULL, NULL);
if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
@@ -1860,11 +1849,11 @@ ebb_o365_get_backend_property (EBookBackend *book_backend,
}
/* Chain up to parent's method. */
- return E_BOOK_BACKEND_CLASS (e_book_backend_o365_parent_class)->impl_get_backend_property
(book_backend, prop_name);
+ return E_BOOK_BACKEND_CLASS (e_book_backend_m365_parent_class)->impl_get_backend_property
(book_backend, prop_name);
}
static gboolean
-ebb_o365_get_destination_address (EBackend *backend,
+ebb_m365_get_destination_address (EBackend *backend,
gchar **host,
guint16 *port)
{
@@ -1883,37 +1872,37 @@ ebb_o365_get_destination_address (EBackend *backend,
}
static void
-e_book_backend_o365_dispose (GObject *object)
+e_book_backend_m365_dispose (GObject *object)
{
- EBookBackendO365 *bbo365 = E_BOOK_BACKEND_O365 (object);
+ EBookBackendM365 *bbm365 = E_BOOK_BACKEND_M365 (object);
- ebb_o365_unset_connection_sync (bbo365, FALSE, NULL, NULL);
+ ebb_m365_unset_connection_sync (bbm365, FALSE, NULL, NULL);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_book_backend_o365_parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_book_backend_m365_parent_class)->dispose (object);
}
static void
-e_book_backend_o365_finalize (GObject *object)
+e_book_backend_m365_finalize (GObject *object)
{
- EBookBackendO365 *bbo365 = E_BOOK_BACKEND_O365 (object);
+ EBookBackendM365 *bbm365 = E_BOOK_BACKEND_M365 (object);
- g_rec_mutex_clear (&bbo365->priv->property_lock);
+ g_rec_mutex_clear (&bbm365->priv->property_lock);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_book_backend_o365_parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_book_backend_m365_parent_class)->finalize (object);
}
static void
-e_book_backend_o365_init (EBookBackendO365 *bbo365)
+e_book_backend_m365_init (EBookBackendM365 *bbm365)
{
- bbo365->priv = e_book_backend_o365_get_instance_private (bbo365);
+ bbm365->priv = e_book_backend_m365_get_instance_private (bbm365);
- g_rec_mutex_init (&bbo365->priv->property_lock);
+ g_rec_mutex_init (&bbm365->priv->property_lock);
}
static void
-e_book_backend_o365_class_init (EBookBackendO365Class *klass)
+e_book_backend_m365_class_init (EBookBackendM365Class *klass)
{
GObjectClass *object_class;
EBackendClass *backend_class;
@@ -1921,24 +1910,24 @@ e_book_backend_o365_class_init (EBookBackendO365Class *klass)
EBookMetaBackendClass *book_meta_backend_class;
book_meta_backend_class = E_BOOK_META_BACKEND_CLASS (klass);
- book_meta_backend_class->backend_module_filename = "libebookbackendoffice365.so";
- book_meta_backend_class->backend_factory_type_name = "EBookBackendO365Factory";
- book_meta_backend_class->connect_sync = ebb_o365_connect_sync;
- book_meta_backend_class->disconnect_sync = ebb_o365_disconnect_sync;
- book_meta_backend_class->get_changes_sync = ebb_o365_get_changes_sync;
- book_meta_backend_class->load_contact_sync = ebb_o365_load_contact_sync;
- book_meta_backend_class->save_contact_sync = ebb_o365_save_contact_sync;
- book_meta_backend_class->remove_contact_sync = ebb_o365_remove_contact_sync;
- book_meta_backend_class->search_sync = ebb_o365_search_sync;
- book_meta_backend_class->search_uids_sync = ebb_o365_search_uids_sync;
+ book_meta_backend_class->backend_module_filename = "libebookbackendmicrosoft365.so";
+ book_meta_backend_class->backend_factory_type_name = "EBookBackendM365Factory";
+ book_meta_backend_class->connect_sync = ebb_m365_connect_sync;
+ book_meta_backend_class->disconnect_sync = ebb_m365_disconnect_sync;
+ book_meta_backend_class->get_changes_sync = ebb_m365_get_changes_sync;
+ book_meta_backend_class->load_contact_sync = ebb_m365_load_contact_sync;
+ book_meta_backend_class->save_contact_sync = ebb_m365_save_contact_sync;
+ book_meta_backend_class->remove_contact_sync = ebb_m365_remove_contact_sync;
+ book_meta_backend_class->search_sync = ebb_m365_search_sync;
+ book_meta_backend_class->search_uids_sync = ebb_m365_search_uids_sync;
book_backend_class = E_BOOK_BACKEND_CLASS (klass);
- book_backend_class->impl_get_backend_property = ebb_o365_get_backend_property;
+ book_backend_class->impl_get_backend_property = ebb_m365_get_backend_property;
backend_class = E_BACKEND_CLASS (klass);
- backend_class->get_destination_address = ebb_o365_get_destination_address;
+ backend_class->get_destination_address = ebb_m365_get_destination_address;
object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = e_book_backend_o365_dispose;
- object_class->finalize = e_book_backend_o365_finalize;
+ object_class->dispose = e_book_backend_m365_dispose;
+ object_class->finalize = e_book_backend_m365_finalize;
}
diff --git a/src/Microsoft365/addressbook/e-book-backend-m365.h
b/src/Microsoft365/addressbook/e-book-backend-m365.h
new file mode 100644
index 00000000..4639648b
--- /dev/null
+++ b/src/Microsoft365/addressbook/e-book-backend-m365.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_BOOK_BACKEND_M365_H
+#define E_BOOK_BACKEND_M365_H
+
+#include <libedata-book/libedata-book.h>
+
+#define E_TYPE_BOOK_BACKEND_M365 (e_book_backend_m365_get_type ())
+#define E_BOOK_BACKEND_M365(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_BOOK_BACKEND_M365,
EBookBackendM365))
+#define E_BOOK_BACKEND_M365_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_BOOK_BACKEND_M365,
EBookBackendM365Class))
+#define E_IS_BOOK_BACKEND_M365(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_BOOK_BACKEND_M365))
+#define E_IS_BOOK_BACKEND_M365_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_BOOK_BACKEND_M365))
+#define E_BOOK_BACKEND_M365_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_BOOK_BACKEND_M365,
EBookBackenM365Class))
+
+typedef struct _EBookBackendM365Private EBookBackendM365Private;
+
+typedef struct {
+ EBookMetaBackend parent_object;
+ EBookBackendM365Private *priv;
+} EBookBackendM365;
+
+typedef struct {
+ EBookMetaBackendClass parent_class;
+} EBookBackendM365Class;
+
+GType e_book_backend_m365_get_type (void);
+
+#endif /* E_BOOK_BACKEND_M365_H */
diff --git a/src/Microsoft365/calendar/CMakeLists.txt b/src/Microsoft365/calendar/CMakeLists.txt
new file mode 100644
index 00000000..56f36cee
--- /dev/null
+++ b/src/Microsoft365/calendar/CMakeLists.txt
@@ -0,0 +1,61 @@
+set(DEPENDENCIES
+ evolution-microsoft365
+)
+
+set(SOURCES
+ e-cal-backend-m365.c
+ e-cal-backend-m365.h
+ e-cal-backend-m365-factory.c
+)
+
+add_library(ecalbackendmicrosoft365 MODULE
+ ${SOURCES}
+)
+
+add_dependencies(ecalbackendmicrosoft365
+ ${DEPENDENCIES}
+)
+
+target_compile_definitions(ecalbackendmicrosoft365 PRIVATE
+ -DG_LOG_DOMAIN=\"ecalbackendmicrosoft365\"
+ -DM365_DATADIR=\"${ewsdatadir}\"
+ -DM365_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
+ -DM365_SRCDIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"
+)
+
+target_compile_options(ecalbackendmicrosoft365 PUBLIC
+ ${CAMEL_CFLAGS}
+ ${EVOLUTION_CALENDAR_CFLAGS}
+ ${LIBEBACKEND_CFLAGS}
+ ${LIBECAL_CFLAGS}
+ ${LIBEDATACAL_CFLAGS}
+ ${SOUP_CFLAGS}
+)
+
+target_include_directories(ecalbackendmicrosoft365 PUBLIC
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_BINARY_DIR}/src/Microsoft365
+ ${CMAKE_SOURCE_DIR}/src/Microsoft365
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CAMEL_INCLUDE_DIRS}
+ ${EVOLUTION_CALENDAR_INCLUDE_DIRS}
+ ${LIBEBACKEND_INCLUDE_DIRS}
+ ${LIBECAL_INCLUDE_DIRS}
+ ${LIBEDATACAL_INCLUDE_DIRS}
+ ${SOUP_INCLUDE_DIRS}
+)
+
+target_link_libraries(ecalbackendmicrosoft365
+ ${DEPENDENCIES}
+ ${CAMEL_LDFLAGS}
+ ${EVOLUTION_CALENDAR_LDFLAGS}
+ ${LIBEBACKEND_LDFLAGS}
+ ${LIBECAL_LDFLAGS}
+ ${LIBEDATACAL_LDFLAGS}
+ ${SOUP_LDFLAGS}
+)
+
+install(TARGETS ecalbackendmicrosoft365
+ DESTINATION ${ecal_backenddir}
+)
diff --git a/src/Microsoft365/calendar/e-cal-backend-m365-factory.c
b/src/Microsoft365/calendar/e-cal-backend-m365-factory.c
new file mode 100644
index 00000000..7c6ac53f
--- /dev/null
+++ b/src/Microsoft365/calendar/e-cal-backend-m365-factory.c
@@ -0,0 +1,137 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "evolution-ews-config.h"
+
+#include <string.h>
+#include <glib/gi18n-lib.h>
+
+#include <libedata-cal/libedata-cal.h>
+
+#include "common/e-oauth2-service-microsoft365.h"
+#include "common/e-source-m365-folder.h"
+
+#include "e-cal-backend-m365.h"
+
+#define FACTORY_NAME "microsoft365"
+
+typedef ECalBackendFactory ECalBackendM365EventsFactory;
+typedef ECalBackendFactoryClass ECalBackendM365EventsFactoryClass;
+
+typedef ECalBackendFactory ECalBackendM365JournalFactory;
+typedef ECalBackendFactoryClass ECalBackendM365JournalFactoryClass;
+
+typedef ECalBackendFactory ECalBackendM365TodosFactory;
+typedef ECalBackendFactoryClass ECalBackendM365TodosFactoryClass;
+
+static EModule *e_module;
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+/* Forward Declarations */
+GType e_cal_backend_m365_events_factory_get_type (void);
+GType e_cal_backend_m365_journal_factory_get_type (void);
+GType e_cal_backend_m365_todos_factory_get_type (void);
+
+G_DEFINE_DYNAMIC_TYPE (ECalBackendM365EventsFactory, e_cal_backend_m365_events_factory,
E_TYPE_CAL_BACKEND_FACTORY)
+G_DEFINE_DYNAMIC_TYPE (ECalBackendM365JournalFactory, e_cal_backend_m365_journal_factory,
E_TYPE_CAL_BACKEND_FACTORY)
+G_DEFINE_DYNAMIC_TYPE (ECalBackendM365TodosFactory, e_cal_backend_m365_todos_factory,
E_TYPE_CAL_BACKEND_FACTORY)
+
+static void
+e_cal_backend_m365_events_factory_class_init (ECalBackendFactoryClass *class)
+{
+ EBackendFactoryClass *backend_factory_class;
+
+ backend_factory_class = E_BACKEND_FACTORY_CLASS (class);
+ backend_factory_class->e_module = e_module;
+ backend_factory_class->share_subprocess = TRUE;
+
+ class->factory_name = FACTORY_NAME;
+ class->component_kind = I_CAL_VEVENT_COMPONENT;
+ class->backend_type = E_TYPE_CAL_BACKEND_M365;
+}
+
+static void
+e_cal_backend_m365_events_factory_class_finalize (ECalBackendFactoryClass *class)
+{
+}
+
+static void
+e_cal_backend_m365_events_factory_init (ECalBackendFactory *factory)
+{
+}
+
+static void
+e_cal_backend_m365_journal_factory_class_init (ECalBackendFactoryClass *class)
+{
+ EBackendFactoryClass *backend_factory_class;
+
+ backend_factory_class = E_BACKEND_FACTORY_CLASS (class);
+ backend_factory_class->e_module = e_module;
+ backend_factory_class->share_subprocess = TRUE;
+
+ class->factory_name = FACTORY_NAME;
+ class->component_kind = I_CAL_VJOURNAL_COMPONENT;
+ class->backend_type = E_TYPE_CAL_BACKEND_M365;
+}
+
+static void
+e_cal_backend_m365_journal_factory_class_finalize (ECalBackendFactoryClass *class)
+{
+}
+
+static void
+e_cal_backend_m365_journal_factory_init (ECalBackendFactory *factory)
+{
+}
+
+static void
+e_cal_backend_m365_todos_factory_class_init (ECalBackendFactoryClass *class)
+{
+ EBackendFactoryClass *backend_factory_class;
+
+ backend_factory_class = E_BACKEND_FACTORY_CLASS (class);
+ backend_factory_class->e_module = e_module;
+ backend_factory_class->share_subprocess = TRUE;
+
+ class->factory_name = FACTORY_NAME;
+ class->component_kind = I_CAL_VTODO_COMPONENT;
+ class->backend_type = E_TYPE_CAL_BACKEND_M365;
+}
+
+static void
+e_cal_backend_m365_todos_factory_class_finalize (ECalBackendFactoryClass *class)
+{
+}
+
+static void
+e_cal_backend_m365_todos_factory_init (ECalBackendFactory *factory)
+{
+}
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ bindtextdomain (GETTEXT_PACKAGE, M365_LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+ e_module = E_MODULE (type_module);
+
+ e_oauth2_service_microsoft365_type_register (type_module);
+ e_source_m365_folder_type_register (type_module);
+
+ e_cal_backend_m365_events_factory_register_type (type_module);
+ e_cal_backend_m365_journal_factory_register_type (type_module);
+ e_cal_backend_m365_todos_factory_register_type (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+ e_module = NULL;
+}
diff --git a/src/Office365/calendar/e-cal-backend-o365.c b/src/Microsoft365/calendar/e-cal-backend-m365.c
similarity index 63%
rename from src/Office365/calendar/e-cal-backend-o365.c
rename to src/Microsoft365/calendar/e-cal-backend-m365.c
index 4f4f138e..b054bb22 100644
--- a/src/Office365/calendar/e-cal-backend-o365.c
+++ b/src/Microsoft365/calendar/e-cal-backend-m365.c
@@ -1,18 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
@@ -25,11 +14,11 @@
#include <libedata-cal/libedata-cal.h>
#include <libecal/libecal.h>
-#include "common/camel-o365-settings.h"
-#include "common/e-o365-connection.h"
-#include "common/e-source-o365-folder.h"
+#include "common/camel-m365-settings.h"
+#include "common/e-m365-connection.h"
+#include "common/e-source-m365-folder.h"
-#include "e-cal-backend-o365.h"
+#include "e-cal-backend-m365.h"
#ifdef G_OS_WIN32
#ifdef gmtime_r
@@ -48,18 +37,18 @@
#define LOCK(_cb) g_rec_mutex_lock (&_cb->priv->property_lock)
#define UNLOCK(_cb) g_rec_mutex_unlock (&_cb->priv->property_lock)
-struct _ECalBackendO365Private {
+struct _ECalBackendM365Private {
GRecMutex property_lock;
- EO365Connection *cnc;
+ EM365Connection *cnc;
gchar *group_id;
gchar *calendar_id;
gchar *attachments_dir;
};
-G_DEFINE_TYPE_WITH_PRIVATE (ECalBackendO365, e_cal_backend_o365, E_TYPE_CAL_META_BACKEND)
+G_DEFINE_TYPE_WITH_PRIVATE (ECalBackendM365, e_cal_backend_m365, E_TYPE_CAL_META_BACKEND)
static void
-ecb_o365_convert_error_to_client_error (GError **perror)
+ecb_m365_convert_error_to_client_error (GError **perror)
{
GError *error = NULL;
@@ -68,22 +57,22 @@ ecb_o365_convert_error_to_client_error (GError **perror)
(*perror)->domain == E_CAL_CLIENT_ERROR)
return;
- /*if ((*perror)->domain == O365_CONNECTION_ERROR) {
+ /*if ((*perror)->domain == M365_CONNECTION_ERROR) {
switch ((*perror)->code) {
- case O365_CONNECTION_ERROR_AUTHENTICATION_FAILED:
+ case M365_CONNECTION_ERROR_AUTHENTICATION_FAILED:
error = EC_ERROR_EX (E_CLIENT_ERROR_AUTHENTICATION_FAILED, (*perror)->message);
break;
- case O365_CONNECTION_ERROR_FOLDERNOTFOUND:
- case O365_CONNECTION_ERROR_MANAGEDFOLDERNOTFOUND:
- case O365_CONNECTION_ERROR_PARENTFOLDERNOTFOUND:
- case O365_CONNECTION_ERROR_PUBLICFOLDERSERVERNOTFOUND:
+ case M365_CONNECTION_ERROR_FOLDERNOTFOUND:
+ case M365_CONNECTION_ERROR_MANAGEDFOLDERNOTFOUND:
+ case M365_CONNECTION_ERROR_PARENTFOLDERNOTFOUND:
+ case M365_CONNECTION_ERROR_PUBLICFOLDERSERVERNOTFOUND:
error = ECC_ERROR_EX (E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR, (*perror)->message);
break;
- case O365_CONNECTION_ERROR_EVENTNOTFOUND:
- case O365_CONNECTION_ERROR_ITEMNOTFOUND:
+ case M365_CONNECTION_ERROR_EVENTNOTFOUND:
+ case M365_CONNECTION_ERROR_ITEMNOTFOUND:
error = ECC_ERROR_EX (E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND, (*perror)->message);
break;
- case O365_CONNECTION_ERROR_UNAVAILABLE:
+ case M365_CONNECTION_ERROR_UNAVAILABLE:
g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_HOST_NOT_FOUND,
(*perror)->message);
break;
}
@@ -99,7 +88,7 @@ ecb_o365_convert_error_to_client_error (GError **perror)
}
static const gchar *
-ecb_o365_get_component_from_extra (const gchar *extra)
+ecb_m365_get_component_from_extra (const gchar *extra)
{
gchar *enter;
@@ -116,7 +105,7 @@ ecb_o365_get_component_from_extra (const gchar *extra)
/* Modifies inout_extra, cannot be called multiple times with the same arguments */
static void
-ecb_o365_split_extra (gchar *inout_extra,
+ecb_m365_split_extra (gchar *inout_extra,
const gchar **out_change_key,
const gchar **out_ical_comp)
{
@@ -125,7 +114,7 @@ ecb_o365_split_extra (gchar *inout_extra,
if (!inout_extra)
return;
- enter = (gchar *) ecb_o365_get_component_from_extra (inout_extra);
+ enter = (gchar *) ecb_m365_get_component_from_extra (inout_extra);
g_return_if_fail (enter != NULL);
enter[-1] = '\0';
@@ -138,26 +127,26 @@ ecb_o365_split_extra (gchar *inout_extra,
}
static void
-ecb_o365_get_uid (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_uid (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
- i_cal_component_set_uid (inout_comp, e_o365_event_get_id (o365_event));
+ i_cal_component_set_uid (inout_comp, e_m365_event_get_id (m365_event));
}
static void
-ecb_o365_get_date_time (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_date_time (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
time_t tt = (time_t) 0;
if (prop_kind == I_CAL_CREATED_PROPERTY)
- tt = e_o365_event_get_created_date_time (o365_event);
+ tt = e_m365_event_get_created_date_time (m365_event);
else if (prop_kind == I_CAL_LASTMODIFIED_PROPERTY)
- tt = e_o365_event_get_last_modified_date_time (o365_event);
+ tt = e_m365_event_get_last_modified_date_time (m365_event);
else
g_warn_if_reached ();
@@ -179,7 +168,7 @@ ecb_o365_get_date_time (ECalBackendO365 *cbo365,
}
static ICalTimezone *
-ecb_o365_get_timezone_sync (ECalBackendO365 *cbo365,
+ecb_m365_get_timezone_sync (ECalBackendM365 *cbm365,
const gchar *tzid)
{
ICalTimezone *zone;
@@ -188,7 +177,7 @@ ecb_o365_get_timezone_sync (ECalBackendO365 *cbo365,
if (!tzid)
return NULL;
- cal_cache = e_cal_meta_backend_ref_cache (E_CAL_META_BACKEND (cbo365));
+ cal_cache = e_cal_meta_backend_ref_cache (E_CAL_META_BACKEND (cbm365));
if (!cal_cache)
return NULL;
@@ -201,23 +190,23 @@ ecb_o365_get_timezone_sync (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_get_date_time_zone (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_date_time_zone (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
- EO365DateTimeWithZone *value = NULL;
+ EM365DateTimeWithZone *value = NULL;
ICalTimezone *tz;
ICalTime *itt;
time_t tt;
const gchar *tzid, *zone;
if (prop_kind == I_CAL_DTSTART_PROPERTY) {
- value = e_o365_event_get_start (o365_event);
- tzid = e_o365_event_get_original_start_timezone (o365_event);
+ value = e_m365_event_get_start (m365_event);
+ tzid = e_m365_event_get_original_start_timezone (m365_event);
} else if (prop_kind == I_CAL_DTEND_PROPERTY) {
- value = e_o365_event_get_end (o365_event);
- tzid = e_o365_event_get_original_end_timezone (o365_event);
+ value = e_m365_event_get_end (m365_event);
+ tzid = e_m365_event_get_original_end_timezone (m365_event);
} else {
g_warn_if_reached ();
return;
@@ -226,16 +215,16 @@ ecb_o365_get_date_time_zone (ECalBackendO365 *cbo365,
if (!value)
return;
- tt = e_o365_date_time_get_date_time (value);
- zone = e_o365_date_time_get_time_zone (value);
+ tt = e_m365_date_time_get_date_time (value);
+ zone = e_m365_date_time_get_time_zone (value);
/* Reads the time in UTC, just make sure it's still a true expectation */
g_warn_if_fail (!zone || !*zone || g_strcmp0 (zone, "UTC") == 0);
- tz = ecb_o365_get_timezone_sync (cbo365, tzid);
- itt = i_cal_time_new_from_timet_with_zone (tt, e_o365_event_get_is_all_day (o365_event),
i_cal_timezone_get_utc_timezone ());
+ tz = ecb_m365_get_timezone_sync (cbm365, tzid);
+ itt = i_cal_time_new_from_timet_with_zone (tt, e_m365_event_get_is_all_day (m365_event),
i_cal_timezone_get_utc_timezone ());
- if (tz && !e_o365_event_get_is_all_day (o365_event))
+ if (tz && !e_m365_event_get_is_all_day (m365_event))
i_cal_time_convert_to_zone_inplace (itt, tz);
if (prop_kind == I_CAL_DTSTART_PROPERTY)
@@ -247,7 +236,7 @@ ecb_o365_get_date_time_zone (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_add_date_time_zone (ECalBackendO365 *cbo365,
+ecb_m365_add_date_time_zone (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
@@ -257,14 +246,14 @@ ecb_o365_add_date_time_zone (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_get_categories (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_categories (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
JsonArray *categories;
- categories = e_o365_event_get_categories (o365_event);
+ categories = e_m365_event_get_categories (m365_event);
if (categories) {
GString *categories_str = NULL;
@@ -302,7 +291,7 @@ ecb_o365_get_categories (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_add_categories (ECalBackendO365 *cbo365,
+ecb_m365_add_categories (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
@@ -311,21 +300,21 @@ ecb_o365_add_categories (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_get_subject (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_subject (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
const gchar *subject;
- subject = e_o365_event_get_subject (o365_event);
+ subject = e_m365_event_get_subject (m365_event);
if (subject)
i_cal_component_set_summary (inout_comp, subject);
}
static void
-ecb_o365_add_subject (ECalBackendO365 *cbo365,
+ecb_m365_add_subject (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
@@ -337,27 +326,27 @@ ecb_o365_add_subject (ECalBackendO365 *cbo365,
old_value = old_comp ? i_cal_component_get_summary (old_comp) : NULL;
if (g_strcmp0 (new_value, old_value) != 0)
- e_o365_event_add_subject (builder, new_value ? new_value : "");
+ e_m365_event_add_subject (builder, new_value ? new_value : "");
}
static void
-ecb_o365_get_body (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_body (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
- EO365ItemBody *value;
+ EM365ItemBody *value;
const gchar *content;
- value = e_o365_event_get_body (o365_event);
- content = value ? e_o365_item_body_get_content (value) : NULL;
+ value = e_m365_event_get_body (m365_event);
+ content = value ? e_m365_item_body_get_content (value) : NULL;
if (content && *content && strcmp (content, "\r\n") != 0)
i_cal_component_set_description (inout_comp, content);
}
static void
-ecb_o365_add_body (ECalBackendO365 *cbo365,
+ecb_m365_add_body (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
@@ -369,25 +358,25 @@ ecb_o365_add_body (ECalBackendO365 *cbo365,
old_value = old_comp ? i_cal_component_get_description (old_comp) : NULL;
if (g_strcmp0 (new_value, old_value) != 0)
- e_o365_event_add_body (builder, E_O365_ITEM_BODY_CONTENT_TYPE_TEXT, new_value);
+ e_m365_event_add_body (builder, E_M365_ITEM_BODY_CONTENT_TYPE_TEXT, new_value);
}
static void
-ecb_o365_get_sensitivity (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_sensitivity (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
- EO365SensitivityType value;
+ EM365SensitivityType value;
ICalProperty_Class cls = I_CAL_CLASS_NONE;
- value = e_o365_event_get_sensitivity (o365_event);
+ value = e_m365_event_get_sensitivity (m365_event);
- if (value == E_O365_SENSITIVITY_NORMAL)
+ if (value == E_M365_SENSITIVITY_NORMAL)
cls = I_CAL_CLASS_PUBLIC;
- else if (value == E_O365_SENSITIVITY_PERSONAL || value == E_O365_SENSITIVITY_PRIVATE)
+ else if (value == E_M365_SENSITIVITY_PERSONAL || value == E_M365_SENSITIVITY_PRIVATE)
cls = I_CAL_CLASS_PRIVATE;
- else if (value == E_O365_SENSITIVITY_CONFIDENTIAL)
+ else if (value == E_M365_SENSITIVITY_CONFIDENTIAL)
cls = I_CAL_CLASS_CONFIDENTIAL;
if (cls != I_CAL_CLASS_NONE)
@@ -395,7 +384,7 @@ ecb_o365_get_sensitivity (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_add_sensitivity (ECalBackendO365 *cbo365,
+ecb_m365_add_sensitivity (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
@@ -419,33 +408,33 @@ ecb_o365_add_sensitivity (ECalBackendO365 *cbo365,
}
if (new_value != old_value) {
- EO365SensitivityType value = E_O365_SENSITIVITY_NOT_SET;
+ EM365SensitivityType value = E_M365_SENSITIVITY_NOT_SET;
if (new_value == I_CAL_CLASS_PUBLIC)
- value = E_O365_SENSITIVITY_NORMAL;
+ value = E_M365_SENSITIVITY_NORMAL;
else if (new_value == I_CAL_CLASS_PRIVATE)
- value = E_O365_SENSITIVITY_PRIVATE;
+ value = E_M365_SENSITIVITY_PRIVATE;
else if (new_value == I_CAL_CLASS_CONFIDENTIAL)
- value = E_O365_SENSITIVITY_CONFIDENTIAL;
+ value = E_M365_SENSITIVITY_CONFIDENTIAL;
- e_o365_event_add_sensitivity (builder, value);
+ e_m365_event_add_sensitivity (builder, value);
}
}
static void
-ecb_o365_get_show_as (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_show_as (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
- EO365FreeBusyStatusType value;
+ EM365FreeBusyStatusType value;
ICalPropertyTransp transp = I_CAL_TRANSP_NONE;
- value = e_o365_event_get_show_as (o365_event);
+ value = e_m365_event_get_show_as (m365_event);
- if (value == E_O365_FREE_BUSY_STATUS_FREE)
+ if (value == E_M365_FREE_BUSY_STATUS_FREE)
transp = I_CAL_TRANSP_TRANSPARENT;
- else if (value == E_O365_FREE_BUSY_STATUS_BUSY)
+ else if (value == E_M365_FREE_BUSY_STATUS_BUSY)
transp = I_CAL_TRANSP_OPAQUE;
if (transp != I_CAL_TRANSP_NONE)
@@ -453,7 +442,7 @@ ecb_o365_get_show_as (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_add_show_as (ECalBackendO365 *cbo365,
+ecb_m365_add_show_as (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
@@ -477,39 +466,39 @@ ecb_o365_add_show_as (ECalBackendO365 *cbo365,
}
if (new_value != old_value) {
- EO365FreeBusyStatusType value = E_O365_FREE_BUSY_STATUS_NOT_SET;
+ EM365FreeBusyStatusType value = E_M365_FREE_BUSY_STATUS_NOT_SET;
if (new_value == I_CAL_TRANSP_TRANSPARENT)
- value = E_O365_FREE_BUSY_STATUS_FREE;
+ value = E_M365_FREE_BUSY_STATUS_FREE;
else if (new_value == I_CAL_TRANSP_OPAQUE)
- value = E_O365_FREE_BUSY_STATUS_BUSY;
+ value = E_M365_FREE_BUSY_STATUS_BUSY;
- e_o365_event_add_show_as (builder, value);
+ e_m365_event_add_show_as (builder, value);
}
}
static void
-ecb_o365_get_location (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_location (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
- EO365Location *value;
+ EM365Location *value;
const gchar *tmp;
- value = e_o365_event_get_location (o365_event);
+ value = e_m365_event_get_location (m365_event);
if (!value)
return;
- tmp = e_o365_location_get_display_name (value);
+ tmp = e_m365_location_get_display_name (value);
if (tmp && *tmp)
i_cal_component_set_location (inout_comp, tmp);
}
static void
-ecb_o365_add_location (ECalBackendO365 *cbo365,
+ecb_m365_add_location (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
@@ -522,39 +511,39 @@ ecb_o365_add_location (ECalBackendO365 *cbo365,
if (g_strcmp0 (new_value, old_value) != 0) {
if (new_value && *new_value) {
- e_o365_event_begin_location (builder);
- e_o365_location_add_display_name (builder, new_value);
- e_o365_event_end_location (builder);
+ e_m365_event_begin_location (builder);
+ e_m365_location_add_display_name (builder, new_value);
+ e_m365_event_end_location (builder);
} else {
- e_o365_event_add_null_location (builder);
+ e_m365_event_add_null_location (builder);
}
}
}
static void
-ecb_o365_get_organizer (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_organizer (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
- EO365Recipient *value;
+ EM365Recipient *value;
JsonArray *attendees;
const gchar *name;
const gchar *address;
- value = e_o365_event_get_organizer (o365_event);
+ value = e_m365_event_get_organizer (m365_event);
if (!value)
return;
/* Include the organizer only if there is at least one attendee */
- attendees = e_o365_event_get_attendees (o365_event);
+ attendees = e_m365_event_get_attendees (m365_event);
if (!attendees || !json_array_get_length (attendees))
return;
- name = e_o365_recipient_get_name (value);
- address = e_o365_recipient_get_address (value);
+ name = e_m365_recipient_get_name (value);
+ address = e_m365_recipient_get_address (value);
if (address && *address) {
ECalComponentOrganizer *organizer;
@@ -574,7 +563,7 @@ ecb_o365_get_organizer (ECalBackendO365 *cbo365,
}
static const gchar *
-ecb_o365_strip_mailto (const gchar *value)
+ecb_m365_strip_mailto (const gchar *value)
{
if (value && g_ascii_strncasecmp (value, "mailto:", 7) == 0)
return value + 7;
@@ -583,7 +572,7 @@ ecb_o365_strip_mailto (const gchar *value)
}
static void
-ecb_o365_add_organizer (ECalBackendO365 *cbo365,
+ecb_m365_add_organizer (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
@@ -609,14 +598,14 @@ ecb_o365_add_organizer (ECalBackendO365 *cbo365,
if (new_value != old_value && (
g_strcmp0 (new_value ? e_cal_component_organizer_get_cn (new_value) : NULL,
old_value ? e_cal_component_organizer_get_cn (old_value) : NULL) != 0 ||
- g_strcmp0 (new_value ? ecb_o365_strip_mailto (e_cal_component_organizer_get_value (new_value)) :
NULL,
- old_value ? ecb_o365_strip_mailto (e_cal_component_organizer_get_value (old_value)) :
NULL) != 0)) {
+ g_strcmp0 (new_value ? ecb_m365_strip_mailto (e_cal_component_organizer_get_value (new_value)) :
NULL,
+ old_value ? ecb_m365_strip_mailto (e_cal_component_organizer_get_value (old_value)) :
NULL) != 0)) {
if (new_value) {
- e_o365_event_add_organizer (builder,
+ e_m365_event_add_organizer (builder,
e_cal_component_organizer_get_cn (new_value),
- ecb_o365_strip_mailto
(e_cal_component_organizer_get_value (new_value)));
+ ecb_m365_strip_mailto
(e_cal_component_organizer_get_value (new_value)));
} else {
- e_o365_event_add_null_organizer (builder);
+ e_m365_event_add_null_organizer (builder);
}
}
@@ -625,15 +614,15 @@ ecb_o365_add_organizer (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_get_attendees (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_attendees (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
JsonArray *array;
guint ii, sz;
- array = e_o365_event_get_attendees (o365_event);
+ array = e_m365_event_get_attendees (m365_event);
if (!array)
return;
@@ -641,48 +630,48 @@ ecb_o365_get_attendees (ECalBackendO365 *cbo365,
sz = json_array_get_length (array);
for (ii = 0; ii < sz; ii++) {
- EO365Attendee *o365_attendee;
- EO365ResponseStatus *o365_status;
- EO365AttendeeType o365_att_type;
- EO365EmailAddress *o365_address;
+ EM365Attendee *m365_attendee;
+ EM365ResponseStatus *m365_status;
+ EM365AttendeeType m365_att_type;
+ EM365EmailAddress *m365_address;
ECalComponentAttendee *e_attendee;
ICalParameterRole role = I_CAL_ROLE_NONE;
gchar *mailto_addr;
- o365_attendee = json_array_get_object_element (array, ii);
+ m365_attendee = json_array_get_object_element (array, ii);
- if (!o365_attendee)
+ if (!m365_attendee)
continue;
- o365_address = e_o365_attendee_get_email_address (o365_attendee);
+ m365_address = e_m365_attendee_get_email_address (m365_attendee);
- if (!o365_address || !e_o365_email_address_get_address (o365_address))
+ if (!m365_address || !e_m365_email_address_get_address (m365_address))
continue;
e_attendee = e_cal_component_attendee_new ();
- mailto_addr = g_strconcat ("mailto:", e_o365_email_address_get_address (o365_address), NULL);
+ mailto_addr = g_strconcat ("mailto:", e_m365_email_address_get_address (m365_address), NULL);
e_cal_component_attendee_set_value (e_attendee, mailto_addr);
g_free (mailto_addr);
- if (e_o365_email_address_get_name (o365_address))
- e_cal_component_attendee_set_cn (e_attendee, e_o365_email_address_get_name
(o365_address));
+ if (e_m365_email_address_get_name (m365_address))
+ e_cal_component_attendee_set_cn (e_attendee, e_m365_email_address_get_name
(m365_address));
- o365_status = e_o365_attendee_get_status (o365_attendee);
+ m365_status = e_m365_attendee_get_status (m365_attendee);
- if (o365_status) {
- EO365ResponseType o365_response;
+ if (m365_status) {
+ EM365ResponseType m365_response;
ICalParameterPartstat partstat = I_CAL_PARTSTAT_NONE;
- o365_response = e_o365_response_status_get_response (o365_status);
+ m365_response = e_m365_response_status_get_response (m365_status);
- if (o365_response == E_O365_RESPONSE_TENTATIVELY_ACCEPTED)
+ if (m365_response == E_M365_RESPONSE_TENTATIVELY_ACCEPTED)
partstat = I_CAL_PARTSTAT_TENTATIVE;
- else if (o365_response == E_O365_RESPONSE_ACCEPTED)
+ else if (m365_response == E_M365_RESPONSE_ACCEPTED)
partstat = I_CAL_PARTSTAT_ACCEPTED;
- else if (o365_response == E_O365_RESPONSE_DECLINED)
+ else if (m365_response == E_M365_RESPONSE_DECLINED)
partstat = I_CAL_PARTSTAT_DECLINED;
- else if (o365_response == E_O365_RESPONSE_NOT_RESPONDED)
+ else if (m365_response == E_M365_RESPONSE_NOT_RESPONDED)
partstat = I_CAL_PARTSTAT_NEEDSACTION;
if (partstat != I_CAL_PARTSTAT_NONE) {
@@ -690,7 +679,7 @@ ecb_o365_get_attendees (ECalBackendO365 *cbo365,
e_cal_component_attendee_set_partstat (e_attendee, partstat);
- tt = e_o365_response_status_get_time (o365_status);
+ tt = e_m365_response_status_get_time (m365_status);
if (tt > (time_t) 0) {
ECalComponentParameterBag *params;
@@ -710,15 +699,15 @@ ecb_o365_get_attendees (ECalBackendO365 *cbo365,
}
}
- o365_att_type = e_o365_attendee_get_type (o365_attendee);
+ m365_att_type = e_m365_attendee_get_type (m365_attendee);
- if (o365_att_type == E_O365_ATTENDEE_REQUIRED) {
+ if (m365_att_type == E_M365_ATTENDEE_REQUIRED) {
role = I_CAL_ROLE_REQPARTICIPANT;
e_cal_component_attendee_set_cutype (e_attendee, I_CAL_CUTYPE_INDIVIDUAL);
- } else if (o365_att_type == E_O365_ATTENDEE_OPTIONAL) {
+ } else if (m365_att_type == E_M365_ATTENDEE_OPTIONAL) {
role = I_CAL_ROLE_OPTPARTICIPANT;
e_cal_component_attendee_set_cutype (e_attendee, I_CAL_CUTYPE_INDIVIDUAL);
- } else if (o365_att_type == E_O365_ATTENDEE_RESOURCE) {
+ } else if (m365_att_type == E_M365_ATTENDEE_RESOURCE) {
e_cal_component_attendee_set_cutype (e_attendee, I_CAL_CUTYPE_RESOURCE);
}
@@ -732,7 +721,7 @@ ecb_o365_get_attendees (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_extract_attendees (ICalComponent *comp,
+ecb_m365_extract_attendees (ICalComponent *comp,
GHashTable **out_hash, /* const gchar *ECalComponentAttendee::value ~>
ECalComponentAttendee * */
GSList **out_slist) /* ECalComponentAttendee * */
{
@@ -772,7 +761,7 @@ ecb_o365_extract_attendees (ICalComponent *comp,
}
static void
-ecb_o365_add_attendees (ECalBackendO365 *cbo365,
+ecb_m365_add_attendees (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
@@ -781,8 +770,8 @@ ecb_o365_add_attendees (ECalBackendO365 *cbo365,
GHashTable *old_value = NULL;
GSList *new_value = NULL;
- ecb_o365_extract_attendees (new_comp, NULL, &new_value);
- ecb_o365_extract_attendees (old_comp, &old_value, NULL);
+ ecb_m365_extract_attendees (new_comp, NULL, &new_value);
+ ecb_m365_extract_attendees (old_comp, &old_value, NULL);
if (!new_value && !old_value)
return;
@@ -809,40 +798,40 @@ ecb_o365_add_attendees (ECalBackendO365 *cbo365,
}
if (!same) {
- e_o365_event_begin_attendees (builder);
+ e_m365_event_begin_attendees (builder);
for (link = new_value; link; link = g_slist_next (link)) {
ECalComponentAttendee *attendee = link->data;
- EO365AttendeeType att_type;
- EO365ResponseType response = E_O365_RESPONSE_NONE;
+ EM365AttendeeType att_type;
+ EM365ResponseType response = E_M365_RESPONSE_NONE;
time_t response_time = (time_t) 0;
ICalParameterPartstat partstat;
const gchar *address;
- address = ecb_o365_strip_mailto (e_cal_component_attendee_get_value
(attendee));
+ address = ecb_m365_strip_mailto (e_cal_component_attendee_get_value
(attendee));
if (e_cal_component_attendee_get_cutype (attendee) == I_CAL_CUTYPE_RESOURCE)
- att_type = E_O365_ATTENDEE_RESOURCE;
+ att_type = E_M365_ATTENDEE_RESOURCE;
else if (e_cal_component_attendee_get_role (attendee) ==
I_CAL_ROLE_REQPARTICIPANT ||
e_cal_component_attendee_get_role (attendee) == I_CAL_ROLE_CHAIR)
- att_type = E_O365_ATTENDEE_REQUIRED;
+ att_type = E_M365_ATTENDEE_REQUIRED;
else if (e_cal_component_attendee_get_role (attendee) ==
I_CAL_ROLE_OPTPARTICIPANT)
- att_type = E_O365_ATTENDEE_OPTIONAL;
+ att_type = E_M365_ATTENDEE_OPTIONAL;
else /* Fallback */
- att_type = E_O365_ATTENDEE_REQUIRED;
+ att_type = E_M365_ATTENDEE_REQUIRED;
partstat = e_cal_component_attendee_get_partstat (attendee);
if (partstat == I_CAL_PARTSTAT_TENTATIVE)
- response = E_O365_RESPONSE_TENTATIVELY_ACCEPTED;
+ response = E_M365_RESPONSE_TENTATIVELY_ACCEPTED;
else if (partstat == I_CAL_PARTSTAT_ACCEPTED)
- response = E_O365_RESPONSE_ACCEPTED;
+ response = E_M365_RESPONSE_ACCEPTED;
else if (partstat == I_CAL_PARTSTAT_DECLINED)
- response = E_O365_RESPONSE_DECLINED;
+ response = E_M365_RESPONSE_DECLINED;
else if (partstat == I_CAL_PARTSTAT_NEEDSACTION)
- response = E_O365_RESPONSE_NOT_RESPONDED;
+ response = E_M365_RESPONSE_NOT_RESPONDED;
- if (response != E_O365_RESPONSE_NONE) {
+ if (response != E_M365_RESPONSE_NONE) {
ECalComponentParameterBag *params;
guint ii, sz;
@@ -873,13 +862,13 @@ ecb_o365_add_attendees (ECalBackendO365 *cbo365,
}
}
- e_o365_event_add_attendee (builder, att_type, response, response_time,
e_cal_component_attendee_get_cn (attendee), address);
+ e_m365_event_add_attendee (builder, att_type, response, response_time,
e_cal_component_attendee_get_cn (attendee), address);
}
- e_o365_event_end_attendees (builder);
+ e_m365_event_end_attendees (builder);
}
} else {
- e_o365_event_add_null_attendees (builder);
+ e_m365_event_add_null_attendees (builder);
}
if (new_value)
@@ -889,22 +878,22 @@ ecb_o365_add_attendees (ECalBackendO365 *cbo365,
}
static ICalRecurrenceWeekday
-ecb_o365_day_of_week_to_ical (EO365DayOfWeekType dow)
+ecb_m365_day_of_week_to_ical (EM365DayOfWeekType dow)
{
switch (dow) {
- case E_O365_DAY_OF_WEEK_SUNDAY:
+ case E_M365_DAY_OF_WEEK_SUNDAY:
return I_CAL_SUNDAY_WEEKDAY;
- case E_O365_DAY_OF_WEEK_MONDAY:
+ case E_M365_DAY_OF_WEEK_MONDAY:
return I_CAL_MONDAY_WEEKDAY;
- case E_O365_DAY_OF_WEEK_TUESDAY:
+ case E_M365_DAY_OF_WEEK_TUESDAY:
return I_CAL_TUESDAY_WEEKDAY;
- case E_O365_DAY_OF_WEEK_WEDNESDAY:
+ case E_M365_DAY_OF_WEEK_WEDNESDAY:
return I_CAL_WEDNESDAY_WEEKDAY;
- case E_O365_DAY_OF_WEEK_THURSDAY:
+ case E_M365_DAY_OF_WEEK_THURSDAY:
return I_CAL_THURSDAY_WEEKDAY;
- case E_O365_DAY_OF_WEEK_FRIDAY:
+ case E_M365_DAY_OF_WEEK_FRIDAY:
return I_CAL_FRIDAY_WEEKDAY;
- case E_O365_DAY_OF_WEEK_SATURDAY:
+ case E_M365_DAY_OF_WEEK_SATURDAY:
return I_CAL_SATURDAY_WEEKDAY;
default:
break;
@@ -914,25 +903,25 @@ ecb_o365_day_of_week_to_ical (EO365DayOfWeekType dow)
}
static void
-ecb_o365_set_index_to_ical (ICalRecurrence *recr,
- EO365WeekIndexType index)
+ecb_m365_set_index_to_ical (ICalRecurrence *recr,
+ EM365WeekIndexType index)
{
gint by_pos = -2;
switch (index) {
- case E_O365_WEEK_INDEX_FIRST:
+ case E_M365_WEEK_INDEX_FIRST:
by_pos = 1;
break;
- case E_O365_WEEK_INDEX_SECOND:
+ case E_M365_WEEK_INDEX_SECOND:
by_pos = 2;
break;
- case E_O365_WEEK_INDEX_THIRD:
+ case E_M365_WEEK_INDEX_THIRD:
by_pos = 3;
break;
- case E_O365_WEEK_INDEX_FOURTH:
+ case E_M365_WEEK_INDEX_FOURTH:
by_pos = 4;
break;
- case E_O365_WEEK_INDEX_LAST:
+ case E_M365_WEEK_INDEX_LAST:
by_pos = -1;
break;
default:
@@ -944,7 +933,7 @@ ecb_o365_set_index_to_ical (ICalRecurrence *recr,
}
static void
-ecb_o365_set_days_of_week_to_ical (ICalRecurrence *recr,
+ecb_m365_set_days_of_week_to_ical (ICalRecurrence *recr,
JsonArray *days_of_week)
{
gint ii, jj, sz;
@@ -958,7 +947,7 @@ ecb_o365_set_days_of_week_to_ical (ICalRecurrence *recr,
for (jj = 0; jj < sz; jj++) {
ICalRecurrenceWeekday week_day;
- week_day = ecb_o365_day_of_week_to_ical (e_o365_array_get_day_of_week_element (days_of_week,
jj));
+ week_day = ecb_m365_day_of_week_to_ical (e_m365_array_get_day_of_week_element (days_of_week,
jj));
if (week_day != I_CAL_SUNDAY_WEEKDAY) {
i_cal_recurrence_set_by_day (recr, ii, week_day);
@@ -970,98 +959,98 @@ ecb_o365_set_days_of_week_to_ical (ICalRecurrence *recr,
}
static void
-ecb_o365_get_recurrence (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_recurrence (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
- EO365PatternedRecurrence *o365_recr;
- EO365RecurrencePattern *o365_pattern;
- EO365RecurrenceRange *o365_range;
+ EM365PatternedRecurrence *m365_recr;
+ EM365RecurrencePattern *m365_pattern;
+ EM365RecurrenceRange *m365_range;
ICalRecurrence *ical_recr;
ICalRecurrenceWeekday week_day;
gint month;
- o365_recr = e_o365_event_get_recurrence (o365_event);
- o365_pattern = o365_recr ? e_o365_patterned_recurrence_get_pattern (o365_recr) : NULL;
- o365_range = o365_recr ? e_o365_patterned_recurrence_get_range (o365_recr) : NULL;
+ m365_recr = e_m365_event_get_recurrence (m365_event);
+ m365_pattern = m365_recr ? e_m365_patterned_recurrence_get_pattern (m365_recr) : NULL;
+ m365_range = m365_recr ? e_m365_patterned_recurrence_get_range (m365_recr) : NULL;
- if (!o365_recr || !o365_pattern || !o365_range)
+ if (!m365_recr || !m365_pattern || !m365_range)
return;
ical_recr = i_cal_recurrence_new ();
- switch (e_o365_recurrence_pattern_get_type (o365_pattern)) {
- case E_O365_RECURRENCE_PATTERN_DAILY:
+ switch (e_m365_recurrence_pattern_get_type (m365_pattern)) {
+ case E_M365_RECURRENCE_PATTERN_DAILY:
i_cal_recurrence_set_freq (ical_recr, I_CAL_DAILY_RECURRENCE);
- i_cal_recurrence_set_interval (ical_recr, e_o365_recurrence_pattern_get_interval
(o365_pattern));
- ecb_o365_set_days_of_week_to_ical (ical_recr, e_o365_recurrence_pattern_get_days_of_week
(o365_pattern));
+ i_cal_recurrence_set_interval (ical_recr, e_m365_recurrence_pattern_get_interval
(m365_pattern));
+ ecb_m365_set_days_of_week_to_ical (ical_recr, e_m365_recurrence_pattern_get_days_of_week
(m365_pattern));
break;
- case E_O365_RECURRENCE_PATTERN_WEEKLY:
+ case E_M365_RECURRENCE_PATTERN_WEEKLY:
i_cal_recurrence_set_freq (ical_recr, I_CAL_WEEKLY_RECURRENCE);
- i_cal_recurrence_set_interval (ical_recr, e_o365_recurrence_pattern_get_interval
(o365_pattern));
+ i_cal_recurrence_set_interval (ical_recr, e_m365_recurrence_pattern_get_interval
(m365_pattern));
- week_day = ecb_o365_day_of_week_to_ical (e_o365_recurrence_pattern_get_first_day_of_week
(o365_recr));
+ week_day = ecb_m365_day_of_week_to_ical (e_m365_recurrence_pattern_get_first_day_of_week
(m365_recr));
if (week_day != I_CAL_NO_WEEKDAY)
i_cal_recurrence_set_week_start (ical_recr, week_day);
- ecb_o365_set_days_of_week_to_ical (ical_recr, e_o365_recurrence_pattern_get_days_of_week
(o365_pattern));
+ ecb_m365_set_days_of_week_to_ical (ical_recr, e_m365_recurrence_pattern_get_days_of_week
(m365_pattern));
break;
- case E_O365_RECURRENCE_PATTERN_ABSOLUTE_MONTHLY:
+ case E_M365_RECURRENCE_PATTERN_ABSOLUTE_MONTHLY:
i_cal_recurrence_set_freq (ical_recr, I_CAL_MONTHLY_RECURRENCE);
- i_cal_recurrence_set_interval (ical_recr, e_o365_recurrence_pattern_get_interval
(o365_pattern));
- i_cal_recurrence_set_by_month_day (ical_recr, 0, e_o365_recurrence_pattern_get_day_of_month
(o365_pattern));
+ i_cal_recurrence_set_interval (ical_recr, e_m365_recurrence_pattern_get_interval
(m365_pattern));
+ i_cal_recurrence_set_by_month_day (ical_recr, 0, e_m365_recurrence_pattern_get_day_of_month
(m365_pattern));
break;
- case E_O365_RECURRENCE_PATTERN_RELATIVE_MONTHLY:
+ case E_M365_RECURRENCE_PATTERN_RELATIVE_MONTHLY:
i_cal_recurrence_set_freq (ical_recr, I_CAL_MONTHLY_RECURRENCE);
- i_cal_recurrence_set_interval (ical_recr, e_o365_recurrence_pattern_get_interval
(o365_pattern));
- ecb_o365_set_days_of_week_to_ical (ical_recr, e_o365_recurrence_pattern_get_days_of_week
(o365_pattern));
- week_day = ecb_o365_day_of_week_to_ical (e_o365_recurrence_pattern_get_first_day_of_week
(o365_recr));
+ i_cal_recurrence_set_interval (ical_recr, e_m365_recurrence_pattern_get_interval
(m365_pattern));
+ ecb_m365_set_days_of_week_to_ical (ical_recr, e_m365_recurrence_pattern_get_days_of_week
(m365_pattern));
+ week_day = ecb_m365_day_of_week_to_ical (e_m365_recurrence_pattern_get_first_day_of_week
(m365_recr));
if (week_day != I_CAL_NO_WEEKDAY)
i_cal_recurrence_set_week_start (ical_recr, week_day);
- ecb_o365_set_index_to_ical (ical_recr, e_o365_recurrence_pattern_get_index (o365_recr));
+ ecb_m365_set_index_to_ical (ical_recr, e_m365_recurrence_pattern_get_index (m365_recr));
break;
- case E_O365_RECURRENCE_PATTERN_ABSOLUTE_YEARLY:
+ case E_M365_RECURRENCE_PATTERN_ABSOLUTE_YEARLY:
i_cal_recurrence_set_freq (ical_recr, I_CAL_YEARLY_RECURRENCE);
- i_cal_recurrence_set_interval (ical_recr, e_o365_recurrence_pattern_get_interval
(o365_pattern));
- i_cal_recurrence_set_by_month_day (ical_recr, 0, e_o365_recurrence_pattern_get_day_of_month
(o365_pattern));
+ i_cal_recurrence_set_interval (ical_recr, e_m365_recurrence_pattern_get_interval
(m365_pattern));
+ i_cal_recurrence_set_by_month_day (ical_recr, 0, e_m365_recurrence_pattern_get_day_of_month
(m365_pattern));
- month = e_o365_recurrence_pattern_get_month (o365_recr);
+ month = e_m365_recurrence_pattern_get_month (m365_recr);
if (month >= 1 && month <= 12)
i_cal_recurrence_set_by_month (ical_recr, 0, month);
break;
- case E_O365_RECURRENCE_PATTERN_RELATIVE_YEARLY:
+ case E_M365_RECURRENCE_PATTERN_RELATIVE_YEARLY:
i_cal_recurrence_set_freq (ical_recr, I_CAL_YEARLY_RECURRENCE);
- i_cal_recurrence_set_interval (ical_recr, e_o365_recurrence_pattern_get_interval
(o365_pattern));
- ecb_o365_set_days_of_week_to_ical (ical_recr, e_o365_recurrence_pattern_get_days_of_week
(o365_pattern));
- week_day = ecb_o365_day_of_week_to_ical (e_o365_recurrence_pattern_get_first_day_of_week
(o365_recr));
+ i_cal_recurrence_set_interval (ical_recr, e_m365_recurrence_pattern_get_interval
(m365_pattern));
+ ecb_m365_set_days_of_week_to_ical (ical_recr, e_m365_recurrence_pattern_get_days_of_week
(m365_pattern));
+ week_day = ecb_m365_day_of_week_to_ical (e_m365_recurrence_pattern_get_first_day_of_week
(m365_recr));
if (week_day != I_CAL_NO_WEEKDAY)
i_cal_recurrence_set_week_start (ical_recr, week_day);
- ecb_o365_set_index_to_ical (ical_recr, e_o365_recurrence_pattern_get_index (o365_recr));
+ ecb_m365_set_index_to_ical (ical_recr, e_m365_recurrence_pattern_get_index (m365_recr));
- month = e_o365_recurrence_pattern_get_month (o365_recr);
+ month = e_m365_recurrence_pattern_get_month (m365_recr);
if (month >= 1 && month <= 12)
i_cal_recurrence_set_by_month (ical_recr, 0, month);
break;
default:
g_object_unref (ical_recr);
- g_warning ("%s: Unknown pattern type: %d", G_STRFUNC, e_o365_recurrence_pattern_get_type
(o365_pattern));
+ g_warning ("%s: Unknown pattern type: %d", G_STRFUNC, e_m365_recurrence_pattern_get_type
(m365_pattern));
return;
}
- switch (e_o365_recurrence_range_get_type (o365_range)) {
- case E_O365_RECURRENCE_RANGE_ENDDATE:
- if (e_o365_recurrence_range_get_end_date (o365_range) > 0) {
+ switch (e_m365_recurrence_range_get_type (m365_range)) {
+ case E_M365_RECURRENCE_RANGE_ENDDATE:
+ if (e_m365_recurrence_range_get_end_date (m365_range) > 0) {
guint yy = 0, mm = 0, dd = 0;
- if (e_o365_date_decode (e_o365_recurrence_range_get_end_date (o365_range), &yy, &mm,
&dd)) {
+ if (e_m365_date_decode (e_m365_recurrence_range_get_end_date (m365_range), &yy, &mm,
&dd)) {
ICalTime *itt;
itt = i_cal_time_new ();
@@ -1074,13 +1063,13 @@ ecb_o365_get_recurrence (ECalBackendO365 *cbo365,
}
}
break;
- case E_O365_RECURRENCE_RANGE_NOEND:
+ case E_M365_RECURRENCE_RANGE_NOEND:
break;
- case E_O365_RECURRENCE_RANGE_NUMBERED:
- i_cal_recurrence_set_count (ical_recr, e_o365_recurrence_range_get_number_of_occurrences
(o365_range));
+ case E_M365_RECURRENCE_RANGE_NUMBERED:
+ i_cal_recurrence_set_count (ical_recr, e_m365_recurrence_range_get_number_of_occurrences
(m365_range));
break;
default:
- g_warning ("%s: Unknown range type: %d", G_STRFUNC, e_o365_recurrence_range_get_type
(o365_range));
+ g_warning ("%s: Unknown range type: %d", G_STRFUNC, e_m365_recurrence_range_get_type
(m365_range));
g_object_unref (ical_recr);
return;
}
@@ -1091,7 +1080,7 @@ ecb_o365_get_recurrence (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_add_recurrence (ECalBackendO365 *cbo365,
+ecb_m365_add_recurrence (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
@@ -1101,21 +1090,21 @@ ecb_o365_add_recurrence (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_get_importance (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_importance (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
- EO365ImportanceType value;
+ EM365ImportanceType value;
ICalProperty *prop = NULL;
- value = e_o365_event_get_importance (o365_event);
+ value = e_m365_event_get_importance (m365_event);
- if (value == E_O365_IMPORTANCE_LOW)
+ if (value == E_M365_IMPORTANCE_LOW)
prop = i_cal_property_new_priority (9);
- else if (value == E_O365_IMPORTANCE_NORMAL)
+ else if (value == E_M365_IMPORTANCE_NORMAL)
prop = i_cal_property_new_priority (5);
- else if (value == E_O365_IMPORTANCE_HIGH)
+ else if (value == E_M365_IMPORTANCE_HIGH)
prop = i_cal_property_new_priority (1);
if (prop)
@@ -1123,7 +1112,7 @@ ecb_o365_get_importance (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_add_importance (ECalBackendO365 *cbo365,
+ecb_m365_add_importance (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
@@ -1147,47 +1136,47 @@ ecb_o365_add_importance (ECalBackendO365 *cbo365,
}
if (new_value != old_value) {
- EO365ImportanceType value = E_O365_IMPORTANCE_NOT_SET;
+ EM365ImportanceType value = E_M365_IMPORTANCE_NOT_SET;
if (new_value >= 1 && new_value <= 4) {
- value = E_O365_IMPORTANCE_HIGH;
+ value = E_M365_IMPORTANCE_HIGH;
} else if (new_value == 5) {
- value = E_O365_IMPORTANCE_NORMAL;
+ value = E_M365_IMPORTANCE_NORMAL;
} else if (new_value >= 6 && new_value <= 9) {
- value = E_O365_IMPORTANCE_LOW;
+ value = E_M365_IMPORTANCE_LOW;
}
- e_o365_event_add_importance (builder, value);
+ e_m365_event_add_importance (builder, value);
}
}
static void
-ecb_o365_get_status (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_status (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind)
{
ICalPropertyStatus status = I_CAL_STATUS_NONE;
- if (e_o365_event_get_is_cancelled (o365_event)) {
+ if (e_m365_event_get_is_cancelled (m365_event)) {
status = I_CAL_STATUS_CANCELLED;
} else {
- EO365ResponseStatus *response_status;
+ EM365ResponseStatus *response_status;
- response_status = e_o365_event_get_response_status (o365_event);
+ response_status = e_m365_event_get_response_status (m365_event);
if (response_status) {
- EO365ResponseType response;
+ EM365ResponseType response;
- response = e_o365_response_status_get_response (response_status);
+ response = e_m365_response_status_get_response (response_status);
- if (response == E_O365_RESPONSE_TENTATIVELY_ACCEPTED)
+ if (response == E_M365_RESPONSE_TENTATIVELY_ACCEPTED)
status = I_CAL_STATUS_TENTATIVE;
- else if (response == E_O365_RESPONSE_ACCEPTED)
+ else if (response == E_M365_RESPONSE_ACCEPTED)
status = I_CAL_STATUS_CONFIRMED;
- else if (response == E_O365_RESPONSE_DECLINED)
+ else if (response == E_M365_RESPONSE_DECLINED)
status = I_CAL_STATUS_CANCELLED;
- else if (response == E_O365_RESPONSE_NOT_RESPONDED)
+ else if (response == E_M365_RESPONSE_NOT_RESPONDED)
status = I_CAL_STATUS_NEEDSACTION;
}
}
@@ -1197,26 +1186,26 @@ ecb_o365_get_status (ECalBackendO365 *cbo365,
}
static gboolean
-ecb_o365_get_reminder (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_reminder (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind,
GCancellable *cancellable,
GError **error)
{
- if (e_o365_event_get_is_reminder_on (o365_event)) {
+ if (e_m365_event_get_is_reminder_on (m365_event)) {
ECalComponentAlarm *alarm;
ECalComponentAlarmTrigger *trigger;
ICalDuration *duration;
- duration = i_cal_duration_new_from_int (-60 * e_o365_event_get_reminder_minutes_before_start
(o365_event));
+ duration = i_cal_duration_new_from_int (-60 * e_m365_event_get_reminder_minutes_before_start
(m365_event));
trigger = e_cal_component_alarm_trigger_new_relative
(E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, duration);
g_object_unref (duration);
alarm = e_cal_component_alarm_new ();
e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_DISPLAY);
- e_cal_component_alarm_take_summary (alarm, e_cal_component_text_new (e_o365_event_get_subject
(o365_event), NULL));
- e_cal_component_alarm_take_description (alarm, e_cal_component_text_new
(e_o365_event_get_subject (o365_event), NULL));
+ e_cal_component_alarm_take_summary (alarm, e_cal_component_text_new (e_m365_event_get_subject
(m365_event), NULL));
+ e_cal_component_alarm_take_description (alarm, e_cal_component_text_new
(e_m365_event_get_subject (m365_event), NULL));
e_cal_component_alarm_take_trigger (alarm, trigger);
i_cal_component_take_component (inout_comp, e_cal_component_alarm_get_as_component (alarm));
@@ -1228,11 +1217,11 @@ ecb_o365_get_reminder (ECalBackendO365 *cbo365,
}
static gboolean
-ecb_o365_add_reminder (ECalBackendO365 *cbo365,
+ecb_m365_add_reminder (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
@@ -1295,13 +1284,13 @@ ecb_o365_add_reminder (ECalBackendO365 *cbo365,
}
if (success && changed) {
- e_o365_event_add_is_reminder_on (builder, TRUE);
- e_o365_event_add_reminder_minutes_before_start (builder, i_cal_duration_as_int
(new_duration) / -60);
+ e_m365_event_add_is_reminder_on (builder, TRUE);
+ e_m365_event_add_reminder_minutes_before_start (builder, i_cal_duration_as_int
(new_duration) / -60);
}
e_cal_component_alarm_free (new_alarm);
} else {
- e_o365_event_add_is_reminder_on (builder, FALSE);
+ e_m365_event_add_is_reminder_on (builder, FALSE);
}
g_clear_object (&new_value);
@@ -1313,8 +1302,8 @@ ecb_o365_add_reminder (ECalBackendO365 *cbo365,
static gboolean
-ecb_o365_get_attachments (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_get_attachments (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind,
GCancellable *cancellable,
@@ -1323,25 +1312,25 @@ ecb_o365_get_attachments (ECalBackendO365 *cbo365,
GSList *attachments = NULL, *link;
gboolean success = TRUE;
- if (!e_o365_event_get_has_attachments (o365_event))
+ if (!e_m365_event_get_has_attachments (m365_event))
return TRUE;
- if (!e_o365_connection_list_event_attachments_sync (cbo365->priv->cnc, NULL,
- cbo365->priv->group_id, cbo365->priv->calendar_id, e_o365_event_get_id (o365_event),
"id,name,contentType,contentBytes",
+ if (!e_m365_connection_list_event_attachments_sync (cbm365->priv->cnc, NULL,
+ cbm365->priv->group_id, cbm365->priv->calendar_id, e_m365_event_get_id (m365_event),
"id,name,contentType,contentBytes",
&attachments, cancellable, error)) {
return FALSE;
}
for (link = attachments; link && success; link = g_slist_next (link)) {
CamelStream *content_stream;
- EO365Attachment *o365_attach = link->data;
+ EM365Attachment *m365_attach = link->data;
gchar *filename;
- if (!o365_attach || e_o365_attachment_get_data_type (o365_attach) !=
E_O365_ATTACHMENT_DATA_TYPE_FILE ||
- !e_o365_attachment_get_name (o365_attach))
+ if (!m365_attach || e_m365_attachment_get_data_type (m365_attach) !=
E_M365_ATTACHMENT_DATA_TYPE_FILE ||
+ !e_m365_attachment_get_name (m365_attach))
continue;
- filename = g_build_filename (cbo365->priv->attachments_dir, e_o365_event_get_id (o365_event),
e_o365_attachment_get_id (o365_attach), NULL);
+ filename = g_build_filename (cbm365->priv->attachments_dir, e_m365_event_get_id (m365_event),
e_m365_attachment_get_id (m365_attach), NULL);
content_stream = camel_stream_fs_new_with_name (filename, O_CREAT | O_TRUNC | O_WRONLY, 0666,
error);
@@ -1356,7 +1345,7 @@ ecb_o365_get_attachments (ECalBackendO365 *cbo365,
camel_stream_filter_add (CAMEL_STREAM_FILTER (filter_stream), filter);
g_object_unref (filter);
- base64_data = e_o365_file_attachment_get_content_bytes (o365_attach);
+ base64_data = e_m365_file_attachment_get_content_bytes (m365_attach);
if (base64_data && *base64_data)
success = camel_stream_write (filter_stream, base64_data, strlen
(base64_data), cancellable, error) != -1;
@@ -1383,7 +1372,7 @@ ecb_o365_get_attachments (ECalBackendO365 *cbo365,
ical_attach = i_cal_attach_new_from_url (enc_uri);
prop = i_cal_property_new_attach (ical_attach);
- tmp = e_o365_attachment_get_name (o365_attach);
+ tmp = e_m365_attachment_get_name (m365_attach);
if (!tmp || !*tmp)
tmp = "attachment.dat";
@@ -1391,14 +1380,14 @@ ecb_o365_get_attachments (ECalBackendO365 *cbo365,
param = i_cal_parameter_new_filename (tmp);
i_cal_property_take_parameter (prop, param);
- tmp = e_o365_attachment_get_content_type (o365_attach);
+ tmp = e_m365_attachment_get_content_type (m365_attach);
if (tmp && *tmp) {
param = i_cal_parameter_new_fmttype (tmp);
i_cal_property_take_parameter (prop, param);
}
- param = i_cal_parameter_new_x (e_o365_attachment_get_id
(o365_attach));
+ param = i_cal_parameter_new_x (e_m365_attachment_get_id
(m365_attach));
i_cal_parameter_set_xname (param, "X-M365-ATTACHMENTID");
i_cal_property_take_parameter (prop, param);
@@ -1424,7 +1413,7 @@ ecb_o365_get_attachments (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_extract_attachments (ICalComponent *comp,
+ecb_m365_extract_attachments (ICalComponent *comp,
GHashTable **out_hash, /* gchar *attachment_id ~> ICalProperty * */
GSList **out_slist) /* ICalProperty * */
{
@@ -1462,11 +1451,11 @@ ecb_o365_extract_attachments (ICalComponent *comp,
}
static gboolean
-ecb_o365_add_attachments (ECalBackendO365 *cbo365,
+ecb_m365_add_attachments (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp,
ICalPropertyKind prop_kind,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error)
@@ -1480,8 +1469,8 @@ ecb_o365_add_attachments (ECalBackendO365 *cbo365,
return TRUE;
}
- ecb_o365_extract_attachments (new_comp, NULL, &new_attachs);
- ecb_o365_extract_attachments (old_comp, &old_attachs, NULL);
+ ecb_m365_extract_attachments (new_comp, NULL, &new_attachs);
+ ecb_m365_extract_attachments (old_comp, &old_attachs, NULL);
if (new_attachs) {
GSList *link, *save_attachs = new_attachs;
@@ -1557,8 +1546,8 @@ ecb_o365_add_attachments (ECalBackendO365 *cbo365,
bytes = camel_stream_mem_get_byte_array
(CAMEL_STREAM_MEM (base64_stream));
builder = json_builder_new_immutable ();
- e_o365_attachment_begin_attachment (builder,
E_O365_ATTACHMENT_DATA_TYPE_FILE);
- e_o365_file_attachment_add_content_bytes (builder,
(const gchar *) bytes->data);
+ e_m365_attachment_begin_attachment (builder,
E_M365_ATTACHMENT_DATA_TYPE_FILE);
+ e_m365_file_attachment_add_content_bytes (builder,
(const gchar *) bytes->data);
}
g_object_unref (base64_stream);
@@ -1584,8 +1573,8 @@ ecb_o365_add_attachments (ECalBackendO365 *cbo365,
if (base64_data) {
builder = json_builder_new_immutable ();
- e_o365_attachment_begin_attachment (builder,
E_O365_ATTACHMENT_DATA_TYPE_FILE);
- e_o365_file_attachment_add_content_bytes (builder, base64_data);
+ e_m365_attachment_begin_attachment (builder,
E_M365_ATTACHMENT_DATA_TYPE_FILE);
+ e_m365_file_attachment_add_content_bytes (builder, base64_data);
} else {
g_propagate_error (error, EC_ERROR_EX (E_CLIENT_ERROR_OTHER_ERROR,
_("Failed to get inline attachment data")));
}
@@ -1601,7 +1590,7 @@ ecb_o365_add_attachments (ECalBackendO365 *cbo365,
tmp = i_cal_parameter_get_filename (param);
if (tmp && *tmp)
- e_o365_attachment_add_name (builder, tmp);
+ e_m365_attachment_add_name (builder, tmp);
g_clear_object (¶m);
}
@@ -1612,19 +1601,19 @@ ecb_o365_add_attachments (ECalBackendO365 *cbo365,
tmp = i_cal_parameter_get_fmttype (param);
if (tmp && *tmp)
- e_o365_attachment_add_content_type (builder, tmp);
+ e_m365_attachment_add_content_type (builder, tmp);
else
- e_o365_attachment_add_content_type (builder,
"application/octet-stream");
+ e_m365_attachment_add_content_type (builder,
"application/octet-stream");
g_clear_object (¶m);
} else {
- e_o365_attachment_add_content_type (builder,
"application/octet-stream");
+ e_m365_attachment_add_content_type (builder,
"application/octet-stream");
}
- e_o365_attachment_end_attachment (builder);
+ e_m365_attachment_end_attachment (builder);
- success = e_o365_connection_add_event_attachment_sync (cbo365->priv->cnc,
NULL,
- cbo365->priv->group_id, cbo365->priv->calendar_id, o365_id,
+ success = e_m365_connection_add_event_attachment_sync (cbm365->priv->cnc,
NULL,
+ cbm365->priv->group_id, cbm365->priv->calendar_id, m365_id,
builder, NULL, cancellable, error);
g_object_unref (builder);
@@ -1646,8 +1635,8 @@ ecb_o365_add_attachments (ECalBackendO365 *cbo365,
while (g_hash_table_iter_next (&iter, &key, NULL) && success) {
const gchar *attachment_id = key;
- success = e_o365_connection_delete_event_attachment_sync (cbo365->priv->cnc, NULL,
- cbo365->priv->group_id, cbo365->priv->calendar_id, i_cal_component_get_uid
(new_comp),
+ success = e_m365_connection_delete_event_attachment_sync (cbm365->priv->cnc, NULL,
+ cbm365->priv->group_id, cbm365->priv->calendar_id, i_cal_component_get_uid
(new_comp),
attachment_id, cancellable, error);
}
}
@@ -1666,52 +1655,52 @@ ecb_o365_add_attachments (ECalBackendO365 *cbo365,
struct _mappings {
ICalPropertyKind prop_kind;
gboolean add_in_second_go;
- void (* get_simple_func) (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ void (* get_simple_func) (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind);
- gboolean (* get_func) (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ gboolean (* get_func) (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
ICalComponent *inout_comp,
ICalPropertyKind prop_kind,
GCancellable *cancellable,
GError **error);
- void (* add_simple_func) (ECalBackendO365 *cbo365,
+ void (* add_simple_func) (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp, /* nullable */
ICalPropertyKind prop_kind,
JsonBuilder *builder);
- gboolean (* add_func) (ECalBackendO365 *cbo365,
+ gboolean (* add_func) (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp, /* nullable */
ICalPropertyKind prop_kind,
- const gchar *o365_id,
+ const gchar *m365_id,
JsonBuilder *builder,
GCancellable *cancellable,
GError **error);
} mappings[] = {
- SIMPLE_FIELD (I_CAL_UID_PROPERTY, ecb_o365_get_uid, NULL),
- SIMPLE_FIELD (I_CAL_CREATED_PROPERTY, ecb_o365_get_date_time, NULL),
- SIMPLE_FIELD (I_CAL_LASTMODIFIED_PROPERTY, ecb_o365_get_date_time, NULL),
- SIMPLE_FIELD (I_CAL_DTSTART_PROPERTY, ecb_o365_get_date_time_zone,
ecb_o365_add_date_time_zone),
- SIMPLE_FIELD (I_CAL_DTEND_PROPERTY, ecb_o365_get_date_time_zone,
ecb_o365_add_date_time_zone),
- SIMPLE_FIELD (I_CAL_CATEGORIES_PROPERTY, ecb_o365_get_categories,
ecb_o365_add_categories),
- SIMPLE_FIELD (I_CAL_SUMMARY_PROPERTY, ecb_o365_get_subject, ecb_o365_add_subject),
- SIMPLE_FIELD (I_CAL_DESCRIPTION_PROPERTY, ecb_o365_get_body, ecb_o365_add_body),
- SIMPLE_FIELD (I_CAL_CLASS_PROPERTY, ecb_o365_get_sensitivity,
ecb_o365_add_sensitivity),
- SIMPLE_FIELD (I_CAL_TRANSP_PROPERTY, ecb_o365_get_show_as, ecb_o365_add_show_as),
- SIMPLE_FIELD (I_CAL_LOCATION_PROPERTY, ecb_o365_get_location,
ecb_o365_add_location),
- SIMPLE_FIELD (I_CAL_ORGANIZER_PROPERTY, ecb_o365_get_organizer,
ecb_o365_add_organizer),
- SIMPLE_FIELD (I_CAL_ATTENDEE_PROPERTY, ecb_o365_get_attendees,
ecb_o365_add_attendees),
- SIMPLE_FIELD (I_CAL_RRULE_PROPERTY, ecb_o365_get_recurrence,
ecb_o365_add_recurrence),
- SIMPLE_FIELD (I_CAL_PRIORITY_PROPERTY, ecb_o365_get_importance,
ecb_o365_add_importance),
- SIMPLE_FIELD (I_CAL_STATUS_PROPERTY, ecb_o365_get_status, NULL),
- COMPLEX_FIELD (I_CAL_X_PROPERTY, ecb_o365_get_reminder,
ecb_o365_add_reminder),
- COMPLEX_FIELD_2 (I_CAL_ATTACH_PROPERTY, ecb_o365_get_attachments,
ecb_o365_add_attachments)
+ SIMPLE_FIELD (I_CAL_UID_PROPERTY, ecb_m365_get_uid, NULL),
+ SIMPLE_FIELD (I_CAL_CREATED_PROPERTY, ecb_m365_get_date_time, NULL),
+ SIMPLE_FIELD (I_CAL_LASTMODIFIED_PROPERTY, ecb_m365_get_date_time, NULL),
+ SIMPLE_FIELD (I_CAL_DTSTART_PROPERTY, ecb_m365_get_date_time_zone,
ecb_m365_add_date_time_zone),
+ SIMPLE_FIELD (I_CAL_DTEND_PROPERTY, ecb_m365_get_date_time_zone,
ecb_m365_add_date_time_zone),
+ SIMPLE_FIELD (I_CAL_CATEGORIES_PROPERTY, ecb_m365_get_categories,
ecb_m365_add_categories),
+ SIMPLE_FIELD (I_CAL_SUMMARY_PROPERTY, ecb_m365_get_subject, ecb_m365_add_subject),
+ SIMPLE_FIELD (I_CAL_DESCRIPTION_PROPERTY, ecb_m365_get_body, ecb_m365_add_body),
+ SIMPLE_FIELD (I_CAL_CLASS_PROPERTY, ecb_m365_get_sensitivity,
ecb_m365_add_sensitivity),
+ SIMPLE_FIELD (I_CAL_TRANSP_PROPERTY, ecb_m365_get_show_as, ecb_m365_add_show_as),
+ SIMPLE_FIELD (I_CAL_LOCATION_PROPERTY, ecb_m365_get_location,
ecb_m365_add_location),
+ SIMPLE_FIELD (I_CAL_ORGANIZER_PROPERTY, ecb_m365_get_organizer,
ecb_m365_add_organizer),
+ SIMPLE_FIELD (I_CAL_ATTENDEE_PROPERTY, ecb_m365_get_attendees,
ecb_m365_add_attendees),
+ SIMPLE_FIELD (I_CAL_RRULE_PROPERTY, ecb_m365_get_recurrence,
ecb_m365_add_recurrence),
+ SIMPLE_FIELD (I_CAL_PRIORITY_PROPERTY, ecb_m365_get_importance,
ecb_m365_add_importance),
+ SIMPLE_FIELD (I_CAL_STATUS_PROPERTY, ecb_m365_get_status, NULL),
+ COMPLEX_FIELD (I_CAL_X_PROPERTY, ecb_m365_get_reminder,
ecb_m365_add_reminder),
+ COMPLEX_FIELD_2 (I_CAL_ATTACH_PROPERTY, ecb_m365_get_attachments,
ecb_m365_add_attachments)
};
static gchar *
-ecb_o365_join_to_extra (const gchar *change_key,
+ecb_m365_join_to_extra (const gchar *change_key,
const gchar *ical_comp)
{
if (!change_key && !ical_comp)
@@ -1721,8 +1710,8 @@ ecb_o365_join_to_extra (const gchar *change_key,
}
static ICalComponent *
-ecb_o365_json_to_ical (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_json_to_ical (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
GCancellable *cancellable,
GError **error)
{
@@ -1730,15 +1719,15 @@ ecb_o365_json_to_ical (ECalBackendO365 *cbo365,
gint ii;
gboolean success = TRUE;
- g_return_val_if_fail (o365_event != NULL, NULL);
+ g_return_val_if_fail (m365_event != NULL, NULL);
icomp = i_cal_component_new_vevent ();
for (ii = 0; success && ii < G_N_ELEMENTS (mappings); ii++) {
if (mappings[ii].get_simple_func) {
- mappings[ii].get_simple_func (cbo365, o365_event, icomp, mappings[ii].prop_kind);
+ mappings[ii].get_simple_func (cbm365, m365_event, icomp, mappings[ii].prop_kind);
} else if (mappings[ii].get_func) {
- success = mappings[ii].get_func (cbo365, o365_event, icomp, mappings[ii].prop_kind,
cancellable, error);
+ success = mappings[ii].get_func (cbm365, m365_event, icomp, mappings[ii].prop_kind,
cancellable, error);
}
}
@@ -1749,26 +1738,26 @@ ecb_o365_json_to_ical (ECalBackendO365 *cbo365,
}
static ECalMetaBackendInfo *
-ecb_o365_json_to_ical_nfo (ECalBackendO365 *cbo365,
- EO365Event *o365_event,
+ecb_m365_json_to_ical_nfo (ECalBackendM365 *cbm365,
+ EM365Event *m365_event,
GCancellable *cancellable,
GError **error)
{
ECalMetaBackendInfo *nfo;
ICalComponent *icomp;
- icomp = ecb_o365_json_to_ical (cbo365, o365_event, cancellable, error);
+ icomp = ecb_m365_json_to_ical (cbm365, m365_event, cancellable, error);
if (!icomp)
return NULL;
nfo = e_cal_meta_backend_info_new (i_cal_component_get_uid (icomp),
- e_o365_event_get_change_key (o365_event),
+ e_m365_event_get_change_key (m365_event),
NULL, NULL);
if (nfo) {
nfo->object = i_cal_component_as_ical_string (icomp);
- nfo->extra = ecb_o365_join_to_extra (e_o365_event_get_change_key (o365_event), nfo->object);
+ nfo->extra = ecb_m365_join_to_extra (e_m365_event_get_change_key (m365_event), nfo->object);
}
g_clear_object (&icomp);
@@ -1777,7 +1766,7 @@ ecb_o365_json_to_ical_nfo (ECalBackendO365 *cbo365,
}
static JsonBuilder *
-ecb_o365_ical_to_json_locked (ECalBackendO365 *cbo365,
+ecb_m365_ical_to_json_locked (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp, /* nullable */
GCancellable *cancellable,
@@ -1790,17 +1779,17 @@ ecb_o365_ical_to_json_locked (ECalBackendO365 *cbo365,
g_return_val_if_fail (new_comp != NULL, NULL);
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
+ e_m365_json_begin_object_member (builder, NULL);
for (ii = 0; success && ii < G_N_ELEMENTS (mappings); ii++) {
if (mappings[ii].add_simple_func) {
- mappings[ii].add_simple_func (cbo365, new_comp, old_comp, mappings[ii].prop_kind,
builder);
+ mappings[ii].add_simple_func (cbm365, new_comp, old_comp, mappings[ii].prop_kind,
builder);
} else if (!mappings[ii].add_in_second_go && mappings[ii].add_func) {
- success = mappings[ii].add_func (cbo365, new_comp, old_comp, mappings[ii].prop_kind,
NULL, builder, cancellable, error);
+ success = mappings[ii].add_func (cbm365, new_comp, old_comp, mappings[ii].prop_kind,
NULL, builder, cancellable, error);
}
}
- e_o365_json_end_object_member (builder);
+ e_m365_json_end_object_member (builder);
if (!success)
g_clear_object (&builder);
@@ -1809,10 +1798,10 @@ ecb_o365_ical_to_json_locked (ECalBackendO365 *cbo365,
}
static gboolean
-ecb_o365_ical_to_json_2nd_go_locked (ECalBackendO365 *cbo365,
+ecb_m365_ical_to_json_2nd_go_locked (ECalBackendM365 *cbm365,
ICalComponent *new_comp,
ICalComponent *old_comp, /* nullable */
- const gchar *o365_id,
+ const gchar *m365_id,
GCancellable *cancellable,
GError **error)
{
@@ -1823,7 +1812,7 @@ ecb_o365_ical_to_json_2nd_go_locked (ECalBackendO365 *cbo365,
for (ii = 0; success && ii < G_N_ELEMENTS (mappings); ii++) {
if (mappings[ii].add_in_second_go && mappings[ii].add_func) {
- success = mappings[ii].add_func (cbo365, new_comp, old_comp, mappings[ii].prop_kind,
o365_id, NULL, cancellable, error);
+ success = mappings[ii].add_func (cbm365, new_comp, old_comp, mappings[ii].prop_kind,
m365_id, NULL, cancellable, error);
}
}
@@ -1831,7 +1820,7 @@ ecb_o365_ical_to_json_2nd_go_locked (ECalBackendO365 *cbo365,
}
static gboolean
-ecb_o365_download_event_changes_locked (ECalBackendO365 *cbo365,
+ecb_m365_download_event_changes_locked (ECalBackendM365 *cbm365,
const GSList *ids,
GSList **out_info_objects,
GCancellable *cancellable,
@@ -1842,17 +1831,17 @@ ecb_o365_download_event_changes_locked (ECalBackendO365 *cbo365,
if (!ids)
return TRUE;
- if (!e_o365_connection_get_events_sync (cbo365->priv->cnc, NULL, cbo365->priv->group_id,
cbo365->priv->calendar_id, ids, NULL, NULL, &events, cancellable, error))
+ if (!e_m365_connection_get_events_sync (cbm365->priv->cnc, NULL, cbm365->priv->group_id,
cbm365->priv->calendar_id, ids, NULL, NULL, &events, cancellable, error))
return FALSE;
for (link = events; link; link = g_slist_next (link)) {
- EO365Event *event = link->data;
+ EM365Event *event = link->data;
ECalMetaBackendInfo *nfo;
if (!event)
continue;
- nfo = ecb_o365_json_to_ical_nfo (cbo365, event, cancellable, error);
+ nfo = ecb_m365_json_to_ical_nfo (cbm365, event, cancellable, error);
if (nfo)
*out_info_objects = g_slist_prepend (*out_info_objects, nfo);
@@ -1864,46 +1853,46 @@ ecb_o365_download_event_changes_locked (ECalBackendO365 *cbo365,
}
static void
-ecb_o365_maybe_disconnect_sync (ECalBackendO365 *cbo365,
+ecb_m365_maybe_disconnect_sync (ECalBackendM365 *cbm365,
GError **in_perror,
GCancellable *cancellable)
{
- g_return_if_fail (E_IS_CAL_BACKEND_O365 (cbo365));
+ g_return_if_fail (E_IS_CAL_BACKEND_M365 (cbm365));
if (in_perror && g_error_matches (*in_perror, E_CLIENT_ERROR, E_CLIENT_ERROR_AUTHENTICATION_FAILED)) {
- e_cal_meta_backend_disconnect_sync (E_CAL_META_BACKEND (cbo365), cancellable, NULL);
- e_backend_schedule_credentials_required (E_BACKEND (cbo365),
E_SOURCE_CREDENTIALS_REASON_REJECTED, NULL, 0, NULL, NULL, G_STRFUNC);
+ e_cal_meta_backend_disconnect_sync (E_CAL_META_BACKEND (cbm365), cancellable, NULL);
+ e_backend_schedule_credentials_required (E_BACKEND (cbm365),
E_SOURCE_CREDENTIALS_REASON_REJECTED, NULL, 0, NULL, NULL, G_STRFUNC);
}
}
static gboolean
-ecb_o365_unset_connection_sync (ECalBackendO365 *cbo365,
+ecb_m365_unset_connection_sync (ECalBackendM365 *cbm365,
gboolean is_disconnect,
GCancellable *cancellable,
GError **error)
{
gboolean success = TRUE;
- g_return_val_if_fail (E_IS_CAL_BACKEND_O365 (cbo365), FALSE);
+ g_return_val_if_fail (E_IS_CAL_BACKEND_M365 (cbm365), FALSE);
- LOCK (cbo365);
+ LOCK (cbm365);
- if (cbo365->priv->cnc) {
+ if (cbm365->priv->cnc) {
if (is_disconnect)
- success = e_o365_connection_disconnect_sync (cbo365->priv->cnc, cancellable, error);
+ success = e_m365_connection_disconnect_sync (cbm365->priv->cnc, cancellable, error);
}
- g_clear_object (&cbo365->priv->cnc);
- g_clear_pointer (&cbo365->priv->group_id, g_free);
- g_clear_pointer (&cbo365->priv->calendar_id, g_free);
+ g_clear_object (&cbm365->priv->cnc);
+ g_clear_pointer (&cbm365->priv->group_id, g_free);
+ g_clear_pointer (&cbm365->priv->calendar_id, g_free);
- UNLOCK (cbo365);
+ UNLOCK (cbm365);
return success;
}
static gboolean
-ecb_o365_connect_sync (ECalMetaBackend *meta_backend,
+ecb_m365_connect_sync (ECalMetaBackend *meta_backend,
const ENamedParameters *credentials,
ESourceAuthenticationResult *out_auth_result,
gchar **out_certificate_pem,
@@ -1911,18 +1900,18 @@ ecb_o365_connect_sync (ECalMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- ECalBackendO365 *cbo365;
+ ECalBackendM365 *cbm365;
gboolean success = FALSE;
- g_return_val_if_fail (E_IS_CAL_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_CAL_BACKEND_M365 (meta_backend), FALSE);
g_return_val_if_fail (out_auth_result != NULL, FALSE);
- cbo365 = E_CAL_BACKEND_O365 (meta_backend);
+ cbm365 = E_CAL_BACKEND_M365 (meta_backend);
- LOCK (cbo365);
+ LOCK (cbm365);
- if (cbo365->priv->cnc) {
- UNLOCK (cbo365);
+ if (cbm365->priv->cnc) {
+ UNLOCK (cbm365);
*out_auth_result = E_SOURCE_AUTHENTICATION_ACCEPTED;
@@ -1931,45 +1920,45 @@ ecb_o365_connect_sync (ECalMetaBackend *meta_backend,
EBackend *backend;
ESourceRegistry *registry;
ESource *source;
- EO365Connection *cnc;
- ESourceO365Folder *o365_folder_extension;
- CamelO365Settings *o365_settings;
+ EM365Connection *cnc;
+ ESourceM365Folder *m365_folder_extension;
+ CamelM365Settings *m365_settings;
gchar *group_id;
gchar *calendar_id;
- backend = E_BACKEND (cbo365);
+ backend = E_BACKEND (cbm365);
source = e_backend_get_source (backend);
- registry = e_cal_backend_get_registry (E_CAL_BACKEND (cbo365));
- o365_settings = camel_o365_settings_get_from_backend (backend, registry);
- g_warn_if_fail (o365_settings != NULL);
+ registry = e_cal_backend_get_registry (E_CAL_BACKEND (cbm365));
+ m365_settings = camel_m365_settings_get_from_backend (backend, registry);
+ g_warn_if_fail (m365_settings != NULL);
- o365_folder_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_O365_FOLDER);
- group_id = e_source_o365_folder_dup_group_id (o365_folder_extension);
- calendar_id = e_source_o365_folder_dup_id (o365_folder_extension);
+ m365_folder_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_M365_FOLDER);
+ group_id = e_source_m365_folder_dup_group_id (m365_folder_extension);
+ calendar_id = e_source_m365_folder_dup_id (m365_folder_extension);
if (calendar_id) {
- cnc = e_o365_connection_new_for_backend (backend, registry, source, o365_settings);
+ cnc = e_m365_connection_new_for_backend (backend, registry, source, m365_settings);
- *out_auth_result = e_o365_connection_authenticate_sync (cnc, NULL,
E_O365_FOLDER_KIND_CALENDAR, group_id, calendar_id,
+ *out_auth_result = e_m365_connection_authenticate_sync (cnc, NULL,
E_M365_FOLDER_KIND_CALENDAR, group_id, calendar_id,
out_certificate_pem, out_certificate_errors, cancellable, error);
if (*out_auth_result == E_SOURCE_AUTHENTICATION_ACCEPTED) {
- cbo365->priv->cnc = g_object_ref (cnc);
+ cbm365->priv->cnc = g_object_ref (cnc);
- g_warn_if_fail (cbo365->priv->group_id == NULL);
- g_warn_if_fail (cbo365->priv->calendar_id == NULL);
+ g_warn_if_fail (cbm365->priv->group_id == NULL);
+ g_warn_if_fail (cbm365->priv->calendar_id == NULL);
- g_free (cbo365->priv->group_id);
- cbo365->priv->group_id = group_id;
+ g_free (cbm365->priv->group_id);
+ cbm365->priv->group_id = group_id;
- g_free (cbo365->priv->calendar_id);
- cbo365->priv->calendar_id = calendar_id;
+ g_free (cbm365->priv->calendar_id);
+ cbm365->priv->calendar_id = calendar_id;
group_id = NULL;
calendar_id = NULL;
success = TRUE;
- e_cal_backend_set_writable (E_CAL_BACKEND (cbo365), TRUE);
+ e_cal_backend_set_writable (E_CAL_BACKEND (cbm365), TRUE);
}
} else {
*out_auth_result = E_SOURCE_AUTHENTICATION_ERROR;
@@ -1981,25 +1970,25 @@ ecb_o365_connect_sync (ECalMetaBackend *meta_backend,
g_free (calendar_id);
}
- UNLOCK (cbo365);
+ UNLOCK (cbm365);
- ecb_o365_convert_error_to_client_error (error);
+ ecb_m365_convert_error_to_client_error (error);
return success;
}
static gboolean
-ecb_o365_disconnect_sync (ECalMetaBackend *meta_backend,
+ecb_m365_disconnect_sync (ECalMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (E_IS_CAL_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_CAL_BACKEND_M365 (meta_backend), FALSE);
- return ecb_o365_unset_connection_sync (E_CAL_BACKEND_O365 (meta_backend), TRUE, cancellable, error);
+ return ecb_m365_unset_connection_sync (E_CAL_BACKEND_M365 (meta_backend), TRUE, cancellable, error);
}
static gboolean
-ecb_o365_get_changes_sync (ECalMetaBackend *meta_backend,
+ecb_m365_get_changes_sync (ECalMetaBackend *meta_backend,
const gchar *last_sync_tag,
gboolean is_repeat,
gchar **out_new_sync_tag,
@@ -2010,13 +1999,13 @@ ecb_o365_get_changes_sync (ECalMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- ECalBackendO365 *cbo365;
+ ECalBackendM365 *cbm365;
ECalCache *cal_cache;
GSList *events = NULL, *link;
gboolean full_read;
gboolean success = TRUE;
- g_return_val_if_fail (E_IS_CAL_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_CAL_BACKEND_M365 (meta_backend), FALSE);
g_return_val_if_fail (out_new_sync_tag != NULL, FALSE);
g_return_val_if_fail (out_repeat != NULL, FALSE);
g_return_val_if_fail (out_created_objects != NULL, FALSE);
@@ -2027,16 +2016,16 @@ ecb_o365_get_changes_sync (ECalMetaBackend *meta_backend,
*out_modified_objects = NULL;
*out_removed_objects = NULL;
- cbo365 = E_CAL_BACKEND_O365 (meta_backend);
+ cbm365 = E_CAL_BACKEND_M365 (meta_backend);
cal_cache = e_cal_meta_backend_ref_cache (meta_backend);
g_return_val_if_fail (E_IS_CAL_CACHE (cal_cache), FALSE);
- LOCK (cbo365);
+ LOCK (cbm365);
full_read = !e_cache_get_count (E_CACHE (cal_cache), E_CACHE_INCLUDE_DELETED, cancellable, NULL);
- success = e_o365_connection_list_events_sync (cbo365->priv->cnc, NULL, cbo365->priv->group_id,
cbo365->priv->calendar_id, NULL,
+ success = e_m365_connection_list_events_sync (cbm365->priv->cnc, NULL, cbm365->priv->group_id,
cbm365->priv->calendar_id, NULL,
full_read ? NULL : "id,changeKey", &events, cancellable, error);
if (success) {
@@ -2044,20 +2033,20 @@ ecb_o365_get_changes_sync (ECalMetaBackend *meta_backend,
GSList *changed_ids = NULL; /* const gchar *, borrowed from 'events' objects */
for (link = events; link && !g_cancellable_is_cancelled (cancellable); link = g_slist_next
(link)) {
- EO365Event *event = link->data;
+ EM365Event *event = link->data;
const gchar *id, *change_key;
gchar *extra = NULL;
if (!event)
continue;
- id = e_o365_event_get_id (event);
- change_key = e_o365_event_get_change_key (event);
+ id = e_m365_event_get_id (event);
+ change_key = e_m365_event_get_change_key (event);
if (e_cal_cache_get_component_extra (cal_cache, id, NULL, &extra, cancellable, NULL))
{
const gchar *saved_change_key = NULL;
- ecb_o365_split_extra (extra, &saved_change_key, NULL);
+ ecb_m365_split_extra (extra, &saved_change_key, NULL);
if (g_strcmp0 (saved_change_key, change_key) == 0) {
g_free (extra);
@@ -2065,7 +2054,7 @@ ecb_o365_get_changes_sync (ECalMetaBackend *meta_backend,
} else if (full_read) {
ECalMetaBackendInfo *nfo;
- nfo = ecb_o365_json_to_ical_nfo (cbo365, event, cancellable, NULL);
+ nfo = ecb_m365_json_to_ical_nfo (cbm365, event, cancellable, NULL);
if (nfo)
*out_modified_objects = g_slist_prepend
(*out_modified_objects, nfo);
@@ -2077,7 +2066,7 @@ ecb_o365_get_changes_sync (ECalMetaBackend *meta_backend,
} else if (full_read) {
ECalMetaBackendInfo *nfo;
- nfo = ecb_o365_json_to_ical_nfo (cbo365, event, cancellable, NULL);
+ nfo = ecb_m365_json_to_ical_nfo (cbm365, event, cancellable, NULL);
if (nfo)
*out_created_objects = g_slist_prepend (*out_created_objects, nfo);
@@ -2088,12 +2077,12 @@ ecb_o365_get_changes_sync (ECalMetaBackend *meta_backend,
if (new_ids) {
new_ids = g_slist_reverse (new_ids);
- success = ecb_o365_download_event_changes_locked (cbo365, new_ids,
out_created_objects, cancellable, error);
+ success = ecb_m365_download_event_changes_locked (cbm365, new_ids,
out_created_objects, cancellable, error);
}
if (success && changed_ids) {
changed_ids = g_slist_reverse (changed_ids);
- success = ecb_o365_download_event_changes_locked (cbo365, changed_ids,
out_modified_objects, cancellable, error);
+ success = ecb_m365_download_event_changes_locked (cbm365, changed_ids,
out_modified_objects, cancellable, error);
}
g_slist_free (new_ids);
@@ -2102,10 +2091,10 @@ ecb_o365_get_changes_sync (ECalMetaBackend *meta_backend,
g_slist_free_full (events, (GDestroyNotify) json_object_unref);
- UNLOCK (cbo365);
+ UNLOCK (cbm365);
- ecb_o365_convert_error_to_client_error (error);
- ecb_o365_maybe_disconnect_sync (cbo365, error, cancellable);
+ ecb_m365_convert_error_to_client_error (error);
+ ecb_m365_maybe_disconnect_sync (cbm365, error, cancellable);
g_clear_object (&cal_cache);
@@ -2113,7 +2102,7 @@ ecb_o365_get_changes_sync (ECalMetaBackend *meta_backend,
}
static gboolean
-ecb_o365_load_component_sync (ECalMetaBackend *meta_backend,
+ecb_m365_load_component_sync (ECalMetaBackend *meta_backend,
const gchar *uid,
const gchar *extra,
ICalComponent **out_component,
@@ -2121,31 +2110,31 @@ ecb_o365_load_component_sync (ECalMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- ECalBackendO365 *cbo365;
- EO365Event *event = NULL;
+ ECalBackendM365 *cbm365;
+ EM365Event *event = NULL;
gboolean success;
- g_return_val_if_fail (E_IS_CAL_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_CAL_BACKEND_M365 (meta_backend), FALSE);
g_return_val_if_fail (uid != NULL, FALSE);
g_return_val_if_fail (out_component != NULL, FALSE);
g_return_val_if_fail (out_extra != NULL, FALSE);
- cbo365 = E_CAL_BACKEND_O365 (meta_backend);
+ cbm365 = E_CAL_BACKEND_M365 (meta_backend);
- LOCK (cbo365);
+ LOCK (cbm365);
- success = e_o365_connection_get_event_sync (cbo365->priv->cnc, NULL, cbo365->priv->group_id,
- cbo365->priv->calendar_id, uid, NULL, NULL, &event, cancellable, error);
+ success = e_m365_connection_get_event_sync (cbm365->priv->cnc, NULL, cbm365->priv->group_id,
+ cbm365->priv->calendar_id, uid, NULL, NULL, &event, cancellable, error);
if (success) {
- *out_component = ecb_o365_json_to_ical (cbo365, event, cancellable, error);
+ *out_component = ecb_m365_json_to_ical (cbm365, event, cancellable, error);
if (*out_component) {
gchar *ical_str;
ical_str = i_cal_component_as_ical_string (*out_component);
- *out_extra = ecb_o365_join_to_extra (e_o365_event_get_change_key (event), ical_str);
+ *out_extra = ecb_m365_join_to_extra (e_m365_event_get_change_key (event), ical_str);
g_free (ical_str);
} else {
@@ -2153,16 +2142,16 @@ ecb_o365_load_component_sync (ECalMetaBackend *meta_backend,
}
}
- UNLOCK (cbo365);
+ UNLOCK (cbm365);
- ecb_o365_convert_error_to_client_error (error);
- ecb_o365_maybe_disconnect_sync (cbo365, error, cancellable);
+ ecb_m365_convert_error_to_client_error (error);
+ ecb_m365_maybe_disconnect_sync (cbm365, error, cancellable);
return success;
}
static gboolean
-ecb_o365_save_component_sync (ECalMetaBackend *meta_backend,
+ecb_m365_save_component_sync (ECalMetaBackend *meta_backend,
gboolean overwrite_existing,
EConflictResolution conflict_resolution,
const GSList *instances,
@@ -2173,69 +2162,69 @@ ecb_o365_save_component_sync (ECalMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- ECalBackendO365 *cbo365;
+ ECalBackendM365 *cbm365;
ICalComponent *new_comp, *old_comp = NULL;
JsonBuilder *builder;
gboolean success = FALSE;
- g_return_val_if_fail (E_IS_CAL_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_CAL_BACKEND_M365 (meta_backend), FALSE);
- cbo365 = E_CAL_BACKEND_O365 (meta_backend);
+ cbm365 = E_CAL_BACKEND_M365 (meta_backend);
- LOCK (cbo365);
+ LOCK (cbm365);
new_comp = e_cal_meta_backend_merge_instances (meta_backend, instances, TRUE);
if (extra && *extra) {
const gchar *comp_str;
- comp_str = ecb_o365_get_component_from_extra (extra);
+ comp_str = ecb_m365_get_component_from_extra (extra);
if (comp_str)
old_comp = i_cal_component_new_from_string (comp_str);
}
- builder = ecb_o365_ical_to_json_locked (cbo365, new_comp, old_comp, cancellable, error);
+ builder = ecb_m365_ical_to_json_locked (cbm365, new_comp, old_comp, cancellable, error);
if (builder) {
if (overwrite_existing) {
const gchar *uid = i_cal_component_get_uid (new_comp);
- success = e_o365_connection_update_event_sync (cbo365->priv->cnc, NULL,
cbo365->priv->group_id,
- cbo365->priv->calendar_id, uid, builder, cancellable, error);
+ success = e_m365_connection_update_event_sync (cbm365->priv->cnc, NULL,
cbm365->priv->group_id,
+ cbm365->priv->calendar_id, uid, builder, cancellable, error);
if (success)
- success = ecb_o365_ical_to_json_2nd_go_locked (cbo365, new_comp, old_comp,
uid, cancellable, error);
+ success = ecb_m365_ical_to_json_2nd_go_locked (cbm365, new_comp, old_comp,
uid, cancellable, error);
if (success) {
/* To re-read it from the server */
*out_new_uid = g_strdup (uid);
}
} else {
- EO365Event *created_event = NULL;
+ EM365Event *created_event = NULL;
- success = e_o365_connection_create_event_sync (cbo365->priv->cnc, NULL,
cbo365->priv->group_id,
- cbo365->priv->calendar_id, builder, &created_event, cancellable, error);
+ success = e_m365_connection_create_event_sync (cbm365->priv->cnc, NULL,
cbm365->priv->group_id,
+ cbm365->priv->calendar_id, builder, &created_event, cancellable, error);
if (success && created_event) {
- const gchar *o365_id = e_o365_event_get_id (created_event);
+ const gchar *m365_id = e_m365_event_get_id (created_event);
- success = ecb_o365_ical_to_json_2nd_go_locked (cbo365, new_comp, old_comp,
o365_id, cancellable, error);
+ success = ecb_m365_ical_to_json_2nd_go_locked (cbm365, new_comp, old_comp,
m365_id, cancellable, error);
}
if (success && created_event) {
ICalComponent *icomp;
- *out_new_uid = g_strdup (e_o365_event_get_id (created_event));
+ *out_new_uid = g_strdup (e_m365_event_get_id (created_event));
- icomp = ecb_o365_json_to_ical (cbo365, created_event, cancellable, error);
+ icomp = ecb_m365_json_to_ical (cbm365, created_event, cancellable, error);
if (icomp) {
gchar *ical_str;
ical_str = i_cal_component_as_ical_string (icomp);
- *out_new_extra = ecb_o365_join_to_extra (e_o365_event_get_change_key
(created_event), ical_str);
+ *out_new_extra = ecb_m365_join_to_extra (e_m365_event_get_change_key
(created_event), ical_str);
g_clear_object (&icomp);
g_free (ical_str);
@@ -2251,10 +2240,10 @@ ecb_o365_save_component_sync (ECalMetaBackend *meta_backend,
g_clear_object (&builder);
}
- UNLOCK (cbo365);
+ UNLOCK (cbm365);
- ecb_o365_convert_error_to_client_error (error);
- ecb_o365_maybe_disconnect_sync (cbo365, error, cancellable);
+ ecb_m365_convert_error_to_client_error (error);
+ ecb_m365_maybe_disconnect_sync (cbm365, error, cancellable);
g_clear_object (&new_comp);
g_clear_object (&old_comp);
@@ -2263,7 +2252,7 @@ ecb_o365_save_component_sync (ECalMetaBackend *meta_backend,
}
static gboolean
-ecb_o365_remove_component_sync (ECalMetaBackend *meta_backend,
+ecb_m365_remove_component_sync (ECalMetaBackend *meta_backend,
EConflictResolution conflict_resolution,
const gchar *uid,
const gchar *extra,
@@ -2272,37 +2261,37 @@ ecb_o365_remove_component_sync (ECalMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- ECalBackendO365 *cbo365;
+ ECalBackendM365 *cbm365;
gboolean success = FALSE;
- g_return_val_if_fail (E_IS_CAL_BACKEND_O365 (meta_backend), FALSE);
+ g_return_val_if_fail (E_IS_CAL_BACKEND_M365 (meta_backend), FALSE);
g_return_val_if_fail (object != NULL, FALSE);
- cbo365 = E_CAL_BACKEND_O365 (meta_backend);
+ cbm365 = E_CAL_BACKEND_M365 (meta_backend);
- LOCK (cbo365);
+ LOCK (cbm365);
- success = e_o365_connection_delete_event_sync (cbo365->priv->cnc, NULL, cbo365->priv->group_id,
- cbo365->priv->calendar_id, uid, cancellable, error);
+ success = e_m365_connection_delete_event_sync (cbm365->priv->cnc, NULL, cbm365->priv->group_id,
+ cbm365->priv->calendar_id, uid, cancellable, error);
- UNLOCK (cbo365);
+ UNLOCK (cbm365);
- ecb_o365_convert_error_to_client_error (error);
- ecb_o365_maybe_disconnect_sync (cbo365, error, cancellable);
+ ecb_m365_convert_error_to_client_error (error);
+ ecb_m365_maybe_disconnect_sync (cbm365, error, cancellable);
return success;
}
static gchar *
-ecb_o365_get_backend_property (ECalBackend *cal_backend,
+ecb_m365_get_backend_property (ECalBackend *cal_backend,
const gchar *prop_name)
{
- ECalBackendO365 *cbo365;
+ ECalBackendM365 *cbm365;
- g_return_val_if_fail (E_IS_CAL_BACKEND_O365 (cal_backend), NULL);
+ g_return_val_if_fail (E_IS_CAL_BACKEND_M365 (cal_backend), NULL);
g_return_val_if_fail (prop_name != NULL, NULL);
- cbo365 = E_CAL_BACKEND_O365 (cal_backend);
+ cbm365 = E_CAL_BACKEND_M365 (cal_backend);
if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
return g_strjoin (
@@ -2324,26 +2313,26 @@ ecb_o365_get_backend_property (ECalBackend *cal_backend,
E_CAL_STATIC_CAPABILITY_TASK_NO_ALARM,
E_CAL_STATIC_CAPABILITY_TASK_CAN_RECUR,
E_CAL_STATIC_CAPABILITY_TASK_HANDLE_RECUR,
- e_cal_meta_backend_get_capabilities (E_CAL_META_BACKEND (cbo365)),
+ e_cal_meta_backend_get_capabilities (E_CAL_META_BACKEND (cbm365)),
NULL);
} else if (g_str_equal (prop_name, E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS)) {
/* return email address of the person who opened the calendar */
- CamelO365Settings *o365_settings;
+ CamelM365Settings *m365_settings;
- o365_settings = camel_o365_settings_get_from_backend (E_BACKEND (cal_backend),
e_cal_backend_get_registry (cal_backend));
+ m365_settings = camel_m365_settings_get_from_backend (E_BACKEND (cal_backend),
e_cal_backend_get_registry (cal_backend));
- return camel_o365_settings_dup_email (o365_settings);
+ return camel_m365_settings_dup_email (m365_settings);
} else if (g_str_equal (prop_name, E_CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS)) {
/* Microsoft 365 does not support email based alarms */
return NULL;
}
/* Chain up to parent's method. */
- return E_CAL_BACKEND_CLASS (e_cal_backend_o365_parent_class)->impl_get_backend_property (cal_backend,
prop_name);
+ return E_CAL_BACKEND_CLASS (e_cal_backend_m365_parent_class)->impl_get_backend_property (cal_backend,
prop_name);
}
static gboolean
-ecb_o365_get_destination_address (EBackend *backend,
+ecb_m365_get_destination_address (EBackend *backend,
gchar **host,
guint16 *port)
{
@@ -2362,7 +2351,7 @@ ecb_o365_get_destination_address (EBackend *backend,
}
static gchar *
-ecb_o365_dup_component_revision (ECalCache *cal_cache,
+ecb_m365_dup_component_revision (ECalCache *cal_cache,
ICalComponent *icomp,
gpointer user_data)
{
@@ -2372,67 +2361,67 @@ ecb_o365_dup_component_revision (ECalCache *cal_cache,
}
static void
-ecb_o365_constructed (GObject *object)
+ecb_m365_constructed (GObject *object)
{
- ECalBackendO365 *cbo365 = E_CAL_BACKEND_O365 (object);
+ ECalBackendM365 *cbm365 = E_CAL_BACKEND_M365 (object);
ECalCache *cal_cache;
gchar *cache_dirname;
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_cal_backend_o365_parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_cal_backend_m365_parent_class)->constructed (object);
/* Reset the connectable, it steals data from Authentication extension,
where is written incorrect address */
e_backend_set_connectable (E_BACKEND (object), NULL);
- cal_cache = e_cal_meta_backend_ref_cache (E_CAL_META_BACKEND (cbo365));
+ cal_cache = e_cal_meta_backend_ref_cache (E_CAL_META_BACKEND (cbm365));
g_return_if_fail (cal_cache != NULL);
cache_dirname = g_path_get_dirname (e_cache_get_filename (E_CACHE (cal_cache)));
- g_signal_connect (cal_cache, "dup-component-revision", G_CALLBACK (ecb_o365_dup_component_revision),
NULL);
+ g_signal_connect (cal_cache, "dup-component-revision", G_CALLBACK (ecb_m365_dup_component_revision),
NULL);
g_clear_object (&cal_cache);
- cbo365->priv->attachments_dir = g_build_filename (cache_dirname, "attachments", NULL);
- g_mkdir_with_parents (cbo365->priv->attachments_dir, 0777);
+ cbm365->priv->attachments_dir = g_build_filename (cache_dirname, "attachments", NULL);
+ g_mkdir_with_parents (cbm365->priv->attachments_dir, 0777);
g_free (cache_dirname);
}
static void
-ecb_o365_dispose (GObject *object)
+ecb_m365_dispose (GObject *object)
{
- ECalBackendO365 *cbo365 = E_CAL_BACKEND_O365 (object);
+ ECalBackendM365 *cbm365 = E_CAL_BACKEND_M365 (object);
- ecb_o365_unset_connection_sync (cbo365, FALSE, NULL, NULL);
+ ecb_m365_unset_connection_sync (cbm365, FALSE, NULL, NULL);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_cal_backend_o365_parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_cal_backend_m365_parent_class)->dispose (object);
}
static void
-ecb_o365_finalize (GObject *object)
+ecb_m365_finalize (GObject *object)
{
- ECalBackendO365 *cbo365 = E_CAL_BACKEND_O365 (object);
+ ECalBackendM365 *cbm365 = E_CAL_BACKEND_M365 (object);
- g_free (cbo365->priv->attachments_dir);
+ g_free (cbm365->priv->attachments_dir);
- g_rec_mutex_clear (&cbo365->priv->property_lock);
+ g_rec_mutex_clear (&cbm365->priv->property_lock);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_cal_backend_o365_parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_cal_backend_m365_parent_class)->finalize (object);
}
static void
-e_cal_backend_o365_init (ECalBackendO365 *cbo365)
+e_cal_backend_m365_init (ECalBackendM365 *cbm365)
{
- cbo365->priv = e_cal_backend_o365_get_instance_private (cbo365);
+ cbm365->priv = e_cal_backend_m365_get_instance_private (cbm365);
- g_rec_mutex_init (&cbo365->priv->property_lock);
+ g_rec_mutex_init (&cbm365->priv->property_lock);
}
static void
-e_cal_backend_o365_class_init (ECalBackendO365Class *klass)
+e_cal_backend_m365_class_init (ECalBackendM365Class *klass)
{
GObjectClass *object_class;
EBackendClass *backend_class;
@@ -2440,21 +2429,21 @@ e_cal_backend_o365_class_init (ECalBackendO365Class *klass)
ECalMetaBackendClass *cal_meta_backend_class;
cal_meta_backend_class = E_CAL_META_BACKEND_CLASS (klass);
- cal_meta_backend_class->connect_sync = ecb_o365_connect_sync;
- cal_meta_backend_class->disconnect_sync = ecb_o365_disconnect_sync;
- cal_meta_backend_class->get_changes_sync = ecb_o365_get_changes_sync;
- cal_meta_backend_class->load_component_sync = ecb_o365_load_component_sync;
- cal_meta_backend_class->save_component_sync = ecb_o365_save_component_sync;
- cal_meta_backend_class->remove_component_sync = ecb_o365_remove_component_sync;
+ cal_meta_backend_class->connect_sync = ecb_m365_connect_sync;
+ cal_meta_backend_class->disconnect_sync = ecb_m365_disconnect_sync;
+ cal_meta_backend_class->get_changes_sync = ecb_m365_get_changes_sync;
+ cal_meta_backend_class->load_component_sync = ecb_m365_load_component_sync;
+ cal_meta_backend_class->save_component_sync = ecb_m365_save_component_sync;
+ cal_meta_backend_class->remove_component_sync = ecb_m365_remove_component_sync;
cal_backend_class = E_CAL_BACKEND_CLASS (klass);
- cal_backend_class->impl_get_backend_property = ecb_o365_get_backend_property;
+ cal_backend_class->impl_get_backend_property = ecb_m365_get_backend_property;
backend_class = E_BACKEND_CLASS (klass);
- backend_class->get_destination_address = ecb_o365_get_destination_address;
+ backend_class->get_destination_address = ecb_m365_get_destination_address;
object_class = G_OBJECT_CLASS (klass);
- object_class->constructed = ecb_o365_constructed;
- object_class->dispose = ecb_o365_dispose;
- object_class->finalize = ecb_o365_finalize;
+ object_class->constructed = ecb_m365_constructed;
+ object_class->dispose = ecb_m365_dispose;
+ object_class->finalize = ecb_m365_finalize;
}
diff --git a/src/Microsoft365/calendar/e-cal-backend-m365.h b/src/Microsoft365/calendar/e-cal-backend-m365.h
new file mode 100644
index 00000000..7963dcae
--- /dev/null
+++ b/src/Microsoft365/calendar/e-cal-backend-m365.h
@@ -0,0 +1,37 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_CAL_BACKEND_M365_H
+#define E_CAL_BACKEND_M365_H
+
+#include <libedata-cal/libedata-cal.h>
+
+G_BEGIN_DECLS
+
+#define E_TYPE_CAL_BACKEND_M365 (e_cal_backend_m365_get_type ())
+#define E_CAL_BACKEND_M365(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_BACKEND_M365,
ECalBackendM365))
+#define E_CAL_BACKEND_M365_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_BACKEND_M365,
ECalBackendM365Class))
+#define E_IS_CAL_BACKEND_M365(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_BACKEND_M365))
+#define E_IS_CAL_BACKEND_M365_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_BACKEND_M365))
+
+typedef struct _ECalBackendM365 ECalBackendM365;
+typedef struct _ECalBackendM365Class ECalBackendM365Class;
+typedef struct _ECalBackendM365Private ECalBackendM365Private;
+
+struct _ECalBackendM365 {
+ ECalMetaBackend parent_object;
+ ECalBackendM365Private *priv;
+};
+
+struct _ECalBackendM365Class {
+ ECalMetaBackendClass parent_class;
+};
+
+GType e_cal_backend_m365_get_type (void);
+
+G_END_DECLS
+
+#endif /* E_CAL_BACKEND_M365_H */
diff --git a/src/Microsoft365/camel/CMakeLists.txt b/src/Microsoft365/camel/CMakeLists.txt
new file mode 100644
index 00000000..928b837a
--- /dev/null
+++ b/src/Microsoft365/camel/CMakeLists.txt
@@ -0,0 +1,75 @@
+install(FILES libcamelmicrosoft365.urls
+ DESTINATION ${camel_providerdir}
+)
+
+set(DEPENDENCIES
+ evolution-microsoft365
+)
+
+set(SOURCES
+ camel-m365-folder.c
+ camel-m365-folder.h
+ camel-m365-folder-summary.c
+ camel-m365-folder-summary.h
+ camel-m365-message-info.c
+ camel-m365-message-info.h
+ camel-m365-provider.c
+ camel-m365-store.c
+ camel-m365-store.h
+ camel-m365-store-summary.c
+ camel-m365-store-summary.h
+ camel-m365-transport.c
+ camel-m365-transport.h
+ camel-m365-utils.c
+ camel-m365-utils.h
+)
+
+add_library(camelmicrosoft365 MODULE
+ ${SOURCES}
+)
+
+add_dependencies(camelmicrosoft365
+ ${DEPENDENCIES}
+)
+
+target_compile_definitions(camelmicrosoft365 PRIVATE
+ -DG_LOG_DOMAIN=\"camel-microsoft365-provider\"
+ -DM365_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
+)
+
+target_compile_options(camelmicrosoft365 PUBLIC
+ ${CAMEL_CFLAGS}
+ ${EVOLUTION_SHELL_CFLAGS}
+ ${EVOLUTION_MAIL_CFLAGS}
+ ${LIBEDATASERVER_CFLAGS}
+ ${LIBECAL_CFLAGS}
+ ${SOUP_CFLAGS}
+)
+
+target_include_directories(camelmicrosoft365 PUBLIC
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_BINARY_DIR}/src/Microsoft365
+ ${CMAKE_SOURCE_DIR}/src/Microsoft365
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CAMEL_INCLUDE_DIRS}
+ ${EVOLUTION_SHELL_INCLUDE_DIRS}
+ ${EVOLUTION_MAIL_INCLUDE_DIRS}
+ ${LIBEDATASERVER_INCLUDE_DIRS}
+ ${LIBECAL_INCLUDE_DIRS}
+ ${SOUP_INCLUDE_DIRS}
+)
+
+target_link_libraries(camelmicrosoft365
+ ${DEPENDENCIES}
+ ${CAMEL_LDFLAGS}
+ ${EVOLUTION_SHELL_LDFLAGS}
+ ${EVOLUTION_MAIL_LDFLAGS}
+ ${LIBEDATASERVER_LDFLAGS}
+ ${LIBECAL_LDFLAGS}
+ ${SOUP_LDFLAGS}
+)
+
+install(TARGETS camelmicrosoft365
+ DESTINATION ${camel_providerdir}
+)
diff --git a/src/Office365/camel/camel-o365-folder-summary.c
b/src/Microsoft365/camel/camel-m365-folder-summary.c
similarity index 50%
rename from src/Office365/camel/camel-o365-folder-summary.c
rename to src/Microsoft365/camel/camel-m365-folder-summary.c
index fe5f5fc3..1d46f026 100644
--- a/src/Office365/camel/camel-o365-folder-summary.c
+++ b/src/Microsoft365/camel/camel-m365-folder-summary.c
@@ -1,143 +1,132 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
#include <glib.h>
-#include "camel-o365-folder.h"
+#include "camel-m365-folder.h"
-#include "camel-o365-folder-summary.h"
+#include "camel-m365-folder-summary.h"
#define LOCK(_summary) g_mutex_lock (&_summary->priv->property_lock)
#define UNLOCK(_summary) g_mutex_unlock (&_summary->priv->property_lock)
-struct _CamelO365FolderSummaryPrivate {
+struct _CamelM365FolderSummaryPrivate {
GMutex property_lock;
gchar *delta_link;
gint32 version;
};
-G_DEFINE_TYPE_WITH_PRIVATE (CamelO365FolderSummary, camel_o365_folder_summary, CAMEL_TYPE_FOLDER_SUMMARY)
+G_DEFINE_TYPE_WITH_PRIVATE (CamelM365FolderSummary, camel_m365_folder_summary, CAMEL_TYPE_FOLDER_SUMMARY)
static gboolean
-o365_folder_summary_header_load (CamelFolderSummary *summary,
+m365_folder_summary_header_load (CamelFolderSummary *summary,
CamelFIRecord *mir)
{
- CamelO365FolderSummary *o365_summary = CAMEL_O365_FOLDER_SUMMARY (summary);
+ CamelM365FolderSummary *m365_summary = CAMEL_M365_FOLDER_SUMMARY (summary);
const gchar *delta_link = NULL;
gchar *part;
- if (!CAMEL_FOLDER_SUMMARY_CLASS (camel_o365_folder_summary_parent_class)->summary_header_load
(summary, mir))
+ if (!CAMEL_FOLDER_SUMMARY_CLASS (camel_m365_folder_summary_parent_class)->summary_header_load
(summary, mir))
return FALSE;
- o365_summary->priv->version = 0;
+ m365_summary->priv->version = 0;
part = mir->bdata;
if (part)
- o365_summary->priv->version = camel_util_bdata_get_number (&part, 0);
+ m365_summary->priv->version = camel_util_bdata_get_number (&part, 0);
if (part && *part && part[1])
delta_link = part + 1;
- /* Do not call camel_o365_folder_summary_set_sync_state() here,
+ /* Do not call camel_m365_folder_summary_set_sync_state() here,
to not mark the summary dirty after load. */
- LOCK (o365_summary);
+ LOCK (m365_summary);
- if (g_strcmp0 (o365_summary->priv->delta_link, delta_link) != 0) {
- g_free (o365_summary->priv->delta_link);
- o365_summary->priv->delta_link = g_strdup (delta_link);
+ if (g_strcmp0 (m365_summary->priv->delta_link, delta_link) != 0) {
+ g_free (m365_summary->priv->delta_link);
+ m365_summary->priv->delta_link = g_strdup (delta_link);
}
- UNLOCK (o365_summary);
+ UNLOCK (m365_summary);
return TRUE;
}
static CamelFIRecord *
-o365_folder_summary_header_save (CamelFolderSummary *summary,
+m365_folder_summary_header_save (CamelFolderSummary *summary,
GError **error)
{
- CamelO365FolderSummary *o365_summary = CAMEL_O365_FOLDER_SUMMARY (summary);
+ CamelM365FolderSummary *m365_summary = CAMEL_M365_FOLDER_SUMMARY (summary);
CamelFIRecord *fir;
gchar *delta_link;
- fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_o365_folder_summary_parent_class)->summary_header_save
(summary, error);
+ fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_m365_folder_summary_parent_class)->summary_header_save
(summary, error);
if (!fir)
return NULL;
- delta_link = camel_o365_folder_summary_dup_delta_link (o365_summary);
+ delta_link = camel_m365_folder_summary_dup_delta_link (m365_summary);
- fir->bdata = g_strdup_printf ("%d %s", CAMEL_O365_FOLDER_SUMMARY_VERSION, delta_link ? delta_link :
"");
+ fir->bdata = g_strdup_printf ("%d %s", CAMEL_M365_FOLDER_SUMMARY_VERSION, delta_link ? delta_link :
"");
g_free (delta_link);
- LOCK (o365_summary);
+ LOCK (m365_summary);
- o365_summary->priv->version = CAMEL_O365_FOLDER_SUMMARY_VERSION;
+ m365_summary->priv->version = CAMEL_M365_FOLDER_SUMMARY_VERSION;
- UNLOCK (o365_summary);
+ UNLOCK (m365_summary);
return fir;
}
static void
-o365_folder_summary_finalize (GObject *object)
+m365_folder_summary_finalize (GObject *object)
{
- CamelO365FolderSummary *o365_summary = CAMEL_O365_FOLDER_SUMMARY (object);
+ CamelM365FolderSummary *m365_summary = CAMEL_M365_FOLDER_SUMMARY (object);
- g_free (o365_summary->priv->delta_link);
- g_mutex_clear (&o365_summary->priv->property_lock);
+ g_free (m365_summary->priv->delta_link);
+ g_mutex_clear (&m365_summary->priv->property_lock);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_folder_summary_parent_class)->finalize (object);
+ G_OBJECT_CLASS (camel_m365_folder_summary_parent_class)->finalize (object);
}
static void
-camel_o365_folder_summary_class_init (CamelO365FolderSummaryClass *class)
+camel_m365_folder_summary_class_init (CamelM365FolderSummaryClass *class)
{
CamelFolderSummaryClass *folder_summary_class;
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (class);
- object_class->finalize = o365_folder_summary_finalize;
+ object_class->finalize = m365_folder_summary_finalize;
folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
- folder_summary_class->message_info_type = CAMEL_TYPE_O365_MESSAGE_INFO;
- folder_summary_class->summary_header_save = o365_folder_summary_header_save;
- folder_summary_class->summary_header_load = o365_folder_summary_header_load;
+ folder_summary_class->message_info_type = CAMEL_TYPE_M365_MESSAGE_INFO;
+ folder_summary_class->summary_header_save = m365_folder_summary_header_save;
+ folder_summary_class->summary_header_load = m365_folder_summary_header_load;
}
static void
-camel_o365_folder_summary_init (CamelO365FolderSummary *o365_summary)
+camel_m365_folder_summary_init (CamelM365FolderSummary *m365_summary)
{
- o365_summary->priv = camel_o365_folder_summary_get_instance_private (o365_summary);
+ m365_summary->priv = camel_m365_folder_summary_get_instance_private (m365_summary);
- g_mutex_init (&o365_summary->priv->property_lock);
+ g_mutex_init (&m365_summary->priv->property_lock);
}
CamelFolderSummary *
-camel_o365_folder_summary_new (struct _CamelFolder *folder)
+camel_m365_folder_summary_new (struct _CamelFolder *folder)
{
CamelFolderSummary *summary;
- summary = g_object_new (CAMEL_TYPE_O365_FOLDER_SUMMARY, "folder", folder, NULL);
+ summary = g_object_new (CAMEL_TYPE_M365_FOLDER_SUMMARY, "folder", folder, NULL);
camel_folder_summary_load (summary, NULL);
@@ -145,64 +134,64 @@ camel_o365_folder_summary_new (struct _CamelFolder *folder)
}
gint
-camel_o365_folder_summary_get_version (CamelO365FolderSummary *o365_summary)
+camel_m365_folder_summary_get_version (CamelM365FolderSummary *m365_summary)
{
gint version;
- g_return_val_if_fail (CAMEL_IS_O365_FOLDER_SUMMARY (o365_summary), -1);
+ g_return_val_if_fail (CAMEL_IS_M365_FOLDER_SUMMARY (m365_summary), -1);
- LOCK (o365_summary);
+ LOCK (m365_summary);
- version = o365_summary->priv->version;
+ version = m365_summary->priv->version;
- UNLOCK (o365_summary);
+ UNLOCK (m365_summary);
return version;
}
void
-camel_o365_folder_summary_set_delta_link (CamelO365FolderSummary *o365_summary,
+camel_m365_folder_summary_set_delta_link (CamelM365FolderSummary *m365_summary,
const gchar *delta_link)
{
gboolean changed = FALSE;
- g_return_if_fail (CAMEL_IS_O365_FOLDER_SUMMARY (o365_summary));
+ g_return_if_fail (CAMEL_IS_M365_FOLDER_SUMMARY (m365_summary));
- LOCK (o365_summary);
+ LOCK (m365_summary);
- if (g_strcmp0 (o365_summary->priv->delta_link, delta_link) != 0) {
+ if (g_strcmp0 (m365_summary->priv->delta_link, delta_link) != 0) {
gchar *dup = g_strdup (delta_link);
- g_free (o365_summary->priv->delta_link);
- o365_summary->priv->delta_link = dup;
+ g_free (m365_summary->priv->delta_link);
+ m365_summary->priv->delta_link = dup;
changed = TRUE;
}
- UNLOCK (o365_summary);
+ UNLOCK (m365_summary);
if (changed)
- camel_folder_summary_touch (CAMEL_FOLDER_SUMMARY (o365_summary));
+ camel_folder_summary_touch (CAMEL_FOLDER_SUMMARY (m365_summary));
}
gchar *
-camel_o365_folder_summary_dup_delta_link (CamelO365FolderSummary *o365_summary)
+camel_m365_folder_summary_dup_delta_link (CamelM365FolderSummary *m365_summary)
{
gchar *delta_link;
- g_return_val_if_fail (CAMEL_IS_O365_FOLDER_SUMMARY (o365_summary), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_FOLDER_SUMMARY (m365_summary), NULL);
- LOCK (o365_summary);
+ LOCK (m365_summary);
- delta_link = g_strdup (o365_summary->priv->delta_link);
+ delta_link = g_strdup (m365_summary->priv->delta_link);
- UNLOCK (o365_summary);
+ UNLOCK (m365_summary);
return delta_link;
}
void
-camel_o365_folder_summary_clear (CamelFolderSummary *summary)
+camel_m365_folder_summary_clear (CamelFolderSummary *summary)
{
CamelFolderChangeInfo *changes;
GPtrArray *known_uids;
@@ -229,7 +218,7 @@ camel_o365_folder_summary_clear (CamelFolderSummary *summary)
}
static gboolean
-o365_folder_summary_update_user_flags (CamelMessageInfo *info,
+m365_folder_summary_update_user_flags (CamelMessageInfo *info,
const CamelNamedFlags *server_user_flags)
{
gboolean changed = FALSE;
@@ -252,38 +241,38 @@ o365_folder_summary_update_user_flags (CamelMessageInfo *info,
}
gboolean
-camel_o365_folder_summary_update_message_info_flags (CamelFolderSummary *summary,
+camel_m365_folder_summary_update_message_info_flags (CamelFolderSummary *summary,
CamelMessageInfo *info,
guint32 server_flags,
const CamelNamedFlags *server_user_flags)
{
- CamelO365MessageInfo *omi;
+ CamelM365MessageInfo *omi;
gboolean changed = FALSE;
- g_return_val_if_fail (CAMEL_IS_O365_FOLDER_SUMMARY (summary), FALSE);
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (info), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_FOLDER_SUMMARY (summary), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (info), FALSE);
- omi = CAMEL_O365_MESSAGE_INFO (info);
+ omi = CAMEL_M365_MESSAGE_INFO (info);
- if (server_flags != camel_o365_message_info_get_server_flags (omi)) {
+ if (server_flags != camel_m365_message_info_get_server_flags (omi)) {
guint32 server_set, server_cleared;
- server_set = server_flags & ~camel_o365_message_info_get_server_flags (omi);
- server_cleared = camel_o365_message_info_get_server_flags (omi) & ~server_flags;
+ server_set = server_flags & ~camel_m365_message_info_get_server_flags (omi);
+ server_cleared = camel_m365_message_info_get_server_flags (omi) & ~server_flags;
camel_message_info_set_flags (info, server_set | server_cleared,
(camel_message_info_get_flags (info) | server_set) & ~server_cleared);
- camel_o365_message_info_set_server_flags (omi, server_flags);
+ camel_m365_message_info_set_server_flags (omi, server_flags);
changed = TRUE;
}
- if (server_user_flags && o365_folder_summary_update_user_flags (info, server_user_flags))
+ if (server_user_flags && m365_folder_summary_update_user_flags (info, server_user_flags))
changed = TRUE;
return changed;
}
gboolean
-camel_o365_folder_summary_add_message (CamelFolderSummary *summary,
+camel_m365_folder_summary_add_message (CamelFolderSummary *summary,
const gchar *uid,
const gchar *change_key,
CamelMessageInfo *info,
@@ -300,7 +289,7 @@ camel_o365_folder_summary_add_message (CamelFolderSummary *summary,
camel_message_info_set_abort_notifications (mi, TRUE);
- camel_o365_message_info_set_change_key (CAMEL_O365_MESSAGE_INFO (mi), change_key);
+ camel_m365_message_info_set_change_key (CAMEL_M365_MESSAGE_INFO (mi), change_key);
camel_message_info_set_flags (mi, ~0, camel_message_info_get_flags (info));
camel_message_info_take_user_flags (mi, camel_message_info_dup_user_flags (info));
camel_message_info_take_user_tags (mi, camel_message_info_dup_user_tags (info));
diff --git a/src/Microsoft365/camel/camel-m365-folder-summary.h
b/src/Microsoft365/camel/camel-m365-folder-summary.h
new file mode 100644
index 00000000..086a20ab
--- /dev/null
+++ b/src/Microsoft365/camel/camel-m365-folder-summary.h
@@ -0,0 +1,72 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef CAMEL_M365_FOLDER_SUMMARY_H
+#define CAMEL_M365_FOLDER_SUMMARY_H
+
+#include <camel/camel.h>
+
+#include "camel-m365-message-info.h"
+
+#define CAMEL_M365_FOLDER_SUMMARY_VERSION (1)
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_M365_FOLDER_SUMMARY \
+ (camel_m365_folder_summary_get_type ())
+#define CAMEL_M365_FOLDER_SUMMARY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_M365_FOLDER_SUMMARY, CamelM365FolderSummary))
+#define CAMEL_M365_FOLDER_SUMMARY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_M365_FOLDER_SUMMARY, CamelM365FolderSummaryClass))
+#define CAMEL_IS_M365_FOLDER_SUMMARY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_M365_FOLDER_SUMMARY))
+#define CAMEL_IS_M365_FOLDER_SUMMARY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_M365_FOLDER_SUMMARY))
+#define CAMEL_M365_FOLDER_SUMMARY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_M365_FOLDER_SUMMARY, CamelM365FolderSummaryClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelM365FolderSummary CamelM365FolderSummary;
+typedef struct _CamelM365FolderSummaryClass CamelM365FolderSummaryClass;
+typedef struct _CamelM365FolderSummaryPrivate CamelM365FolderSummaryPrivate;
+
+struct _CamelM365FolderSummary {
+ CamelFolderSummary parent;
+ CamelM365FolderSummaryPrivate *priv;
+};
+
+struct _CamelM365FolderSummaryClass {
+ CamelFolderSummaryClass parent_class;
+};
+
+GType camel_m365_folder_summary_get_type (void);
+
+CamelFolderSummary *
+ camel_m365_folder_summary_new (CamelFolder *folder);
+gint camel_m365_folder_summary_get_version (CamelM365FolderSummary *m365_summary);
+void camel_m365_folder_summary_set_delta_link(CamelM365FolderSummary *m365_summary,
+ const gchar *delta_link);
+gchar * camel_m365_folder_summary_dup_delta_link(CamelM365FolderSummary *m365_summary);
+void camel_m365_folder_summary_clear (CamelFolderSummary *summary);
+gboolean camel_m365_folder_summary_update_message_info_flags
+ (CamelFolderSummary *summary,
+ CamelMessageInfo *info,
+ guint32 server_flags,
+ const CamelNamedFlags *server_user_flags);
+gboolean camel_m365_folder_summary_add_message (CamelFolderSummary *summary,
+ const gchar *uid,
+ const gchar *change_key,
+ CamelMessageInfo *info,
+ CamelMimeMessage *message);
+
+G_END_DECLS
+
+#endif /* CAMEL_M365_FOLDER_SUMMARY_H */
diff --git a/src/Office365/camel/camel-o365-folder.c b/src/Microsoft365/camel/camel-m365-folder.c
similarity index 64%
rename from src/Office365/camel/camel-o365-folder.c
rename to src/Microsoft365/camel/camel-m365-folder.c
index be7ed661..8cb54599 100644
--- a/src/Office365/camel/camel-o365-folder.c
+++ b/src/Microsoft365/camel/camel-m365-folder.c
@@ -1,18 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
@@ -21,20 +10,20 @@
#include <glib/gi18n-lib.h>
-#include "common/camel-o365-settings.h"
-#include "common/e-o365-connection.h"
+#include "common/camel-m365-settings.h"
+#include "common/e-m365-connection.h"
-#include "camel-o365-folder-summary.h"
-#include "camel-o365-store.h"
-#include "camel-o365-store-summary.h"
-#include "camel-o365-utils.h"
+#include "camel-m365-folder-summary.h"
+#include "camel-m365-store.h"
+#include "camel-m365-store-summary.h"
+#include "camel-m365-utils.h"
-#include "camel-o365-folder.h"
+#include "camel-m365-folder.h"
-#define O365_LOCAL_CACHE_PATH "cur"
+#define M365_LOCAL_CACHE_PATH "cur"
/* https://docs.microsoft.com/en-us/graph/api/resources/message?view=graph-rest-1.0 */
-#define O365_FETCH_SUMMARY_PROPERTIES "categories," \
+#define M365_FETCH_SUMMARY_PROPERTIES "categories," \
"ccRecipients," \
"changeKey," \
"flag," \
@@ -57,7 +46,7 @@
#define LOCK_SEARCH(_folder) g_mutex_lock (&_folder->priv->search_lock)
#define UNLOCK_SEARCH(_folder) g_mutex_unlock (&_folder->priv->search_lock)
-struct _CamelO365FolderPrivate {
+struct _CamelM365FolderPrivate {
gchar *id; /* folder ID; stays the same for the full life of the folder */
GRecMutex cache_lock;
@@ -72,10 +61,10 @@ struct _CamelO365FolderPrivate {
GHashTable *get_message_hash; /* borrowed gchar *uid ~> NULL */
};
-G_DEFINE_TYPE_WITH_PRIVATE (CamelO365Folder, camel_o365_folder, CAMEL_TYPE_OFFLINE_FOLDER)
+G_DEFINE_TYPE_WITH_PRIVATE (CamelM365Folder, camel_m365_folder, CAMEL_TYPE_OFFLINE_FOLDER)
static GChecksum *
-o365_folder_cache_new_checksum (const gchar *id)
+m365_folder_cache_new_checksum (const gchar *id)
{
GChecksum *checksum;
@@ -90,7 +79,7 @@ o365_folder_cache_new_checksum (const gchar *id)
}
static CamelStream *
-o365_folder_cache_add (CamelO365Folder *o365_folder,
+m365_folder_cache_add (CamelM365Folder *m365_folder,
const gchar *id,
GError **error)
{
@@ -98,11 +87,11 @@ o365_folder_cache_add (CamelO365Folder *o365_folder,
CamelStream *stream = NULL;
GChecksum *checksum;
- checksum = o365_folder_cache_new_checksum (id);
+ checksum = m365_folder_cache_new_checksum (id);
- LOCK_CACHE (o365_folder);
- base_stream = camel_data_cache_add (o365_folder->priv->cache, O365_LOCAL_CACHE_PATH,
g_checksum_get_string (checksum), error);
- UNLOCK_CACHE (o365_folder);
+ LOCK_CACHE (m365_folder);
+ base_stream = camel_data_cache_add (m365_folder->priv->cache, M365_LOCAL_CACHE_PATH,
g_checksum_get_string (checksum), error);
+ UNLOCK_CACHE (m365_folder);
g_checksum_free (checksum);
@@ -115,18 +104,18 @@ o365_folder_cache_add (CamelO365Folder *o365_folder,
}
static gint
-o365_folder_cache_remove (CamelO365Folder *o365_folder,
+m365_folder_cache_remove (CamelM365Folder *m365_folder,
const gchar *id,
GError **error)
{
GChecksum *checksum;
gint ret;
- checksum = o365_folder_cache_new_checksum (id);
+ checksum = m365_folder_cache_new_checksum (id);
- LOCK_CACHE (o365_folder);
- ret = camel_data_cache_remove (o365_folder->priv->cache, O365_LOCAL_CACHE_PATH, g_checksum_get_string
(checksum), error);
- UNLOCK_CACHE (o365_folder);
+ LOCK_CACHE (m365_folder);
+ ret = camel_data_cache_remove (m365_folder->priv->cache, M365_LOCAL_CACHE_PATH, g_checksum_get_string
(checksum), error);
+ UNLOCK_CACHE (m365_folder);
g_checksum_free (checksum);
@@ -134,7 +123,7 @@ o365_folder_cache_remove (CamelO365Folder *o365_folder,
}
static CamelStream *
-o365_folder_cache_get (CamelO365Folder *o365_folder,
+m365_folder_cache_get (CamelM365Folder *m365_folder,
const gchar *id,
GError **error)
{
@@ -142,11 +131,11 @@ o365_folder_cache_get (CamelO365Folder *o365_folder,
CamelStream *stream = NULL;
GIOStream *base_stream;
- checksum = o365_folder_cache_new_checksum (id);
+ checksum = m365_folder_cache_new_checksum (id);
- LOCK_CACHE (o365_folder);
- base_stream = camel_data_cache_get (o365_folder->priv->cache, O365_LOCAL_CACHE_PATH,
g_checksum_get_string (checksum), error);
- UNLOCK_CACHE (o365_folder);
+ LOCK_CACHE (m365_folder);
+ base_stream = camel_data_cache_get (m365_folder->priv->cache, M365_LOCAL_CACHE_PATH,
g_checksum_get_string (checksum), error);
+ UNLOCK_CACHE (m365_folder);
g_checksum_free (checksum);
@@ -159,17 +148,17 @@ o365_folder_cache_get (CamelO365Folder *o365_folder,
}
static gchar *
-o365_folder_cache_dup_filename (CamelO365Folder *o365_folder,
+m365_folder_cache_dup_filename (CamelM365Folder *m365_folder,
const gchar *id)
{
GChecksum *checksum;
gchar *filename;
- checksum = o365_folder_cache_new_checksum (id);
+ checksum = m365_folder_cache_new_checksum (id);
- LOCK_CACHE (o365_folder);
- filename = camel_data_cache_get_filename (o365_folder->priv->cache, O365_LOCAL_CACHE_PATH,
g_checksum_get_string (checksum));
- UNLOCK_CACHE (o365_folder);
+ LOCK_CACHE (m365_folder);
+ filename = camel_data_cache_get_filename (m365_folder->priv->cache, M365_LOCAL_CACHE_PATH,
g_checksum_get_string (checksum));
+ UNLOCK_CACHE (m365_folder);
g_checksum_free (checksum);
@@ -177,7 +166,7 @@ o365_folder_cache_dup_filename (CamelO365Folder *o365_folder,
}
static CamelMimeMessage *
-o365_folder_get_message_from_cache (CamelO365Folder *o365_folder,
+m365_folder_get_message_from_cache (CamelM365Folder *m365_folder,
const gchar *uid,
GCancellable *cancellable,
GError **error)
@@ -185,7 +174,7 @@ o365_folder_get_message_from_cache (CamelO365Folder *o365_folder,
CamelStream *stream;
CamelMimeMessage *msg;
- stream = o365_folder_cache_get (o365_folder, uid, error);
+ stream = m365_folder_cache_get (m365_folder, uid, error);
if (!stream)
return NULL;
@@ -201,13 +190,13 @@ o365_folder_get_message_from_cache (CamelO365Folder *o365_folder,
}
static void
-o365_folder_save_summary (CamelO365Folder *o365_folder)
+m365_folder_save_summary (CamelM365Folder *m365_folder)
{
CamelFolderSummary *summary;
- g_return_if_fail (CAMEL_IS_O365_FOLDER (o365_folder));
+ g_return_if_fail (CAMEL_IS_M365_FOLDER (m365_folder));
- summary = camel_folder_get_folder_summary (CAMEL_FOLDER (o365_folder));
+ summary = camel_folder_get_folder_summary (CAMEL_FOLDER (m365_folder));
if (summary) {
GError *error = NULL;
@@ -220,7 +209,7 @@ o365_folder_save_summary (CamelO365Folder *o365_folder)
}
static void
-o365_folder_forget_all_mails (CamelO365Folder *o365_folder)
+m365_folder_forget_all_mails (CamelM365Folder *m365_folder)
{
CamelFolder *folder;
CamelFolderChangeInfo *changes;
@@ -228,9 +217,9 @@ o365_folder_forget_all_mails (CamelO365Folder *o365_folder)
GPtrArray *known_uids;
gint ii;
- g_return_if_fail (CAMEL_IS_O365_FOLDER (o365_folder));
+ g_return_if_fail (CAMEL_IS_M365_FOLDER (m365_folder));
- folder = CAMEL_FOLDER (o365_folder);
+ folder = CAMEL_FOLDER (m365_folder);
g_return_if_fail (folder != NULL);
known_uids = camel_folder_summary_get_array (camel_folder_get_folder_summary (folder));
@@ -247,13 +236,13 @@ o365_folder_forget_all_mails (CamelO365Folder *o365_folder)
const gchar *uid = g_ptr_array_index (known_uids, ii);
camel_folder_change_info_remove_uid (changes, uid);
- o365_folder_cache_remove (o365_folder, uid, NULL);
+ m365_folder_cache_remove (m365_folder, uid, NULL);
}
camel_folder_summary_clear (folder_summary, NULL);
camel_folder_summary_unlock (folder_summary);
- o365_folder_save_summary (o365_folder);
+ m365_folder_save_summary (m365_folder);
if (camel_folder_change_info_changed (changes))
camel_folder_changed (folder, changes);
@@ -263,7 +252,7 @@ o365_folder_forget_all_mails (CamelO365Folder *o365_folder)
}
static guint32
-o365_folder_get_permanent_flags (CamelFolder *folder)
+m365_folder_get_permanent_flags (CamelFolder *folder)
{
return CAMEL_MESSAGE_ANSWERED |
CAMEL_MESSAGE_DELETED |
@@ -275,15 +264,15 @@ o365_folder_get_permanent_flags (CamelFolder *folder)
}
static CamelMimeMessage *
-o365_folder_get_message_cached (CamelFolder *folder,
+m365_folder_get_message_cached (CamelFolder *folder,
const gchar *message_uid,
GCancellable *cancellable)
{
- return o365_folder_get_message_from_cache (CAMEL_O365_FOLDER (folder), message_uid, cancellable,
NULL);
+ return m365_folder_get_message_from_cache (CAMEL_M365_FOLDER (folder), message_uid, cancellable,
NULL);
}
static void
-o365_folder_exec_search (CamelFolder *folder,
+m365_folder_exec_search (CamelFolder *folder,
const gchar *expression,
GPtrArray *uids,
GPtrArray **out_matches,
@@ -291,53 +280,53 @@ o365_folder_exec_search (CamelFolder *folder,
GCancellable *cancellable,
GError **error)
{
- CamelO365Folder *o365_folder;
+ CamelM365Folder *m365_folder;
- g_return_if_fail (CAMEL_IS_O365_FOLDER (folder));
+ g_return_if_fail (CAMEL_IS_M365_FOLDER (folder));
- o365_folder = CAMEL_O365_FOLDER (folder);
+ m365_folder = CAMEL_M365_FOLDER (folder);
- LOCK_SEARCH (o365_folder);
+ LOCK_SEARCH (m365_folder);
- camel_folder_search_set_folder (o365_folder->priv->search, folder);
+ camel_folder_search_set_folder (m365_folder->priv->search, folder);
if (out_matches)
- *out_matches = camel_folder_search_search (o365_folder->priv->search, expression, uids,
cancellable, error);
+ *out_matches = camel_folder_search_search (m365_folder->priv->search, expression, uids,
cancellable, error);
if (out_count)
- *out_count = camel_folder_search_count (o365_folder->priv->search, expression, cancellable,
error);
+ *out_count = camel_folder_search_count (m365_folder->priv->search, expression, cancellable,
error);
- UNLOCK_SEARCH (o365_folder);
+ UNLOCK_SEARCH (m365_folder);
}
static GPtrArray *
-o365_folder_search_by_expression (CamelFolder *folder,
+m365_folder_search_by_expression (CamelFolder *folder,
const gchar *expression,
GCancellable *cancellable,
GError **error)
{
GPtrArray *matches = NULL;
- o365_folder_exec_search (folder, expression, NULL, &matches, NULL, cancellable, error);
+ m365_folder_exec_search (folder, expression, NULL, &matches, NULL, cancellable, error);
return matches;
}
static guint32
-o365_folder_count_by_expression (CamelFolder *folder,
+m365_folder_count_by_expression (CamelFolder *folder,
const gchar *expression,
GCancellable *cancellable,
GError **error)
{
guint32 count = 0;
- o365_folder_exec_search (folder, expression, NULL, NULL, &count, cancellable, error);
+ m365_folder_exec_search (folder, expression, NULL, NULL, &count, cancellable, error);
return count;
}
static GPtrArray *
-o365_folder_search_by_uids (CamelFolder *folder,
+m365_folder_search_by_uids (CamelFolder *folder,
const gchar *expression,
GPtrArray *uids,
GCancellable *cancellable,
@@ -348,33 +337,33 @@ o365_folder_search_by_uids (CamelFolder *folder,
if (uids->len == 0)
return g_ptr_array_new ();
- o365_folder_exec_search (folder, expression, uids, &matches, NULL, cancellable, error);
+ m365_folder_exec_search (folder, expression, uids, &matches, NULL, cancellable, error);
return matches;
}
static void
-o365_folder_search_free (CamelFolder *folder,
+m365_folder_search_free (CamelFolder *folder,
GPtrArray *uids)
{
- CamelO365Folder *o365_folder;
+ CamelM365Folder *m365_folder;
if (!uids)
return;
- g_return_if_fail (CAMEL_IS_O365_FOLDER (folder));
+ g_return_if_fail (CAMEL_IS_M365_FOLDER (folder));
- o365_folder = CAMEL_O365_FOLDER (folder);
+ m365_folder = CAMEL_M365_FOLDER (folder);
- LOCK_SEARCH (o365_folder);
+ LOCK_SEARCH (m365_folder);
- camel_folder_search_free_result (o365_folder->priv->search, uids);
+ camel_folder_search_free_result (m365_folder->priv->search, uids);
- UNLOCK_SEARCH (o365_folder);
+ UNLOCK_SEARCH (m365_folder);
}
static gint
-o365_folder_cmp_uids (CamelFolder *folder,
+m365_folder_cmp_uids (CamelFolder *folder,
const gchar *uid1,
const gchar *uid2)
{
@@ -385,7 +374,7 @@ o365_folder_cmp_uids (CamelFolder *folder,
}
static gboolean
-o365_folder_download_message_cb (EO365Connection *cnc,
+m365_folder_download_message_cb (EM365Connection *cnc,
SoupMessage *message,
GInputStream *raw_data_stream,
gpointer user_data,
@@ -464,35 +453,35 @@ o365_folder_download_message_cb (EO365Connection *cnc,
}
static void
-o365_folder_get_message_cancelled_cb (GCancellable *cancellable,
+m365_folder_get_message_cancelled_cb (GCancellable *cancellable,
gpointer user_data)
{
- CamelO365Folder *o365_folder = user_data;
+ CamelM365Folder *m365_folder = user_data;
- g_return_if_fail (CAMEL_IS_O365_FOLDER (o365_folder));
+ g_return_if_fail (CAMEL_IS_M365_FOLDER (m365_folder));
- g_mutex_lock (&o365_folder->priv->get_message_lock);
- g_cond_broadcast (&o365_folder->priv->get_message_cond);
- g_mutex_unlock (&o365_folder->priv->get_message_lock);
+ g_mutex_lock (&m365_folder->priv->get_message_lock);
+ g_cond_broadcast (&m365_folder->priv->get_message_cond);
+ g_mutex_unlock (&m365_folder->priv->get_message_lock);
}
static CamelMimeMessage *
-o365_folder_get_message_sync (CamelFolder *folder,
+m365_folder_get_message_sync (CamelFolder *folder,
const gchar *uid,
GCancellable *cancellable,
GError **error)
{
CamelMimeMessage *message = NULL;
- CamelO365Folder *o365_folder;
- CamelO365Store *o365_store;
+ CamelM365Folder *m365_folder;
+ CamelM365Store *m365_store;
CamelStore *parent_store;
CamelStream *cache_stream = NULL;
- EO365Connection *cnc = NULL;
+ EM365Connection *cnc = NULL;
GError *local_error = NULL;
const gchar *folder_id;
gboolean success = TRUE, remove_from_hash = FALSE;
- g_return_val_if_fail (CAMEL_IS_O365_FOLDER (folder), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_FOLDER (folder), NULL);
g_return_val_if_fail (uid != NULL, NULL);
parent_store = camel_folder_get_parent_store (folder);
@@ -503,53 +492,53 @@ o365_folder_get_message_sync (CamelFolder *folder,
return NULL;
}
- o365_folder = CAMEL_O365_FOLDER (folder);
- o365_store = CAMEL_O365_STORE (parent_store);
+ m365_folder = CAMEL_M365_FOLDER (folder);
+ m365_store = CAMEL_M365_STORE (parent_store);
- if (!camel_o365_store_ensure_connected (o365_store, &cnc, cancellable, error))
+ if (!camel_m365_store_ensure_connected (m365_store, &cnc, cancellable, error))
return NULL;
- folder_id = camel_o365_folder_get_id (o365_folder);
+ folder_id = camel_m365_folder_get_id (m365_folder);
- g_mutex_lock (&o365_folder->priv->get_message_lock);
+ g_mutex_lock (&m365_folder->priv->get_message_lock);
- if (g_hash_table_contains (o365_folder->priv->get_message_hash, uid)) {
+ if (g_hash_table_contains (m365_folder->priv->get_message_hash, uid)) {
gulong handler_id = 0;
if (cancellable) {
handler_id = g_signal_connect (cancellable, "cancelled",
- G_CALLBACK (o365_folder_get_message_cancelled_cb), o365_folder);
+ G_CALLBACK (m365_folder_get_message_cancelled_cb), m365_folder);
}
while (success = !g_cancellable_set_error_if_cancelled (cancellable, error),
- success && g_hash_table_contains (o365_folder->priv->get_message_hash, uid)) {
- g_cond_wait (&o365_folder->priv->get_message_cond,
&o365_folder->priv->get_message_lock);
+ success && g_hash_table_contains (m365_folder->priv->get_message_hash, uid)) {
+ g_cond_wait (&m365_folder->priv->get_message_cond,
&m365_folder->priv->get_message_lock);
}
if (success)
- message = o365_folder_get_message_from_cache (o365_folder, uid, cancellable, NULL);
+ message = m365_folder_get_message_from_cache (m365_folder, uid, cancellable, NULL);
if (handler_id)
g_signal_handler_disconnect (cancellable, handler_id);
}
if (success && !message) {
- g_hash_table_insert (o365_folder->priv->get_message_hash, (gpointer) uid, NULL);
+ g_hash_table_insert (m365_folder->priv->get_message_hash, (gpointer) uid, NULL);
remove_from_hash = TRUE;
}
- g_mutex_unlock (&o365_folder->priv->get_message_lock);
+ g_mutex_unlock (&m365_folder->priv->get_message_lock);
if (success && !message) {
- cache_stream = o365_folder_cache_add (o365_folder, uid, error);
+ cache_stream = m365_folder_cache_add (m365_folder, uid, error);
success = cache_stream != NULL;
- success = success && e_o365_connection_get_mail_message_sync (cnc, NULL, folder_id, uid,
- o365_folder_download_message_cb, cache_stream, cancellable, &local_error);
+ success = success && e_m365_connection_get_mail_message_sync (cnc, NULL, folder_id, uid,
+ m365_folder_download_message_cb, cache_stream, cancellable, &local_error);
if (local_error) {
- camel_o365_store_maybe_disconnect (o365_store, local_error);
+ camel_m365_store_maybe_disconnect (m365_store, local_error);
g_propagate_error (error, local_error);
success = FALSE;
@@ -560,7 +549,7 @@ o365_folder_get_message_sync (CamelFolder *folder,
which is rewinded at the beginning of the stream. */
g_clear_object (&cache_stream);
- message = o365_folder_get_message_from_cache (o365_folder, uid, cancellable, error);
+ message = m365_folder_get_message_from_cache (m365_folder, uid, cancellable, error);
}
}
@@ -568,17 +557,17 @@ o365_folder_get_message_sync (CamelFolder *folder,
g_clear_object (&cnc);
if (remove_from_hash) {
- g_mutex_lock (&o365_folder->priv->get_message_lock);
- g_hash_table_remove (o365_folder->priv->get_message_hash, uid);
- g_cond_broadcast (&o365_folder->priv->get_message_cond);
- g_mutex_unlock (&o365_folder->priv->get_message_lock);
+ g_mutex_lock (&m365_folder->priv->get_message_lock);
+ g_hash_table_remove (m365_folder->priv->get_message_hash, uid);
+ g_cond_broadcast (&m365_folder->priv->get_message_cond);
+ g_mutex_unlock (&m365_folder->priv->get_message_lock);
}
return message;
}
static gboolean
-o365_folder_append_message_sync (CamelFolder *folder,
+m365_folder_append_message_sync (CamelFolder *folder,
CamelMimeMessage *message,
CamelMessageInfo *info,
gchar **appended_uid,
@@ -609,31 +598,31 @@ o365_folder_append_message_sync (CamelFolder *folder,
#ifdef ENABLE_MAINTAINER_MODE /* Only for easier testing */
CamelStore *parent_store;
- CamelO365Store *o365_store;
- EO365Connection *cnc = NULL;
+ CamelM365Store *m365_store;
+ EM365Connection *cnc = NULL;
gboolean success;
GError *local_error = NULL;
parent_store = camel_folder_get_parent_store (folder);
- if (!CAMEL_IS_O365_STORE (parent_store)) {
+ if (!CAMEL_IS_M365_STORE (parent_store)) {
g_set_error_literal (error, CAMEL_FOLDER_ERROR, CAMEL_FOLDER_ERROR_INVALID_STATE,
_("Invalid folder state (missing parent store)"));
return FALSE;
}
- o365_store = CAMEL_O365_STORE (parent_store);
+ m365_store = CAMEL_M365_STORE (parent_store);
- if (!camel_o365_store_ensure_connected (o365_store, &cnc, cancellable, error))
+ if (!camel_m365_store_ensure_connected (m365_store, &cnc, cancellable, error))
return FALSE;
- success = camel_o365_utils_create_message_sync (cnc, camel_o365_folder_get_id (CAMEL_O365_FOLDER
(folder)),
+ success = camel_m365_utils_create_message_sync (cnc, camel_m365_folder_get_id (CAMEL_M365_FOLDER
(folder)),
message, info, appended_uid, cancellable, &local_error);
g_clear_object (&cnc);
if (!success)
- camel_o365_store_maybe_disconnect (o365_store, local_error);
+ camel_m365_store_maybe_disconnect (m365_store, local_error);
if (local_error)
g_propagate_error (error, local_error);
@@ -647,8 +636,8 @@ o365_folder_append_message_sync (CamelFolder *folder,
}
static gboolean
-o365_folder_merge_server_user_flags (CamelMessageInfo *mi,
- EO365MailMessage *mail)
+m365_folder_merge_server_user_flags (CamelMessageInfo *mi,
+ EM365MailMessage *mail)
{
CamelFolderSummary *summary;
JsonArray *categories;
@@ -671,11 +660,11 @@ o365_folder_merge_server_user_flags (CamelMessageInfo *mi,
for (ii = 0; ii < len; ii++) {
const gchar *name = camel_named_flags_get (user_flags, ii);
- if (!camel_o365_utils_is_system_user_flag (name))
+ if (!camel_m365_utils_is_system_user_flag (name))
g_hash_table_insert (current_labels, (gpointer) name, NULL);
}
- categories = e_o365_mail_message_get_categories (mail);
+ categories = e_m365_mail_message_get_categories (mail);
if (categories) {
len = json_array_get_length (categories);
@@ -683,12 +672,12 @@ o365_folder_merge_server_user_flags (CamelMessageInfo *mi,
for (ii = 0; ii < len; ii++) {
const gchar *name = json_array_get_string_element (categories, ii);
- name = camel_o365_utils_rename_label (name, TRUE);
+ name = camel_m365_utils_rename_label (name, TRUE);
if (name && *name) {
gchar *flag;
- flag = camel_o365_utils_encode_category_name (name);
+ flag = camel_m365_utils_encode_category_name (name);
if (!g_hash_table_remove (current_labels, flag)) {
changed = TRUE;
@@ -725,35 +714,35 @@ o365_folder_merge_server_user_flags (CamelMessageInfo *mi,
}
static gboolean
-o365_folder_update_message_info (CamelMessageInfo *mi,
- EO365MailMessage *mail)
+m365_folder_update_message_info (CamelMessageInfo *mi,
+ EM365MailMessage *mail)
{
- CamelO365MessageInfo *o365_mi;
+ CamelM365MessageInfo *m365_mi;
guint32 flags = 0;
gboolean changed = FALSE;
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (mi), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (mi), FALSE);
g_return_val_if_fail (mail != NULL, FALSE);
- o365_mi = CAMEL_O365_MESSAGE_INFO (mi);
+ m365_mi = CAMEL_M365_MESSAGE_INFO (mi);
- if (e_o365_mail_message_get_has_attachments (mail))
+ if (e_m365_mail_message_get_has_attachments (mail))
flags |= CAMEL_MESSAGE_ATTACHMENTS;
- if (e_o365_mail_message_get_is_draft (mail))
+ if (e_m365_mail_message_get_is_draft (mail))
flags |= CAMEL_MESSAGE_DRAFT;
- if (e_o365_mail_message_get_is_read (mail))
+ if (e_m365_mail_message_get_is_read (mail))
flags |= CAMEL_MESSAGE_SEEN;
- if (e_o365_mail_message_get_importance (mail) == E_O365_IMPORTANCE_HIGH)
+ if (e_m365_mail_message_get_importance (mail) == E_M365_IMPORTANCE_HIGH)
flags |= CAMEL_MESSAGE_FLAGGED;
/* 2020-06-24 - cannot make it work, even with
https://stackoverflow.com/questions/58205494/access-the-replied-forwarded-etc-state-from-rest */
/* CAMEL_MESSAGE_ANSWERED
CAMEL_MESSAGE_FORWARDED */
- if (camel_o365_message_info_set_server_flags (o365_mi, flags)) {
+ if (camel_m365_message_info_set_server_flags (m365_mi, flags)) {
guint32 mask;
mask = CAMEL_MESSAGE_ATTACHMENTS | CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN |
CAMEL_MESSAGE_FLAGGED;
@@ -763,13 +752,13 @@ o365_folder_update_message_info (CamelMessageInfo *mi,
changed = TRUE;
}
- changed = o365_folder_merge_server_user_flags (mi, mail) || changed;
+ changed = m365_folder_merge_server_user_flags (mi, mail) || changed;
return changed;
}
static gchar *
-o365_folder_recipients_as_string (JsonArray *recipients) /* EO365Recipient * */
+m365_folder_recipients_as_string (JsonArray *recipients) /* EM365Recipient * */
{
CamelInternetAddress *addrs;
guint ii, len;
@@ -782,11 +771,11 @@ o365_folder_recipients_as_string (JsonArray *recipients) /* EO365Recipient * */
len = json_array_get_length (recipients);
for (ii = 0; ii < len; ii++) {
- EO365Recipient *recipient = json_array_get_object_element (recipients, ii);
+ EM365Recipient *recipient = json_array_get_object_element (recipients, ii);
const gchar *name, *address;
- name = e_o365_recipient_get_name (recipient);
- address = e_o365_recipient_get_address (recipient);
+ name = e_m365_recipient_get_name (recipient);
+ address = e_m365_recipient_get_address (recipient);
if (address && *address)
camel_internet_address_add (addrs, name, address);
@@ -804,13 +793,13 @@ o365_folder_recipients_as_string (JsonArray *recipients) /* EO365Recipient * */
}
static CamelMessageInfo *
-o365_folder_new_message_info_from_mail_message (CamelFolder *folder,
- EO365MailMessage *mail)
+m365_folder_new_message_info_from_mail_message (CamelFolder *folder,
+ EM365MailMessage *mail)
{
CamelMessageInfo *mi = NULL;
CamelNameValueArray *headers = NULL;
JsonArray *json_headers;
- EO365Recipient *from;
+ EM365Recipient *from;
const gchar *ctmp;
time_t tt;
gchar *tmp;
@@ -818,7 +807,7 @@ o365_folder_new_message_info_from_mail_message (CamelFolder *folder,
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
g_return_val_if_fail (mail != NULL, NULL);
- json_headers = e_o365_mail_message_get_internet_message_headers (mail);
+ json_headers = e_m365_mail_message_get_internet_message_headers (mail);
if (json_headers && json_array_get_length (json_headers) > 0) {
guint ii, len = json_array_get_length (json_headers);
@@ -826,11 +815,11 @@ o365_folder_new_message_info_from_mail_message (CamelFolder *folder,
headers = camel_name_value_array_new_sized (len);
for (ii = 0; ii < len; ii++) {
- EO365InternetMessageHeader *header = json_array_get_object_element (json_headers, ii);
+ EM365InternetMessageHeader *header = json_array_get_object_element (json_headers, ii);
const gchar *name, *value;
- name = e_o365_internet_message_header_get_name (header);
- value = e_o365_internet_message_header_get_value (header);
+ name = e_m365_internet_message_header_get_name (header);
+ value = e_m365_internet_message_header_get_value (header);
if (name && *name)
camel_name_value_array_append (headers, name, value ? value : "");
@@ -849,18 +838,18 @@ o365_folder_new_message_info_from_mail_message (CamelFolder *folder,
camel_message_info_set_abort_notifications (mi, TRUE);
- ctmp = e_o365_mail_message_get_subject (mail);
+ ctmp = e_m365_mail_message_get_subject (mail);
if (ctmp)
camel_message_info_set_subject (mi, ctmp);
- from = e_o365_mail_message_get_from (mail);
+ from = e_m365_mail_message_get_from (mail);
if (from) {
const gchar *name, *address;
- name = e_o365_recipient_get_name (from);
- address = e_o365_recipient_get_address (from);
+ name = e_m365_recipient_get_name (from);
+ address = e_m365_recipient_get_address (from);
if (address && *address) {
tmp = camel_internet_address_format_address (name, address);
@@ -873,31 +862,31 @@ o365_folder_new_message_info_from_mail_message (CamelFolder *folder,
}
}
- tmp = o365_folder_recipients_as_string (e_o365_mail_message_get_to_recipients (mail));
+ tmp = m365_folder_recipients_as_string (e_m365_mail_message_get_to_recipients (mail));
if (tmp) {
camel_message_info_set_to (mi, tmp);
g_free (tmp);
}
- tmp = o365_folder_recipients_as_string (e_o365_mail_message_get_cc_recipients (mail));
+ tmp = m365_folder_recipients_as_string (e_m365_mail_message_get_cc_recipients (mail));
if (tmp) {
camel_message_info_set_cc (mi, tmp);
g_free (tmp);
}
- tt = e_o365_mail_message_get_sent_date_time (mail);
+ tt = e_m365_mail_message_get_sent_date_time (mail);
if (tt)
camel_message_info_set_date_sent (mi, (gint64) tt);
- tt = e_o365_mail_message_get_received_date_time (mail);
+ tt = e_m365_mail_message_get_received_date_time (mail);
if (tt)
camel_message_info_set_date_received (mi, (gint64) tt);
- ctmp = e_o365_mail_message_get_internet_message_id (mail);
+ ctmp = e_m365_mail_message_get_internet_message_id (mail);
if (ctmp && *ctmp) {
GChecksum *checksum;
@@ -918,14 +907,14 @@ o365_folder_new_message_info_from_mail_message (CamelFolder *folder,
camel_message_info_set_message_id (mi, message_id.id.id);
}
- camel_message_info_set_uid (mi, e_o365_mail_message_get_id (mail));
+ camel_message_info_set_uid (mi, e_m365_mail_message_get_id (mail));
if (headers)
camel_message_info_take_headers (mi, headers);
camel_message_info_set_abort_notifications (mi, FALSE);
- o365_folder_update_message_info (mi, mail);
+ m365_folder_update_message_info (mi, mail);
return mi;
}
@@ -937,7 +926,7 @@ typedef struct _SummaryDeltaData {
} SummaryDeltaData;
static gboolean
-o365_folder_got_summary_messages_cb (EO365Connection *cnc,
+m365_folder_got_summary_messages_cb (EM365Connection *cnc,
const GSList *results, /* JsonObject * - the returned objects from the
server */
gpointer user_data,
GCancellable *cancellable,
@@ -955,10 +944,10 @@ o365_folder_got_summary_messages_cb (EO365Connection *cnc,
return FALSE;
for (link = (GSList *) results; link; link = g_slist_next (link)) {
- EO365MailMessage *mail = link->data;
+ EM365MailMessage *mail = link->data;
const gchar *id;
- id = e_o365_mail_message_get_id (mail);
+ id = e_m365_mail_message_get_id (mail);
if (!id)
continue;
@@ -966,7 +955,7 @@ o365_folder_got_summary_messages_cb (EO365Connection *cnc,
if (!sdd->changes)
sdd->changes = camel_folder_change_info_new ();
- if (e_o365_delta_is_removed_object (mail)) {
+ if (e_m365_delta_is_removed_object (mail)) {
sdd->removed_uids = g_list_prepend (sdd->removed_uids, (gpointer)
camel_pstring_strdup (id));
camel_folder_change_info_remove_uid (sdd->changes, id);
@@ -976,12 +965,12 @@ o365_folder_got_summary_messages_cb (EO365Connection *cnc,
info = camel_folder_summary_get (summary, id);
if (info) {
- if (o365_folder_update_message_info (info, mail))
+ if (m365_folder_update_message_info (info, mail))
camel_folder_change_info_change_uid (sdd->changes, id);
g_object_unref (info);
} else {
- info = o365_folder_new_message_info_from_mail_message (sdd->folder, mail);
+ info = m365_folder_new_message_info_from_mail_message (sdd->folder, mail);
if (info) {
camel_folder_summary_add (summary, info, TRUE);
@@ -1003,23 +992,23 @@ o365_folder_got_summary_messages_cb (EO365Connection *cnc,
}
static gboolean
-o365_folder_refresh_info_sync (CamelFolder *folder,
+m365_folder_refresh_info_sync (CamelFolder *folder,
GCancellable *cancellable,
GError **error)
{
- CamelO365Folder *o365_folder;
- CamelO365FolderSummary *o365_folder_summary;
- CamelO365Store *o365_store;
+ CamelM365Folder *m365_folder;
+ CamelM365FolderSummary *m365_folder_summary;
+ CamelM365Store *m365_store;
CamelFolderSummary *folder_summary;
CamelStore *parent_store;
- EO365Connection *cnc = NULL;
+ EM365Connection *cnc = NULL;
SummaryDeltaData sdd;
GError *local_error = NULL;
const gchar *folder_id;
gchar *curr_delta_link, *new_delta_link = NULL;
gboolean success;
- g_return_val_if_fail (CAMEL_IS_O365_FOLDER (folder), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_FOLDER (folder), FALSE);
parent_store = camel_folder_get_parent_store (folder);
@@ -1029,41 +1018,41 @@ o365_folder_refresh_info_sync (CamelFolder *folder,
return FALSE;
}
- o365_folder = CAMEL_O365_FOLDER (folder);
- o365_store = CAMEL_O365_STORE (parent_store);
+ m365_folder = CAMEL_M365_FOLDER (folder);
+ m365_store = CAMEL_M365_STORE (parent_store);
- if (!camel_o365_store_ensure_connected (o365_store, &cnc, cancellable, error))
+ if (!camel_m365_store_ensure_connected (m365_store, &cnc, cancellable, error))
return FALSE;
- folder_id = camel_o365_folder_get_id (o365_folder);
+ folder_id = camel_m365_folder_get_id (m365_folder);
folder_summary = camel_folder_get_folder_summary (folder);
- o365_folder_summary = CAMEL_O365_FOLDER_SUMMARY (folder_summary);
+ m365_folder_summary = CAMEL_M365_FOLDER_SUMMARY (folder_summary);
- curr_delta_link = camel_o365_folder_summary_dup_delta_link (o365_folder_summary);
+ curr_delta_link = camel_m365_folder_summary_dup_delta_link (m365_folder_summary);
sdd.folder = folder;
sdd.changes = NULL;
sdd.removed_uids = NULL;
- success = e_o365_connection_get_objects_delta_sync (cnc, NULL, E_O365_FOLDER_KIND_MAIL, folder_id,
O365_FETCH_SUMMARY_PROPERTIES,
- curr_delta_link, 0, o365_folder_got_summary_messages_cb, &sdd,
+ success = e_m365_connection_get_objects_delta_sync (cnc, NULL, E_M365_FOLDER_KIND_MAIL, folder_id,
M365_FETCH_SUMMARY_PROPERTIES,
+ curr_delta_link, 0, m365_folder_got_summary_messages_cb, &sdd,
&new_delta_link, cancellable, &local_error);
- if (curr_delta_link && e_o365_connection_util_delta_token_failed (local_error)) {
+ if (curr_delta_link && e_m365_connection_util_delta_token_failed (local_error)) {
g_clear_error (&local_error);
g_clear_pointer (&curr_delta_link, g_free);
- camel_o365_folder_summary_set_delta_link (o365_folder_summary, NULL);
+ camel_m365_folder_summary_set_delta_link (m365_folder_summary, NULL);
- o365_folder_forget_all_mails (o365_folder);
+ m365_folder_forget_all_mails (m365_folder);
- success = e_o365_connection_get_objects_delta_sync (cnc, NULL, E_O365_FOLDER_KIND_MAIL,
folder_id, O365_FETCH_SUMMARY_PROPERTIES,
- NULL, 0, o365_folder_got_summary_messages_cb, &sdd,
+ success = e_m365_connection_get_objects_delta_sync (cnc, NULL, E_M365_FOLDER_KIND_MAIL,
folder_id, M365_FETCH_SUMMARY_PROPERTIES,
+ NULL, 0, m365_folder_got_summary_messages_cb, &sdd,
&new_delta_link, cancellable, &local_error);
}
if (success && new_delta_link)
- camel_o365_folder_summary_set_delta_link (o365_folder_summary, new_delta_link);
+ camel_m365_folder_summary_set_delta_link (m365_folder_summary, new_delta_link);
if (sdd.removed_uids) {
camel_folder_summary_remove_uids (folder_summary, sdd.removed_uids);
@@ -1071,7 +1060,7 @@ o365_folder_refresh_info_sync (CamelFolder *folder,
g_list_free_full (sdd.removed_uids, (GDestroyNotify) camel_pstring_free);
}
- o365_folder_save_summary (o365_folder);
+ m365_folder_save_summary (m365_folder);
if (sdd.changes) {
if (camel_folder_change_info_changed (sdd.changes))
@@ -1081,7 +1070,7 @@ o365_folder_refresh_info_sync (CamelFolder *folder,
}
if (local_error) {
- camel_o365_store_maybe_disconnect (o365_store, local_error);
+ camel_m365_store_maybe_disconnect (m365_store, local_error);
g_propagate_error (error, local_error);
success = FALSE;
@@ -1095,49 +1084,49 @@ o365_folder_refresh_info_sync (CamelFolder *folder,
}
static gboolean
-o365_folder_copy_move_to_folder_sync (CamelFolder *folder,
- CamelO365Store *o365_store,
+m365_folder_copy_move_to_folder_sync (CamelFolder *folder,
+ CamelM365Store *m365_store,
const GSList *uids,
const gchar *des_folder_id,
gboolean do_copy,
GCancellable *cancellable,
GError **error)
{
- CamelO365StoreSummary *o365_store_summary;
- EO365Connection *cnc = NULL;
+ CamelM365StoreSummary *m365_store_summary;
+ EM365Connection *cnc = NULL;
GSList *des_ids = NULL;
gboolean success;
g_return_val_if_fail (des_folder_id != NULL, FALSE);
- o365_store_summary = camel_o365_store_ref_store_summary (o365_store);
+ m365_store_summary = camel_m365_store_ref_store_summary (m365_store);
if (g_strcmp0 (des_folder_id, "junkemail") == 0) {
- des_folder_id = camel_o365_store_summary_dup_folder_id_for_type (o365_store_summary,
CAMEL_FOLDER_TYPE_JUNK);
+ des_folder_id = camel_m365_store_summary_dup_folder_id_for_type (m365_store_summary,
CAMEL_FOLDER_TYPE_JUNK);
} else if (g_strcmp0 (des_folder_id, "deleteditems") == 0) {
- des_folder_id = camel_o365_store_summary_dup_folder_id_for_type (o365_store_summary,
CAMEL_FOLDER_TYPE_TRASH);
+ des_folder_id = camel_m365_store_summary_dup_folder_id_for_type (m365_store_summary,
CAMEL_FOLDER_TYPE_TRASH);
} else if (g_strcmp0 (des_folder_id, "inbox") == 0) {
- des_folder_id = camel_o365_store_summary_dup_folder_id_for_type (o365_store_summary,
CAMEL_FOLDER_TYPE_INBOX);
+ des_folder_id = camel_m365_store_summary_dup_folder_id_for_type (m365_store_summary,
CAMEL_FOLDER_TYPE_INBOX);
}
- g_clear_object (&o365_store_summary);
+ g_clear_object (&m365_store_summary);
- if (!camel_o365_store_ensure_connected (o365_store, &cnc, cancellable, error))
+ if (!camel_m365_store_ensure_connected (m365_store, &cnc, cancellable, error))
return FALSE;
- success = e_o365_connection_copy_move_mail_messages_sync (cnc, NULL, uids, des_folder_id, do_copy,
+ success = e_m365_connection_copy_move_mail_messages_sync (cnc, NULL, uids, des_folder_id, do_copy,
&des_ids, cancellable, error);
g_clear_object (&cnc);
if (!do_copy) {
CamelFolderChangeInfo *src_changes;
- CamelO365Folder *o365_folder;
+ CamelM365Folder *m365_folder;
GSList *des_link, *src_link;
GList *removed_uids = NULL;
src_changes = camel_folder_change_info_new ();
- o365_folder = CAMEL_O365_FOLDER (folder);
+ m365_folder = CAMEL_M365_FOLDER (folder);
camel_folder_lock (folder);
@@ -1147,7 +1136,7 @@ o365_folder_copy_move_to_folder_sync (CamelFolder *folder,
src_link = g_slist_next (src_link), des_link = g_slist_next (des_link)) {
const gchar *src_uid = src_link->data;
- o365_folder_cache_remove (o365_folder, src_uid, NULL);
+ m365_folder_cache_remove (m365_folder, src_uid, NULL);
removed_uids = g_list_prepend (removed_uids, (gpointer) src_uid);
camel_folder_change_info_remove_uid (src_changes, src_uid);
@@ -1176,30 +1165,30 @@ o365_folder_copy_move_to_folder_sync (CamelFolder *folder,
}
static gboolean
-o365_folder_delete_messages_sync (CamelFolder *folder,
- CamelO365Store *o365_store,
+m365_folder_delete_messages_sync (CamelFolder *folder,
+ CamelM365Store *m365_store,
const GSList *uids,
gboolean is_trash_folder,
GCancellable *cancellable,
GError **error)
{
- EO365Connection *cnc = NULL;
+ EM365Connection *cnc = NULL;
gboolean success;
- if (!camel_o365_store_ensure_connected (o365_store, &cnc, cancellable, error))
+ if (!camel_m365_store_ensure_connected (m365_store, &cnc, cancellable, error))
return FALSE;
if (is_trash_folder) {
GSList *deleted_uids = NULL, *link;
- success = e_o365_connection_delete_mail_messages_sync (cnc, NULL, uids, &deleted_uids,
cancellable, error);
+ success = e_m365_connection_delete_mail_messages_sync (cnc, NULL, uids, &deleted_uids,
cancellable, error);
if (deleted_uids) {
CamelFolderChangeInfo *changes;
- CamelO365Folder *o365_folder;
+ CamelM365Folder *m365_folder;
GList *removed_uids = NULL;
- o365_folder = CAMEL_O365_FOLDER (folder);
+ m365_folder = CAMEL_M365_FOLDER (folder);
changes = camel_folder_change_info_new ();
camel_folder_lock (folder);
@@ -1208,7 +1197,7 @@ o365_folder_delete_messages_sync (CamelFolder *folder,
for (link = deleted_uids; link; link = g_slist_next (link)) {
const gchar *uid = link->data;
- o365_folder_cache_remove (o365_folder, uid, NULL);
+ m365_folder_cache_remove (m365_folder, uid, NULL);
removed_uids = g_list_prepend (removed_uids, (gpointer) uid);
camel_folder_change_info_remove_uid (changes, uid);
@@ -1233,7 +1222,7 @@ o365_folder_delete_messages_sync (CamelFolder *folder,
g_slist_free (deleted_uids);
}
} else {
- success = o365_folder_copy_move_to_folder_sync (folder, o365_store,
+ success = m365_folder_copy_move_to_folder_sync (folder, m365_store,
uids, "deleteditems", FALSE, cancellable, error);
}
@@ -1243,34 +1232,34 @@ o365_folder_delete_messages_sync (CamelFolder *folder,
}
static JsonBuilder *
-o365_folder_message_info_changes_to_json (CamelMessageInfo *mi)
+m365_folder_message_info_changes_to_json (CamelMessageInfo *mi)
{
JsonBuilder *builder;
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
+ e_m365_json_begin_object_member (builder, NULL);
- camel_o365_utils_add_message_flags (builder, mi, NULL);
+ camel_m365_utils_add_message_flags (builder, mi, NULL);
- e_o365_json_end_object_member (builder);
+ e_m365_json_end_object_member (builder);
return builder;
}
static gboolean
-o365_folder_save_flags_sync (CamelFolder *folder,
- CamelO365Store *o365_store,
+m365_folder_save_flags_sync (CamelFolder *folder,
+ CamelM365Store *m365_store,
GSList *mi_list, /* CamelMessageInfo * */
GCancellable *cancellable,
GError **error)
{
- EO365Connection *cnc = NULL;
+ EM365Connection *cnc = NULL;
gboolean success = TRUE;
/* Trap an error, but do not stop other processing */
g_return_val_if_fail (mi_list != NULL, TRUE);
- if (!camel_o365_store_ensure_connected (o365_store, &cnc, cancellable, error))
+ if (!camel_m365_store_ensure_connected (m365_store, &cnc, cancellable, error))
return FALSE;
if (mi_list->next) {
@@ -1284,9 +1273,9 @@ o365_folder_save_flags_sync (CamelFolder *folder,
SoupMessage *message;
JsonBuilder *builder;
- builder = o365_folder_message_info_changes_to_json (mi);
+ builder = m365_folder_message_info_changes_to_json (mi);
- message = e_o365_connection_prepare_update_mail_message (cnc, NULL,
+ message = e_m365_connection_prepare_update_mail_message (cnc, NULL,
camel_message_info_get_uid (mi), builder, error);
g_clear_object (&builder);
@@ -1298,16 +1287,16 @@ o365_folder_save_flags_sync (CamelFolder *folder,
}
if (success)
- success = e_o365_connection_batch_request_sync (cnc, E_O365_API_V1_0, requests,
cancellable, error);
+ success = e_m365_connection_batch_request_sync (cnc, E_M365_API_V1_0, requests,
cancellable, error);
g_ptr_array_free (requests, TRUE);
} else {
CamelMessageInfo *mi = mi_list->data;
JsonBuilder *builder;
- builder = o365_folder_message_info_changes_to_json (mi);
+ builder = m365_folder_message_info_changes_to_json (mi);
- success = e_o365_connection_update_mail_message_sync (cnc, NULL,
+ success = e_m365_connection_update_mail_message_sync (cnc, NULL,
camel_message_info_get_uid (mi), builder, cancellable, error);
g_clear_object (&builder);
@@ -1333,12 +1322,12 @@ o365_folder_save_flags_sync (CamelFolder *folder,
}
static gboolean
-o365_folder_is_of_type (CamelFolder *folder,
+m365_folder_is_of_type (CamelFolder *folder,
guint32 folder_type)
{
CamelStore *parent_store;
- CamelO365Store *o365_store;
- CamelO365StoreSummary *o365_store_summary;
+ CamelM365Store *m365_store;
+ CamelM365StoreSummary *m365_store_summary;
gboolean is_of_type;
const gchar *folder_id;
@@ -1349,29 +1338,29 @@ o365_folder_is_of_type (CamelFolder *folder,
if (!parent_store)
return FALSE;
- o365_store = CAMEL_O365_STORE (parent_store);
+ m365_store = CAMEL_M365_STORE (parent_store);
- g_return_val_if_fail (o365_store != NULL, FALSE);
+ g_return_val_if_fail (m365_store != NULL, FALSE);
- o365_store_summary = camel_o365_store_ref_store_summary (o365_store);
+ m365_store_summary = camel_m365_store_ref_store_summary (m365_store);
folder_type = folder_type & CAMEL_FOLDER_TYPE_MASK;
- folder_id = camel_o365_folder_get_id (CAMEL_O365_FOLDER (folder));
+ folder_id = camel_m365_folder_get_id (CAMEL_M365_FOLDER (folder));
is_of_type = folder_id &&
- (camel_o365_store_summary_get_folder_flags (o365_store_summary, folder_id) &
CAMEL_FOLDER_TYPE_MASK) == folder_type;
+ (camel_m365_store_summary_get_folder_flags (m365_store_summary, folder_id) &
CAMEL_FOLDER_TYPE_MASK) == folder_type;
- g_clear_object (&o365_store_summary);
+ g_clear_object (&m365_store_summary);
return is_of_type;
}
static gboolean
-o365_folder_synchronize_sync (CamelFolder *folder,
+m365_folder_synchronize_sync (CamelFolder *folder,
gboolean expunge,
GCancellable *cancellable,
GError **error)
{
- CamelO365Store *o365_store;
+ CamelM365Store *m365_store;
CamelStore *parent_store;
CamelFolderSummary *folder_summary;
GPtrArray *uids;
@@ -1390,9 +1379,9 @@ o365_folder_synchronize_sync (CamelFolder *folder,
return FALSE;
}
- o365_store = CAMEL_O365_STORE (parent_store);
+ m365_store = CAMEL_M365_STORE (parent_store);
- if (!camel_o365_store_ensure_connected (o365_store, NULL, cancellable, error))
+ if (!camel_m365_store_ensure_connected (m365_store, NULL, cancellable, error))
return FALSE;
folder_summary = camel_folder_get_folder_summary (folder);
@@ -1410,7 +1399,7 @@ o365_folder_synchronize_sync (CamelFolder *folder,
return TRUE;
}
- is_junk_folder = o365_folder_is_of_type (folder, CAMEL_FOLDER_TYPE_JUNK);
+ is_junk_folder = m365_folder_is_of_type (folder, CAMEL_FOLDER_TYPE_JUNK);
for (ii = 0; success && ii < uids->len; ii++) {
guint32 flags_changed, flags_set;
@@ -1424,7 +1413,7 @@ o365_folder_synchronize_sync (CamelFolder *folder,
continue;
flags_set = camel_message_info_get_flags (mi);
- flags_changed = camel_o365_message_info_get_server_flags (CAMEL_O365_MESSAGE_INFO (mi)) ^
flags_set;
+ flags_changed = camel_m365_message_info_get_server_flags (CAMEL_M365_MESSAGE_INFO (mi)) ^
flags_set;
if ((flags_set & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0 &&
(flags_changed & (CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_FORWARDED |
CAMEL_MESSAGE_FLAGGED)) != 0) {
@@ -1454,8 +1443,8 @@ o365_folder_synchronize_sync (CamelFolder *folder,
g_clear_object (&mi);
}
- if (mi_list_len == E_O365_BATCH_MAX_REQUESTS) {
- success = o365_folder_save_flags_sync (folder, o365_store, mi_list, cancellable,
&local_error);
+ if (mi_list_len == E_M365_BATCH_MAX_REQUESTS) {
+ success = m365_folder_save_flags_sync (folder, m365_store, mi_list, cancellable,
&local_error);
g_slist_free_full (mi_list, g_object_unref);
mi_list = NULL;
mi_list_len = 0;
@@ -1463,26 +1452,26 @@ o365_folder_synchronize_sync (CamelFolder *folder,
}
if (mi_list != NULL && success)
- success = o365_folder_save_flags_sync (folder, o365_store, mi_list, cancellable,
&local_error);
+ success = m365_folder_save_flags_sync (folder, m365_store, mi_list, cancellable,
&local_error);
g_slist_free_full (mi_list, g_object_unref);
if (deleted_uids && success)
- success = o365_folder_delete_messages_sync (folder, o365_store, deleted_uids,
o365_folder_is_of_type (folder, CAMEL_FOLDER_TYPE_TRASH), cancellable, &local_error);
+ success = m365_folder_delete_messages_sync (folder, m365_store, deleted_uids,
m365_folder_is_of_type (folder, CAMEL_FOLDER_TYPE_TRASH), cancellable, &local_error);
g_slist_free_full (deleted_uids, (GDestroyNotify) camel_pstring_free);
if (junk_uids && success)
- success = o365_folder_copy_move_to_folder_sync (folder, o365_store, junk_uids, "junkemail",
FALSE, cancellable, &local_error);
+ success = m365_folder_copy_move_to_folder_sync (folder, m365_store, junk_uids, "junkemail",
FALSE, cancellable, &local_error);
g_slist_free_full (junk_uids, (GDestroyNotify) camel_pstring_free);
if (inbox_uids && success)
- success = o365_folder_copy_move_to_folder_sync (folder, o365_store, inbox_uids, "inbox",
FALSE, cancellable, &local_error);
+ success = m365_folder_copy_move_to_folder_sync (folder, m365_store, inbox_uids, "inbox",
FALSE, cancellable, &local_error);
g_slist_free_full (inbox_uids, (GDestroyNotify) camel_pstring_free);
camel_folder_summary_save (folder_summary, NULL);
camel_folder_summary_free_array (uids);
if (local_error) {
- camel_o365_store_maybe_disconnect (o365_store, local_error);
+ camel_m365_store_maybe_disconnect (m365_store, local_error);
g_propagate_error (error, local_error);
}
@@ -1490,17 +1479,17 @@ o365_folder_synchronize_sync (CamelFolder *folder,
}
static gboolean
-o365_folder_expunge_sync (CamelFolder *folder,
+m365_folder_expunge_sync (CamelFolder *folder,
GCancellable *cancellable,
GError **error)
{
- /* it does nothing special here, everything is done as part of the o365_folder_synchronize_sync() */
+ /* it does nothing special here, everything is done as part of the m365_folder_synchronize_sync() */
return TRUE;
}
static gboolean
-o365_folder_transfer_messages_to_sync (CamelFolder *source,
+m365_folder_transfer_messages_to_sync (CamelFolder *source,
GPtrArray *uids,
CamelFolder *destination,
gboolean delete_originals,
@@ -1509,15 +1498,15 @@ o365_folder_transfer_messages_to_sync (CamelFolder *source,
GError **error)
{
CamelStore *parent_store;
- CamelO365Store *o365_store;
+ CamelM365Store *m365_store;
GSList *uids_list = NULL;
gboolean success;
guint ii;
GError *local_error = NULL;
/* The parent class ensures this, but recheck anyway, for completeness */
- g_return_val_if_fail (CAMEL_IS_O365_FOLDER (source), FALSE);
- g_return_val_if_fail (CAMEL_IS_O365_FOLDER (destination), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_FOLDER (source), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_FOLDER (destination), FALSE);
g_return_val_if_fail (uids != NULL, FALSE);
parent_store = camel_folder_get_parent_store (source);
@@ -1531,9 +1520,9 @@ o365_folder_transfer_messages_to_sync (CamelFolder *source,
/* The parent class ensures this, but recheck anyway, for completeness */
g_return_val_if_fail (camel_folder_get_parent_store (destination) == parent_store, FALSE);
- o365_store = CAMEL_O365_STORE (parent_store);
+ m365_store = CAMEL_M365_STORE (parent_store);
- if (!camel_o365_store_ensure_connected (o365_store, NULL, cancellable, error))
+ if (!camel_m365_store_ensure_connected (m365_store, NULL, cancellable, error))
return FALSE;
for (ii = 0; ii < uids->len; ii++) {
@@ -1542,8 +1531,8 @@ o365_folder_transfer_messages_to_sync (CamelFolder *source,
uids_list = g_slist_reverse (uids_list);
- success = o365_folder_copy_move_to_folder_sync (source, o365_store,
- uids_list, camel_o365_folder_get_id (CAMEL_O365_FOLDER (destination)),
+ success = m365_folder_copy_move_to_folder_sync (source, m365_store,
+ uids_list, camel_m365_folder_get_id (CAMEL_M365_FOLDER (destination)),
!delete_originals, cancellable, &local_error);
g_slist_free (uids_list);
@@ -1554,11 +1543,11 @@ o365_folder_transfer_messages_to_sync (CamelFolder *source,
if (success && !camel_folder_is_frozen (destination)) {
camel_operation_progress (cancellable, -1);
- o365_folder_refresh_info_sync (destination, cancellable, NULL);
+ m365_folder_refresh_info_sync (destination, cancellable, NULL);
}
if (local_error) {
- camel_o365_store_maybe_disconnect (o365_store, local_error);
+ camel_m365_store_maybe_disconnect (m365_store, local_error);
g_propagate_error (error, local_error);
}
@@ -1566,25 +1555,25 @@ o365_folder_transfer_messages_to_sync (CamelFolder *source,
}
static void
-o365_folder_prepare_content_refresh (CamelFolder *folder)
+m365_folder_prepare_content_refresh (CamelFolder *folder)
{
- g_return_if_fail (CAMEL_IS_O365_FOLDER (folder));
+ g_return_if_fail (CAMEL_IS_M365_FOLDER (folder));
- camel_o365_folder_summary_set_delta_link (CAMEL_O365_FOLDER_SUMMARY (camel_folder_get_folder_summary
(folder)), NULL);
+ camel_m365_folder_summary_set_delta_link (CAMEL_M365_FOLDER_SUMMARY (camel_folder_get_folder_summary
(folder)), NULL);
}
static gchar *
-o365_folder_get_filename (CamelFolder *folder,
+m365_folder_get_filename (CamelFolder *folder,
const gchar *uid,
GError **error)
{
- CamelO365Folder *o365_folder = CAMEL_O365_FOLDER (folder);
+ CamelM365Folder *m365_folder = CAMEL_M365_FOLDER (folder);
- return o365_folder_cache_dup_filename (o365_folder, uid);
+ return m365_folder_cache_dup_filename (m365_folder, uid);
}
static void
-o365_folder_constructed (GObject *object)
+m365_folder_constructed (GObject *object)
{
CamelSettings *settings;
CamelStore *parent_store;
@@ -1595,7 +1584,7 @@ o365_folder_constructed (GObject *object)
gchar *user;
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_folder_parent_class)->constructed (object);
+ G_OBJECT_CLASS (camel_m365_folder_parent_class)->constructed (object);
folder = CAMEL_FOLDER (object);
full_name = camel_folder_get_full_name (folder);
@@ -1608,7 +1597,7 @@ o365_folder_constructed (GObject *object)
g_object_unref (settings);
- description = g_strdup_printf ("%s@Office365:%s", user, full_name);
+ description = g_strdup_printf ("%s@Microsoft365:%s", user, full_name);
camel_folder_set_description (folder, description);
g_free (description);
@@ -1616,109 +1605,109 @@ o365_folder_constructed (GObject *object)
}
static void
-o365_folder_dispose (GObject *object)
+m365_folder_dispose (GObject *object)
{
- CamelO365Folder *o365_folder = CAMEL_O365_FOLDER (object);
+ CamelM365Folder *m365_folder = CAMEL_M365_FOLDER (object);
CamelFolderSummary *summary;
- summary = camel_folder_get_folder_summary (CAMEL_FOLDER (o365_folder));
+ summary = camel_folder_get_folder_summary (CAMEL_FOLDER (m365_folder));
if (summary)
- o365_folder_save_summary (o365_folder);
+ m365_folder_save_summary (m365_folder);
- LOCK_CACHE (o365_folder);
- g_clear_object (&o365_folder->priv->cache);
- UNLOCK_CACHE (o365_folder);
+ LOCK_CACHE (m365_folder);
+ g_clear_object (&m365_folder->priv->cache);
+ UNLOCK_CACHE (m365_folder);
- LOCK_SEARCH (o365_folder);
- g_clear_object (&o365_folder->priv->search);
- UNLOCK_SEARCH (o365_folder);
+ LOCK_SEARCH (m365_folder);
+ g_clear_object (&m365_folder->priv->search);
+ UNLOCK_SEARCH (m365_folder);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_folder_parent_class)->dispose (object);
+ G_OBJECT_CLASS (camel_m365_folder_parent_class)->dispose (object);
}
static void
-o365_folder_finalize (GObject *object)
+m365_folder_finalize (GObject *object)
{
- CamelO365Folder *o365_folder = CAMEL_O365_FOLDER (object);
+ CamelM365Folder *m365_folder = CAMEL_M365_FOLDER (object);
- g_rec_mutex_clear (&o365_folder->priv->cache_lock);
- g_mutex_clear (&o365_folder->priv->search_lock);
- g_mutex_clear (&o365_folder->priv->get_message_lock);
- g_cond_clear (&o365_folder->priv->get_message_cond);
+ g_rec_mutex_clear (&m365_folder->priv->cache_lock);
+ g_mutex_clear (&m365_folder->priv->search_lock);
+ g_mutex_clear (&m365_folder->priv->get_message_lock);
+ g_cond_clear (&m365_folder->priv->get_message_cond);
- g_hash_table_destroy (o365_folder->priv->get_message_hash);
+ g_hash_table_destroy (m365_folder->priv->get_message_hash);
- g_clear_pointer (&o365_folder->priv->id, g_free);
+ g_clear_pointer (&m365_folder->priv->id, g_free);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_folder_parent_class)->finalize (object);
+ G_OBJECT_CLASS (camel_m365_folder_parent_class)->finalize (object);
}
static void
-camel_o365_folder_class_init (CamelO365FolderClass *klass)
+camel_m365_folder_class_init (CamelM365FolderClass *klass)
{
GObjectClass *object_class;
CamelFolderClass *folder_class;
object_class = G_OBJECT_CLASS (klass);
- object_class->constructed = o365_folder_constructed;
- object_class->dispose = o365_folder_dispose;
- object_class->finalize = o365_folder_finalize;
+ object_class->constructed = m365_folder_constructed;
+ object_class->dispose = m365_folder_dispose;
+ object_class->finalize = m365_folder_finalize;
folder_class = CAMEL_FOLDER_CLASS (klass);
- folder_class->get_permanent_flags = o365_folder_get_permanent_flags;
- folder_class->get_message_cached = o365_folder_get_message_cached;
- folder_class->search_by_expression = o365_folder_search_by_expression;
- folder_class->count_by_expression = o365_folder_count_by_expression;
- folder_class->search_by_uids = o365_folder_search_by_uids;
- folder_class->search_free = o365_folder_search_free;
- folder_class->cmp_uids = o365_folder_cmp_uids;
- folder_class->append_message_sync = o365_folder_append_message_sync;
- folder_class->get_message_sync = o365_folder_get_message_sync;
- folder_class->refresh_info_sync = o365_folder_refresh_info_sync;
- folder_class->synchronize_sync = o365_folder_synchronize_sync;
- folder_class->expunge_sync = o365_folder_expunge_sync;
- folder_class->transfer_messages_to_sync = o365_folder_transfer_messages_to_sync;
- folder_class->prepare_content_refresh = o365_folder_prepare_content_refresh;
- folder_class->get_filename = o365_folder_get_filename;
+ folder_class->get_permanent_flags = m365_folder_get_permanent_flags;
+ folder_class->get_message_cached = m365_folder_get_message_cached;
+ folder_class->search_by_expression = m365_folder_search_by_expression;
+ folder_class->count_by_expression = m365_folder_count_by_expression;
+ folder_class->search_by_uids = m365_folder_search_by_uids;
+ folder_class->search_free = m365_folder_search_free;
+ folder_class->cmp_uids = m365_folder_cmp_uids;
+ folder_class->append_message_sync = m365_folder_append_message_sync;
+ folder_class->get_message_sync = m365_folder_get_message_sync;
+ folder_class->refresh_info_sync = m365_folder_refresh_info_sync;
+ folder_class->synchronize_sync = m365_folder_synchronize_sync;
+ folder_class->expunge_sync = m365_folder_expunge_sync;
+ folder_class->transfer_messages_to_sync = m365_folder_transfer_messages_to_sync;
+ folder_class->prepare_content_refresh = m365_folder_prepare_content_refresh;
+ folder_class->get_filename = m365_folder_get_filename;
}
static void
-camel_o365_folder_init (CamelO365Folder *o365_folder)
+camel_m365_folder_init (CamelM365Folder *m365_folder)
{
- CamelFolder *folder = CAMEL_FOLDER (o365_folder);
+ CamelFolder *folder = CAMEL_FOLDER (m365_folder);
- o365_folder->priv = camel_o365_folder_get_instance_private (o365_folder);
+ m365_folder->priv = camel_m365_folder_get_instance_private (m365_folder);
- g_rec_mutex_init (&o365_folder->priv->cache_lock);
- g_mutex_init (&o365_folder->priv->search_lock);
- g_mutex_init (&o365_folder->priv->get_message_lock);
- g_cond_init (&o365_folder->priv->get_message_cond);
+ g_rec_mutex_init (&m365_folder->priv->cache_lock);
+ g_mutex_init (&m365_folder->priv->search_lock);
+ g_mutex_init (&m365_folder->priv->get_message_lock);
+ g_cond_init (&m365_folder->priv->get_message_cond);
- o365_folder->priv->get_message_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ m365_folder->priv->get_message_hash = g_hash_table_new (g_str_hash, g_str_equal);
camel_folder_set_flags (folder, CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY);
camel_folder_set_lock_async (folder, TRUE);
}
static gboolean
-o365_folder_has_inbox_type (CamelO365Store *o365_store,
+m365_folder_has_inbox_type (CamelM365Store *m365_store,
const gchar *full_name)
{
- CamelO365StoreSummary *summary;
+ CamelM365StoreSummary *summary;
guint32 flags;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (o365_store), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (m365_store), FALSE);
g_return_val_if_fail (full_name != NULL, FALSE);
- summary = camel_o365_store_ref_store_summary (o365_store);
+ summary = camel_m365_store_ref_store_summary (m365_store);
if (!summary)
return FALSE;
- flags = camel_o365_store_summary_get_folder_flags_for_full_name (summary, full_name);
+ flags = camel_m365_store_summary_get_folder_flags_for_full_name (summary, full_name);
g_object_unref (summary);
@@ -1726,7 +1715,7 @@ o365_folder_has_inbox_type (CamelO365Store *o365_store,
}
CamelFolder *
-camel_o365_folder_new (CamelStore *store,
+camel_m365_folder_new (CamelStore *store,
const gchar *display_name,
const gchar *full_name,
const gchar *folder_dir,
@@ -1735,8 +1724,8 @@ camel_o365_folder_new (CamelStore *store,
{
CamelFolder *folder;
CamelFolderSummary *folder_summary;
- CamelO365Folder *o365_folder;
- CamelO365StoreSummary *o365_store_summary;
+ CamelM365Folder *m365_folder;
+ CamelM365StoreSummary *m365_store_summary;
CamelSettings *settings;
gboolean filter_inbox = FALSE;
gboolean filter_junk = FALSE;
@@ -1748,9 +1737,9 @@ camel_o365_folder_new (CamelStore *store,
gchar *state_file;
gchar *folder_id;
- o365_store_summary = camel_o365_store_ref_store_summary (CAMEL_O365_STORE (store));
- folder_id = camel_o365_store_summary_dup_folder_id_for_full_name (o365_store_summary, full_name);
- g_clear_object (&o365_store_summary);
+ m365_store_summary = camel_m365_store_ref_store_summary (CAMEL_M365_STORE (store));
+ folder_id = camel_m365_store_summary_dup_folder_id_for_full_name (m365_store_summary, full_name);
+ g_clear_object (&m365_store_summary);
if (!folder_id) {
g_set_error (error, CAMEL_FOLDER_ERROR, CAMEL_FOLDER_ERROR_INVALID_PATH,
@@ -1758,16 +1747,16 @@ camel_o365_folder_new (CamelStore *store,
return NULL;
}
- folder = g_object_new (CAMEL_TYPE_O365_FOLDER,
+ folder = g_object_new (CAMEL_TYPE_M365_FOLDER,
"display_name", display_name,
"full-name", full_name,
"parent_store", store,
NULL);
- o365_folder = CAMEL_O365_FOLDER (folder);
- o365_folder->priv->id = folder_id;
+ m365_folder = CAMEL_M365_FOLDER (folder);
+ m365_folder->priv->id = folder_id;
- folder_summary = camel_o365_folder_summary_new (folder);
+ folder_summary = camel_m365_folder_summary_new (folder);
if (!folder_summary) {
g_object_unref (folder);
@@ -1799,8 +1788,8 @@ camel_o365_folder_new (CamelStore *store,
camel_object_state_read (CAMEL_OBJECT (folder));
g_free (state_file);
- o365_folder->priv->cache = camel_data_cache_new (folder_dir, error);
- if (!o365_folder->priv->cache) {
+ m365_folder->priv->cache = camel_data_cache_new (folder_dir, error);
+ if (!m365_folder->priv->cache) {
g_object_unref (folder);
return NULL;
}
@@ -1816,19 +1805,19 @@ camel_o365_folder_new (CamelStore *store,
/* Ensure cache will expire when set up, otherwise
* it causes redownload of messages too soon. */
- camel_data_cache_set_expire_age (o365_folder->priv->cache, when);
- camel_data_cache_set_expire_access (o365_folder->priv->cache, when);
+ camel_data_cache_set_expire_age (m365_folder->priv->cache, when);
+ camel_data_cache_set_expire_access (m365_folder->priv->cache, when);
} else {
/* Set cache expiration for one week. */
- camel_data_cache_set_expire_age (o365_folder->priv->cache, 60 * 60 * 24 * 7);
- camel_data_cache_set_expire_access (o365_folder->priv->cache, 60 * 60 * 24 * 7);
+ camel_data_cache_set_expire_age (m365_folder->priv->cache, 60 * 60 * 24 * 7);
+ camel_data_cache_set_expire_access (m365_folder->priv->cache, 60 * 60 * 24 * 7);
}
camel_binding_bind_property (store, "online",
- o365_folder->priv->cache, "expire-enabled",
+ m365_folder->priv->cache, "expire-enabled",
G_BINDING_SYNC_CREATE);
- if (o365_folder_has_inbox_type (CAMEL_O365_STORE (store), full_name)) {
+ if (m365_folder_has_inbox_type (CAMEL_M365_STORE (store), full_name)) {
if (filter_inbox)
add_folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
@@ -1842,17 +1831,17 @@ camel_o365_folder_new (CamelStore *store,
if (add_folder_flags)
camel_folder_set_flags (folder, camel_folder_get_flags (folder) | add_folder_flags);
- camel_o365_store_connect_folder_summary (CAMEL_O365_STORE (store), folder_summary);
+ camel_m365_store_connect_folder_summary (CAMEL_M365_STORE (store), folder_summary);
- o365_folder->priv->search = camel_folder_search_new ();
+ m365_folder->priv->search = camel_folder_search_new ();
return folder;
}
const gchar *
-camel_o365_folder_get_id (CamelO365Folder *o365_folder)
+camel_m365_folder_get_id (CamelM365Folder *m365_folder)
{
- g_return_val_if_fail (CAMEL_IS_O365_FOLDER (o365_folder), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_FOLDER (m365_folder), NULL);
- return o365_folder->priv->id;
+ return m365_folder->priv->id;
}
diff --git a/src/Microsoft365/camel/camel-m365-folder.h b/src/Microsoft365/camel/camel-m365-folder.h
new file mode 100644
index 00000000..c2463839
--- /dev/null
+++ b/src/Microsoft365/camel/camel-m365-folder.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef CAMEL_M365_FOLDER_H
+#define CAMEL_M365_FOLDER_H
+
+#include <camel/camel.h>
+
+#include "camel-m365-folder-summary.h"
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_M365_FOLDER \
+ (camel_m365_folder_get_type ())
+#define CAMEL_M365_FOLDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_M365_FOLDER, CamelM365Folder))
+#define CAMEL_M365_FOLDER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_M365_FOLDER, CamelM365FolderClass))
+#define CAMEL_IS_M365_FOLDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_M365_FOLDER))
+#define CAMEL_IS_M365_FOLDER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_M365_FOLDER))
+#define CAMEL_M365_FOLDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_M365_FOLDER, CamelM365FolderClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelM365Folder CamelM365Folder;
+typedef struct _CamelM365FolderClass CamelM365FolderClass;
+typedef struct _CamelM365FolderPrivate CamelM365FolderPrivate;
+
+struct _CamelM365Folder {
+ CamelOfflineFolder parent;
+ CamelM365FolderPrivate *priv;
+};
+
+struct _CamelM365FolderClass {
+ CamelOfflineFolderClass parent_class;
+};
+
+GType camel_m365_folder_get_type (void);
+
+CamelFolder * camel_m365_folder_new (CamelStore *store,
+ const gchar *display_name,
+ const gchar *full_name,
+ const gchar *folder_dir,
+ GCancellable *cancellable,
+ GError **error);
+const gchar * camel_m365_folder_get_id (CamelM365Folder *m365_folder);
+
+G_END_DECLS
+
+#endif /* CAMEL_M365_FOLDER_H */
diff --git a/src/Office365/camel/camel-o365-message-info.c b/src/Microsoft365/camel/camel-m365-message-info.c
similarity index 54%
rename from src/Office365/camel/camel-o365-message-info.c
rename to src/Microsoft365/camel/camel-m365-message-info.c
index 9d738624..453ef492 100644
--- a/src/Office365/camel/camel-o365-message-info.c
+++ b/src/Microsoft365/camel/camel-m365-message-info.c
@@ -1,18 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
@@ -21,9 +10,9 @@
#include "camel/camel.h"
-#include "camel-o365-message-info.h"
+#include "camel-m365-message-info.h"
-struct _CamelO365MessageInfoPrivate {
+struct _CamelM365MessageInfoPrivate {
guint32 server_flags;
gint32 item_type;
gchar *change_key;
@@ -36,50 +25,50 @@ enum {
PROP_CHANGE_KEY,
};
-G_DEFINE_TYPE_WITH_PRIVATE (CamelO365MessageInfo, camel_o365_message_info, CAMEL_TYPE_MESSAGE_INFO_BASE)
+G_DEFINE_TYPE_WITH_PRIVATE (CamelM365MessageInfo, camel_m365_message_info, CAMEL_TYPE_MESSAGE_INFO_BASE)
static CamelMessageInfo *
-o365_message_info_clone (const CamelMessageInfo *mi,
+m365_message_info_clone (const CamelMessageInfo *mi,
CamelFolderSummary *assign_summary)
{
CamelMessageInfo *result;
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (mi), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (mi), NULL);
- result = CAMEL_MESSAGE_INFO_CLASS (camel_o365_message_info_parent_class)->clone (mi, assign_summary);
+ result = CAMEL_MESSAGE_INFO_CLASS (camel_m365_message_info_parent_class)->clone (mi, assign_summary);
if (!result)
return NULL;
- if (CAMEL_IS_O365_MESSAGE_INFO (result)) {
- CamelO365MessageInfo *omi, *omi_result;
+ if (CAMEL_IS_M365_MESSAGE_INFO (result)) {
+ CamelM365MessageInfo *omi, *omi_result;
- omi = CAMEL_O365_MESSAGE_INFO (mi);
- omi_result = CAMEL_O365_MESSAGE_INFO (result);
+ omi = CAMEL_M365_MESSAGE_INFO (mi);
+ omi_result = CAMEL_M365_MESSAGE_INFO (result);
- camel_o365_message_info_set_server_flags (omi_result,
camel_o365_message_info_get_server_flags (omi));
- camel_o365_message_info_set_item_type (omi_result, camel_o365_message_info_get_item_type
(omi));
- camel_o365_message_info_take_change_key (omi_result, camel_o365_message_info_dup_change_key
(omi));
+ camel_m365_message_info_set_server_flags (omi_result,
camel_m365_message_info_get_server_flags (omi));
+ camel_m365_message_info_set_item_type (omi_result, camel_m365_message_info_get_item_type
(omi));
+ camel_m365_message_info_take_change_key (omi_result, camel_m365_message_info_dup_change_key
(omi));
}
return result;
}
static gboolean
-o365_message_info_load (CamelMessageInfo *mi,
+m365_message_info_load (CamelMessageInfo *mi,
const CamelMIRecord *record,
/* const */ gchar **bdata_ptr)
{
- CamelO365MessageInfo *omi;
+ CamelM365MessageInfo *omi;
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (mi), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (mi), FALSE);
g_return_val_if_fail (record != NULL, FALSE);
g_return_val_if_fail (bdata_ptr != NULL, FALSE);
- if (!CAMEL_MESSAGE_INFO_CLASS (camel_o365_message_info_parent_class)->load ||
- !CAMEL_MESSAGE_INFO_CLASS (camel_o365_message_info_parent_class)->load (mi, record, bdata_ptr))
+ if (!CAMEL_MESSAGE_INFO_CLASS (camel_m365_message_info_parent_class)->load ||
+ !CAMEL_MESSAGE_INFO_CLASS (camel_m365_message_info_parent_class)->load (mi, record, bdata_ptr))
return FALSE;
- omi = CAMEL_O365_MESSAGE_INFO (mi);
+ omi = CAMEL_M365_MESSAGE_INFO (mi);
if (*bdata_ptr) {
gchar **values;
@@ -87,9 +76,9 @@ o365_message_info_load (CamelMessageInfo *mi,
values = g_strsplit (*bdata_ptr, " ", -1);
if (values && values[0] && values[1] && values[2]) {
- camel_o365_message_info_set_server_flags (omi, g_ascii_strtoll (values[0], NULL, 10));
- camel_o365_message_info_set_item_type (omi, g_ascii_strtoll (values[1], NULL, 10));
- camel_o365_message_info_set_change_key (omi, values[2]);
+ camel_m365_message_info_set_server_flags (omi, g_ascii_strtoll (values[0], NULL, 10));
+ camel_m365_message_info_set_item_type (omi, g_ascii_strtoll (values[1], NULL, 10));
+ camel_m365_message_info_set_change_key (omi, values[2]);
}
g_strfreev (values);
@@ -99,49 +88,49 @@ o365_message_info_load (CamelMessageInfo *mi,
}
static gboolean
-o365_message_info_save (const CamelMessageInfo *mi,
+m365_message_info_save (const CamelMessageInfo *mi,
CamelMIRecord *record,
GString *bdata_str)
{
- CamelO365MessageInfo *omi;
+ CamelM365MessageInfo *omi;
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (mi), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (mi), FALSE);
g_return_val_if_fail (record != NULL, FALSE);
g_return_val_if_fail (bdata_str != NULL, FALSE);
- if (!CAMEL_MESSAGE_INFO_CLASS (camel_o365_message_info_parent_class)->save ||
- !CAMEL_MESSAGE_INFO_CLASS (camel_o365_message_info_parent_class)->save (mi, record, bdata_str))
+ if (!CAMEL_MESSAGE_INFO_CLASS (camel_m365_message_info_parent_class)->save ||
+ !CAMEL_MESSAGE_INFO_CLASS (camel_m365_message_info_parent_class)->save (mi, record, bdata_str))
return FALSE;
- omi = CAMEL_O365_MESSAGE_INFO (mi);
+ omi = CAMEL_M365_MESSAGE_INFO (mi);
g_string_append_printf (bdata_str, "%u %d %s",
- camel_o365_message_info_get_server_flags (omi),
- camel_o365_message_info_get_item_type (omi),
- camel_o365_message_info_get_change_key (omi));
+ camel_m365_message_info_get_server_flags (omi),
+ camel_m365_message_info_get_item_type (omi),
+ camel_m365_message_info_get_change_key (omi));
return TRUE;
}
static void
-o365_message_info_set_property (GObject *object,
+m365_message_info_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
- CamelO365MessageInfo *omi = CAMEL_O365_MESSAGE_INFO (object);
+ CamelM365MessageInfo *omi = CAMEL_M365_MESSAGE_INFO (object);
switch (property_id) {
case PROP_SERVER_FLAGS:
- camel_o365_message_info_set_server_flags (omi, g_value_get_uint (value));
+ camel_m365_message_info_set_server_flags (omi, g_value_get_uint (value));
return;
case PROP_ITEM_TYPE:
- camel_o365_message_info_set_item_type (omi, g_value_get_int (value));
+ camel_m365_message_info_set_item_type (omi, g_value_get_int (value));
return;
case PROP_CHANGE_KEY:
- camel_o365_message_info_set_change_key (omi, g_value_get_string (value));
+ camel_m365_message_info_set_change_key (omi, g_value_get_string (value));
return;
}
@@ -149,25 +138,25 @@ o365_message_info_set_property (GObject *object,
}
static void
-o365_message_info_get_property (GObject *object,
+m365_message_info_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
- CamelO365MessageInfo *omi = CAMEL_O365_MESSAGE_INFO (object);
+ CamelM365MessageInfo *omi = CAMEL_M365_MESSAGE_INFO (object);
switch (property_id) {
case PROP_SERVER_FLAGS:
- g_value_set_uint (value, camel_o365_message_info_get_server_flags (omi));
+ g_value_set_uint (value, camel_m365_message_info_get_server_flags (omi));
return;
case PROP_ITEM_TYPE:
- g_value_set_int (value, camel_o365_message_info_get_item_type (omi));
+ g_value_set_int (value, camel_m365_message_info_get_item_type (omi));
return;
case PROP_CHANGE_KEY:
- g_value_take_string (value, camel_o365_message_info_dup_change_key (omi));
+ g_value_take_string (value, camel_m365_message_info_dup_change_key (omi));
return;
}
@@ -175,35 +164,35 @@ o365_message_info_get_property (GObject *object,
}
static void
-o365_message_info_dispose (GObject *object)
+m365_message_info_dispose (GObject *object)
{
- CamelO365MessageInfo *omi = CAMEL_O365_MESSAGE_INFO (object);
+ CamelM365MessageInfo *omi = CAMEL_M365_MESSAGE_INFO (object);
g_free (omi->priv->change_key);
omi->priv->change_key = NULL;
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_message_info_parent_class)->dispose (object);
+ G_OBJECT_CLASS (camel_m365_message_info_parent_class)->dispose (object);
}
static void
-camel_o365_message_info_class_init (CamelO365MessageInfoClass *class)
+camel_m365_message_info_class_init (CamelM365MessageInfoClass *class)
{
CamelMessageInfoClass *mi_class;
GObjectClass *object_class;
mi_class = CAMEL_MESSAGE_INFO_CLASS (class);
- mi_class->clone = o365_message_info_clone;
- mi_class->load = o365_message_info_load;
- mi_class->save = o365_message_info_save;
+ mi_class->clone = m365_message_info_clone;
+ mi_class->load = m365_message_info_load;
+ mi_class->save = m365_message_info_save;
object_class = G_OBJECT_CLASS (class);
- object_class->set_property = o365_message_info_set_property;
- object_class->get_property = o365_message_info_get_property;
- object_class->dispose = o365_message_info_dispose;
+ object_class->set_property = m365_message_info_set_property;
+ object_class->get_property = m365_message_info_get_property;
+ object_class->dispose = m365_message_info_dispose;
/*
- * CamelO365MessageInfo:server-flags
+ * CamelM365MessageInfo:server-flags
*
* Last known server flags of the message.
*/
@@ -218,7 +207,7 @@ camel_o365_message_info_class_init (CamelO365MessageInfoClass *class)
G_PARAM_READWRITE));
/*
- * CamelO365MessageInfo:item-type
+ * CamelM365MessageInfo:item-type
*
* Item type of the message.
*/
@@ -233,7 +222,7 @@ camel_o365_message_info_class_init (CamelO365MessageInfoClass *class)
G_PARAM_READWRITE));
/*
- * CamelO365MessageInfo:change-key
+ * CamelM365MessageInfo:change-key
*
* Change key of the message on the server.
*/
@@ -249,18 +238,18 @@ camel_o365_message_info_class_init (CamelO365MessageInfoClass *class)
}
static void
-camel_o365_message_info_init (CamelO365MessageInfo *omi)
+camel_m365_message_info_init (CamelM365MessageInfo *omi)
{
- omi->priv = camel_o365_message_info_get_instance_private (omi);
+ omi->priv = camel_m365_message_info_get_instance_private (omi);
}
guint32
-camel_o365_message_info_get_server_flags (const CamelO365MessageInfo *omi)
+camel_m365_message_info_get_server_flags (const CamelM365MessageInfo *omi)
{
CamelMessageInfo *mi;
guint32 result;
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (omi), 0);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (omi), 0);
mi = CAMEL_MESSAGE_INFO (omi);
@@ -272,13 +261,13 @@ camel_o365_message_info_get_server_flags (const CamelO365MessageInfo *omi)
}
gboolean
-camel_o365_message_info_set_server_flags (CamelO365MessageInfo *omi,
+camel_m365_message_info_set_server_flags (CamelM365MessageInfo *omi,
guint32 server_flags)
{
CamelMessageInfo *mi;
gboolean changed;
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (omi), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (omi), FALSE);
mi = CAMEL_MESSAGE_INFO (omi);
@@ -300,12 +289,12 @@ camel_o365_message_info_set_server_flags (CamelO365MessageInfo *omi,
}
gint32
-camel_o365_message_info_get_item_type (const CamelO365MessageInfo *omi)
+camel_m365_message_info_get_item_type (const CamelM365MessageInfo *omi)
{
CamelMessageInfo *mi;
gint32 result;
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (omi), 0);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (omi), 0);
mi = CAMEL_MESSAGE_INFO (omi);
@@ -317,13 +306,13 @@ camel_o365_message_info_get_item_type (const CamelO365MessageInfo *omi)
}
gboolean
-camel_o365_message_info_set_item_type (CamelO365MessageInfo *omi,
+camel_m365_message_info_set_item_type (CamelM365MessageInfo *omi,
gint32 item_type)
{
CamelMessageInfo *mi;
gboolean changed;
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (omi), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (omi), FALSE);
mi = CAMEL_MESSAGE_INFO (omi);
@@ -345,12 +334,12 @@ camel_o365_message_info_set_item_type (CamelO365MessageInfo *omi,
}
const gchar *
-camel_o365_message_info_get_change_key (const CamelO365MessageInfo *omi)
+camel_m365_message_info_get_change_key (const CamelM365MessageInfo *omi)
{
CamelMessageInfo *mi;
const gchar *result;
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (omi), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (omi), NULL);
mi = CAMEL_MESSAGE_INFO (omi);
@@ -362,12 +351,12 @@ camel_o365_message_info_get_change_key (const CamelO365MessageInfo *omi)
}
gchar *
-camel_o365_message_info_dup_change_key (const CamelO365MessageInfo *omi)
+camel_m365_message_info_dup_change_key (const CamelM365MessageInfo *omi)
{
CamelMessageInfo *mi;
gchar *result;
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (omi), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (omi), NULL);
mi = CAMEL_MESSAGE_INFO (omi);
@@ -379,22 +368,22 @@ camel_o365_message_info_dup_change_key (const CamelO365MessageInfo *omi)
}
gboolean
-camel_o365_message_info_set_change_key (CamelO365MessageInfo *omi,
+camel_m365_message_info_set_change_key (CamelM365MessageInfo *omi,
const gchar *change_key)
{
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (omi), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (omi), FALSE);
- return camel_o365_message_info_take_change_key (omi, g_strdup (change_key));
+ return camel_m365_message_info_take_change_key (omi, g_strdup (change_key));
}
gboolean
-camel_o365_message_info_take_change_key (CamelO365MessageInfo *omi,
+camel_m365_message_info_take_change_key (CamelM365MessageInfo *omi,
gchar *change_key)
{
CamelMessageInfo *mi;
gboolean changed;
- g_return_val_if_fail (CAMEL_IS_O365_MESSAGE_INFO (omi), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_MESSAGE_INFO (omi), FALSE);
mi = CAMEL_MESSAGE_INFO (omi);
diff --git a/src/Microsoft365/camel/camel-m365-message-info.h
b/src/Microsoft365/camel/camel-m365-message-info.h
new file mode 100644
index 00000000..a0c65dc1
--- /dev/null
+++ b/src/Microsoft365/camel/camel-m365-message-info.h
@@ -0,0 +1,70 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef CAMEL_M365_MESSAGE_INFO_H
+#define CAMEL_M365_MESSAGE_INFO_H
+
+#include <glib-object.h>
+
+#include <camel/camel.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_M365_MESSAGE_INFO \
+ (camel_m365_message_info_get_type ())
+#define CAMEL_M365_MESSAGE_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_M365_MESSAGE_INFO, CamelM365MessageInfo))
+#define CAMEL_M365_MESSAGE_INFO_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_M365_MESSAGE_INFO, CamelM365MessageInfoClass))
+#define CAMEL_IS_M365_MESSAGE_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_M365_MESSAGE_INFO))
+#define CAMEL_IS_M365_MESSAGE_INFO_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_M365_MESSAGE_INFO))
+#define CAMEL_M365_MESSAGE_INFO_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_M365_MESSAGE_INFO, CamelM365MessageInfoClass))
+
+G_BEGIN_DECLS
+
+/* extra summary flags*/
+enum {
+ CAMEL_M365_MESSAGE_MSGFLAG_RN_PENDING = CAMEL_MESSAGE_FOLDER_FLAGGED << 1
+};
+
+typedef struct _CamelM365MessageInfo CamelM365MessageInfo;
+typedef struct _CamelM365MessageInfoClass CamelM365MessageInfoClass;
+typedef struct _CamelM365MessageInfoPrivate CamelM365MessageInfoPrivate;
+
+struct _CamelM365MessageInfo {
+ CamelMessageInfoBase parent;
+ CamelM365MessageInfoPrivate *priv;
+};
+
+struct _CamelM365MessageInfoClass {
+ CamelMessageInfoBaseClass parent_class;
+};
+
+GType camel_m365_message_info_get_type (void);
+
+guint32 camel_m365_message_info_get_server_flags(const CamelM365MessageInfo *omi);
+gboolean camel_m365_message_info_set_server_flags(CamelM365MessageInfo *omi,
+ guint32 server_flags);
+gint32 camel_m365_message_info_get_item_type (const CamelM365MessageInfo *omi);
+gboolean camel_m365_message_info_set_item_type (CamelM365MessageInfo *omi,
+ gint32 item_type);
+const gchar * camel_m365_message_info_get_change_key (const CamelM365MessageInfo *omi);
+gchar * camel_m365_message_info_dup_change_key (const CamelM365MessageInfo *omi);
+gboolean camel_m365_message_info_set_change_key (CamelM365MessageInfo *omi,
+ const gchar *change_key);
+gboolean camel_m365_message_info_take_change_key (CamelM365MessageInfo *omi,
+ gchar *change_key);
+
+G_END_DECLS
+
+#endif /* CAMEL_M365_MESSAGE_INFO_H */
diff --git a/src/Office365/camel/camel-o365-provider.c b/src/Microsoft365/camel/camel-m365-provider.c
similarity index 60%
rename from src/Office365/camel/camel-o365-provider.c
rename to src/Microsoft365/camel/camel-m365-provider.c
index 72864f05..81a064dd 100644
--- a/src/Office365/camel/camel-o365-provider.c
+++ b/src/Microsoft365/camel/camel-m365-provider.c
@@ -1,18 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
@@ -22,16 +11,16 @@
#include <glib/gi18n-lib.h>
#include <gmodule.h>
-#include "common/camel-sasl-xoauth2-office365.h"
+#include "common/camel-sasl-xoauth2-microsoft365.h"
-#include "camel-o365-store.h"
-#include "camel-o365-transport.h"
+#include "camel-m365-store.h"
+#include "camel-m365-transport.h"
static void add_hash (guint *hash, gchar *s);
-static guint o365_url_hash (gconstpointer key);
-static gint o365_url_equal (gconstpointer a, gconstpointer b);
+static guint m365_url_hash (gconstpointer key);
+static gint m365_url_equal (gconstpointer a, gconstpointer b);
-static CamelProviderConfEntry o365_conf_entries[] = {
+static CamelProviderConfEntry m365_conf_entries[] = {
{ CAMEL_PROVIDER_CONF_SECTION_START, "mailcheck", NULL,
N_("Checking for new mail") },
{ CAMEL_PROVIDER_CONF_CHECKBOX, "check-all", NULL,
@@ -47,7 +36,7 @@ static CamelProviderConfEntry o365_conf_entries[] = {
N_("Only check for Junk messages in the IN_BOX folder"), "0" },
{ CAMEL_PROVIDER_CONF_CHECKBOX, "stay-synchronized", NULL,
N_("Synchroni_ze remote mail locally in all folders"), "0" },
- { CAMEL_PROVIDER_CONF_PLACEHOLDER, "o365-limit-by-age-placeholder", NULL },
+ { CAMEL_PROVIDER_CONF_PLACEHOLDER, "m365-limit-by-age-placeholder", NULL },
{ CAMEL_PROVIDER_CONF_SECTION_END },
{ CAMEL_PROVIDER_CONF_SECTION_START, "connection", NULL, N_("Connection") },
@@ -62,8 +51,8 @@ static CamelProviderConfEntry o365_conf_entries[] = {
{ CAMEL_PROVIDER_CONF_END }
};
-static CamelProvider o365_provider = {
- "office365",
+static CamelProvider m365_provider = {
+ "microsoft365",
N_("Microsoft 365"),
N_("For accessing Microsoft 365 server"),
@@ -75,7 +64,7 @@ static CamelProvider o365_provider = {
CAMEL_URL_ALLOW_USER | CAMEL_URL_ALLOW_AUTH | CAMEL_URL_HIDDEN_HOST,
- o365_conf_entries,
+ m365_conf_entries,
/* ... */
};
@@ -83,19 +72,19 @@ static CamelProvider o365_provider = {
void
camel_provider_module_init (void)
{
- bindtextdomain (GETTEXT_PACKAGE, O365_LOCALEDIR);
+ bindtextdomain (GETTEXT_PACKAGE, M365_LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- o365_provider.url_hash = o365_url_hash;
- o365_provider.url_equal = o365_url_equal;
- o365_provider.authtypes = NULL;
- o365_provider.translation_domain = GETTEXT_PACKAGE;
- o365_provider.object_types[CAMEL_PROVIDER_STORE] = CAMEL_TYPE_O365_STORE;
- o365_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = CAMEL_TYPE_O365_TRANSPORT;
+ m365_provider.url_hash = m365_url_hash;
+ m365_provider.url_equal = m365_url_equal;
+ m365_provider.authtypes = NULL;
+ m365_provider.translation_domain = GETTEXT_PACKAGE;
+ m365_provider.object_types[CAMEL_PROVIDER_STORE] = CAMEL_TYPE_M365_STORE;
+ m365_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = CAMEL_TYPE_M365_TRANSPORT;
- g_type_ensure (CAMEL_TYPE_SASL_XOAUTH2_OFFICE365);
+ g_type_ensure (CAMEL_TYPE_SASL_XOAUTH2_MICROSOFT365);
- camel_provider_register (&o365_provider);
+ camel_provider_register (&m365_provider);
}
static void
@@ -107,7 +96,7 @@ add_hash (guint *hash,
}
static guint
-o365_url_hash (gconstpointer key)
+m365_url_hash (gconstpointer key)
{
const CamelURL *u = (CamelURL *) key;
guint hash = 0;
@@ -120,7 +109,7 @@ o365_url_hash (gconstpointer key)
}
static gint
-o365_url_equal (gconstpointer a,
+m365_url_equal (gconstpointer a,
gconstpointer b)
{
const CamelURL *u1 = a, *u2 = b;
diff --git a/src/Office365/camel/camel-o365-store-summary.c
b/src/Microsoft365/camel/camel-m365-store-summary.c
similarity index 74%
rename from src/Office365/camel/camel-o365-store-summary.c
rename to src/Microsoft365/camel/camel-m365-store-summary.c
index 0428c707..7b340052 100644
--- a/src/Office365/camel/camel-o365-store-summary.c
+++ b/src/Microsoft365/camel/camel-m365-store-summary.c
@@ -1,25 +1,14 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
#include <string.h>
-#include "camel-o365-store-summary.h"
+#include "camel-m365-store-summary.h"
#define STORE_GROUP_NAME "##storepriv##"
#define CATEGORIES_KEY "Categories"
@@ -28,7 +17,7 @@
#define LOCK(_summary) g_rec_mutex_lock (&(_summary->priv->property_lock))
#define UNLOCK(_summary) g_rec_mutex_unlock (&(_summary->priv->property_lock))
-struct _CamelO365StoreSummaryPrivate {
+struct _CamelM365StoreSummaryPrivate {
GRecMutex property_lock;
gchar *filename;
GKeyFile *key_file;
@@ -42,10 +31,10 @@ struct _CamelO365StoreSummaryPrivate {
GHashTable *full_name_id_hash; /* folder full name ~> id */
};
-G_DEFINE_TYPE_WITH_PRIVATE (CamelO365StoreSummary, camel_o365_store_summary, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (CamelM365StoreSummary, camel_m365_store_summary, G_TYPE_OBJECT)
static gchar *
-o365_store_summary_encode_folder_name (const gchar *display_name)
+m365_store_summary_encode_folder_name (const gchar *display_name)
{
GString *encoded;
const gchar *pos;
@@ -67,7 +56,7 @@ o365_store_summary_encode_folder_name (const gchar *display_name)
#if 0
static gchar *
-o365_store_summary_decode_folder_name (gchar *pathpart)
+m365_store_summary_decode_folder_name (gchar *pathpart)
{
gchar *pos, *write_pos;
@@ -100,7 +89,7 @@ o365_store_summary_decode_folder_name (gchar *pathpart)
#endif
static void
-camel_o365_store_summary_migrate_data_locked (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_migrate_data_locked (CamelM365StoreSummary *store_summary,
gint from_version)
{
/* Here will be any future migration of old data in the summary to new data. */
@@ -109,34 +98,34 @@ camel_o365_store_summary_migrate_data_locked (CamelO365StoreSummary *store_summa
}
static void
-o365_store_summary_delete_cb (GFileMonitor *monitor,
+m365_store_summary_delete_cb (GFileMonitor *monitor,
GFile *file,
GFile *other_file,
GFileMonitorEvent event,
gpointer user_data)
{
- CamelO365StoreSummary *store_summary = user_data;
+ CamelM365StoreSummary *store_summary = user_data;
if (event == G_FILE_MONITOR_EVENT_DELETED) {
LOCK (store_summary);
if (store_summary->priv->key_file)
- camel_o365_store_summary_clear (store_summary);
+ camel_m365_store_summary_clear (store_summary);
UNLOCK (store_summary);
}
}
static void
-o365_store_summary_dispose (GObject *object)
+m365_store_summary_dispose (GObject *object)
{
- CamelO365StoreSummary *store_summary = CAMEL_O365_STORE_SUMMARY (object);
+ CamelM365StoreSummary *store_summary = CAMEL_M365_STORE_SUMMARY (object);
LOCK (store_summary);
if (store_summary->priv->monitor_delete) {
g_signal_handlers_disconnect_by_func (store_summary->priv->monitor_delete,
- G_CALLBACK (o365_store_summary_delete_cb), store_summary);
+ G_CALLBACK (m365_store_summary_delete_cb), store_summary);
g_clear_object (&store_summary->priv->monitor_delete);
}
@@ -144,13 +133,13 @@ o365_store_summary_dispose (GObject *object)
UNLOCK (store_summary);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_store_summary_parent_class)->dispose (object);
+ G_OBJECT_CLASS (camel_m365_store_summary_parent_class)->dispose (object);
}
static void
-o365_store_summary_finalize (GObject *object)
+m365_store_summary_finalize (GObject *object)
{
- CamelO365StoreSummary *store_summary = CAMEL_O365_STORE_SUMMARY (object);
+ CamelM365StoreSummary *store_summary = CAMEL_M365_STORE_SUMMARY (object);
g_rec_mutex_clear (&store_summary->priv->property_lock);
g_hash_table_destroy (store_summary->priv->full_name_id_hash);
@@ -159,23 +148,23 @@ o365_store_summary_finalize (GObject *object)
g_free (store_summary->priv->filename);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_store_summary_parent_class)->finalize (object);
+ G_OBJECT_CLASS (camel_m365_store_summary_parent_class)->finalize (object);
}
static void
-camel_o365_store_summary_class_init (CamelO365StoreSummaryClass *class)
+camel_m365_store_summary_class_init (CamelM365StoreSummaryClass *class)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (class);
- object_class->dispose = o365_store_summary_dispose;
- object_class->finalize = o365_store_summary_finalize;
+ object_class->dispose = m365_store_summary_dispose;
+ object_class->finalize = m365_store_summary_finalize;
}
static void
-camel_o365_store_summary_init (CamelO365StoreSummary *store_summary)
+camel_m365_store_summary_init (CamelM365StoreSummary *store_summary)
{
- store_summary->priv = camel_o365_store_summary_get_instance_private (store_summary);
+ store_summary->priv = camel_m365_store_summary_get_instance_private (store_summary);
store_summary->priv->key_file = g_key_file_new ();
store_summary->priv->id_full_name_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
g_free);
store_summary->priv->full_name_id_hash = g_hash_table_new (g_str_hash, g_str_equal); /* shared data
with 'id_full_name_hash' */
@@ -183,10 +172,10 @@ camel_o365_store_summary_init (CamelO365StoreSummary *store_summary)
g_rec_mutex_init (&store_summary->priv->property_lock);
}
-CamelO365StoreSummary *
-camel_o365_store_summary_new (const gchar *filename)
+CamelM365StoreSummary *
+camel_m365_store_summary_new (const gchar *filename)
{
- CamelO365StoreSummary *store_summary;
+ CamelM365StoreSummary *store_summary;
GError *error = NULL;
GFile *file;
@@ -194,14 +183,14 @@ camel_o365_store_summary_new (const gchar *filename)
file = g_file_new_for_path (filename);
- store_summary = g_object_new (CAMEL_TYPE_O365_STORE_SUMMARY, NULL);
+ store_summary = g_object_new (CAMEL_TYPE_M365_STORE_SUMMARY, NULL);
store_summary->priv->filename = g_strdup (filename);
store_summary->priv->monitor_delete = g_file_monitor_file (file, G_FILE_MONITOR_SEND_MOVED, NULL,
&error);
if (!error) {
g_signal_connect (
store_summary->priv->monitor_delete, "changed",
- G_CALLBACK (o365_store_summary_delete_cb), store_summary);
+ G_CALLBACK (m365_store_summary_delete_cb), store_summary);
} else {
g_warning ("%s: Failed to create monitor_delete: %s", G_STRFUNC, error->message);
g_clear_error (&error);
@@ -213,13 +202,13 @@ camel_o365_store_summary_new (const gchar *filename)
}
gboolean
-camel_o365_store_summary_load (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_load (CamelM365StoreSummary *store_summary,
GError **error)
{
gboolean success;
GError *local_error = NULL;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), FALSE);
LOCK (store_summary);
@@ -243,9 +232,9 @@ camel_o365_store_summary_load (CamelO365StoreSummary *store_summary,
version = g_key_file_get_integer (store_summary->priv->key_file, STORE_GROUP_NAME, "Version",
NULL);
if (version && version < DATA_VERSION)
- camel_o365_store_summary_migrate_data_locked (store_summary, version);
+ camel_m365_store_summary_migrate_data_locked (store_summary, version);
- camel_o365_store_summary_rebuild_hashes (store_summary);
+ camel_m365_store_summary_rebuild_hashes (store_summary);
}
UNLOCK (store_summary);
@@ -254,12 +243,12 @@ camel_o365_store_summary_load (CamelO365StoreSummary *store_summary,
}
gboolean
-camel_o365_store_summary_save (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_save (CamelM365StoreSummary *store_summary,
GError **error)
{
gboolean success = TRUE;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), FALSE);
LOCK (store_summary);
@@ -276,9 +265,9 @@ camel_o365_store_summary_save (CamelO365StoreSummary *store_summary,
}
void
-camel_o365_store_summary_clear (CamelO365StoreSummary *store_summary)
+camel_m365_store_summary_clear (CamelM365StoreSummary *store_summary)
{
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
LOCK (store_summary);
@@ -294,23 +283,23 @@ camel_o365_store_summary_clear (CamelO365StoreSummary *store_summary)
}
void
-camel_o365_store_summary_lock (CamelO365StoreSummary *store_summary)
+camel_m365_store_summary_lock (CamelM365StoreSummary *store_summary)
{
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
LOCK (store_summary);
}
void
-camel_o365_store_summary_unlock (CamelO365StoreSummary *store_summary)
+camel_m365_store_summary_unlock (CamelM365StoreSummary *store_summary)
{
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
UNLOCK (store_summary);
}
static void
-o365_store_summary_build_full_name (const gchar *id,
+m365_store_summary_build_full_name (const gchar *id,
GHashTable *id_folder_name,
GHashTable *id_parent_id,
GHashTable *covered,
@@ -328,7 +317,7 @@ o365_store_summary_build_full_name (const gchar *id,
parent_id = g_hash_table_lookup (id_parent_id, id);
if (parent_id && *parent_id && g_hash_table_contains (id_folder_name, parent_id))
- o365_store_summary_build_full_name (parent_id, id_folder_name, id_parent_id, covered,
inout_full_name);
+ m365_store_summary_build_full_name (parent_id, id_folder_name, id_parent_id, covered,
inout_full_name);
if (inout_full_name->len)
g_string_append_c (inout_full_name, '/');
@@ -337,14 +326,14 @@ o365_store_summary_build_full_name (const gchar *id,
}
void
-camel_o365_store_summary_rebuild_hashes (CamelO365StoreSummary *store_summary)
+camel_m365_store_summary_rebuild_hashes (CamelM365StoreSummary *store_summary)
{
GHashTable *id_folder_name;
GHashTable *id_parent_id;
gchar **groups;
gint ii;
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
LOCK (store_summary);
@@ -364,11 +353,11 @@ camel_o365_store_summary_rebuild_hashes (CamelO365StoreSummary *store_summary)
gchar *display_name, *folder_name;
display_name = g_key_file_get_string (store_summary->priv->key_file, group,
"DisplayName", NULL);
- folder_name = o365_store_summary_encode_folder_name (display_name);
+ folder_name = m365_store_summary_encode_folder_name (display_name);
g_hash_table_insert (id_folder_name, (gpointer) group, folder_name);
g_hash_table_insert (id_parent_id, (gpointer) group,
- camel_o365_store_summary_dup_folder_parent_id (store_summary, group));
+ camel_m365_store_summary_dup_folder_parent_id (store_summary, group));
g_free (display_name);
}
@@ -391,7 +380,7 @@ camel_o365_store_summary_rebuild_hashes (CamelO365StoreSummary *store_summary)
full_name_str = g_string_sized_new (16);
- o365_store_summary_build_full_name (id, id_folder_name, id_parent_id, covered,
full_name_str);
+ m365_store_summary_build_full_name (id, id_folder_name, id_parent_id, covered,
full_name_str);
if (full_name_str->len) {
gchar *id_dup = g_strdup (id);
@@ -415,10 +404,10 @@ camel_o365_store_summary_rebuild_hashes (CamelO365StoreSummary *store_summary)
}
void
-camel_o365_store_summary_set_delta_link (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_set_delta_link (CamelM365StoreSummary *store_summary,
const gchar *delta_link)
{
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
LOCK (store_summary);
@@ -430,11 +419,11 @@ camel_o365_store_summary_set_delta_link (CamelO365StoreSummary *store_summary,
}
gchar *
-camel_o365_store_summary_dup_delta_link (CamelO365StoreSummary *store_summary)
+camel_m365_store_summary_dup_delta_link (CamelM365StoreSummary *store_summary)
{
gchar *value;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), NULL);
LOCK (store_summary);
@@ -450,12 +439,12 @@ camel_o365_store_summary_dup_delta_link (CamelO365StoreSummary *store_summary)
}
gboolean
-camel_o365_store_summary_has_folder (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_has_folder (CamelM365StoreSummary *store_summary,
const gchar *id)
{
gboolean has;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), FALSE);
g_return_val_if_fail (id != NULL, FALSE);
LOCK (store_summary);
@@ -468,12 +457,12 @@ camel_o365_store_summary_has_folder (CamelO365StoreSummary *store_summary,
}
gboolean
-camel_o365_store_summary_has_full_name (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_has_full_name (CamelM365StoreSummary *store_summary,
const gchar *full_name)
{
gboolean has;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), FALSE);
g_return_val_if_fail (full_name != NULL, FALSE);
LOCK (store_summary);
@@ -486,12 +475,12 @@ camel_o365_store_summary_has_full_name (CamelO365StoreSummary *store_summary,
}
void
-camel_o365_store_summary_remove_folder (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_remove_folder (CamelM365StoreSummary *store_summary,
const gchar *id)
{
const gchar *full_name;
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
g_return_if_fail (id != NULL);
LOCK (store_summary);
@@ -512,7 +501,7 @@ camel_o365_store_summary_remove_folder (CamelO365StoreSummary *store_summary,
}
void
-camel_o365_store_summary_set_folder (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_set_folder (CamelM365StoreSummary *store_summary,
gboolean with_hashes_update,
const gchar *id,
const gchar *parent_id,
@@ -520,24 +509,24 @@ camel_o365_store_summary_set_folder (CamelO365StoreSummary *store_summary,
gint32 total_count,
gint32 unread_count,
guint32 flags,
- EO365FolderKind kind,
+ EM365FolderKind kind,
gboolean is_foreign,
gboolean is_public)
{
gboolean changed = FALSE;
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
g_return_if_fail (id != NULL);
g_return_if_fail (display_name != NULL);
LOCK (store_summary);
- camel_o365_store_summary_update_folder (store_summary, with_hashes_update, id, parent_id,
display_name, total_count, unread_count, -1);
+ camel_m365_store_summary_update_folder (store_summary, with_hashes_update, id, parent_id,
display_name, total_count, unread_count, -1);
- camel_o365_store_summary_set_folder_parent_id (store_summary, id, parent_id);
- camel_o365_store_summary_set_folder_total_count (store_summary, id, total_count);
- camel_o365_store_summary_set_folder_unread_count (store_summary, id, unread_count);
- camel_o365_store_summary_set_folder_flags (store_summary, id, flags);
+ camel_m365_store_summary_set_folder_parent_id (store_summary, id, parent_id);
+ camel_m365_store_summary_set_folder_total_count (store_summary, id, total_count);
+ camel_m365_store_summary_set_folder_unread_count (store_summary, id, unread_count);
+ camel_m365_store_summary_set_folder_flags (store_summary, id, flags);
if (g_key_file_get_integer (store_summary->priv->key_file, id, "Kind", NULL) != kind) {
g_key_file_set_integer (store_summary->priv->key_file, id, "Kind", kind);
@@ -555,7 +544,7 @@ camel_o365_store_summary_set_folder (CamelO365StoreSummary *store_summary,
}
/* Set display name as the last, because it updates internal hashes and depends on the stored data */
- camel_o365_store_summary_set_folder_display_name (store_summary, id, display_name,
with_hashes_update);
+ camel_m365_store_summary_set_folder_display_name (store_summary, id, display_name,
with_hashes_update);
if (changed)
store_summary->priv->dirty = TRUE;
@@ -564,7 +553,7 @@ camel_o365_store_summary_set_folder (CamelO365StoreSummary *store_summary,
}
void
-camel_o365_store_summary_update_folder (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_update_folder (CamelM365StoreSummary *store_summary,
gboolean with_hashes_update,
const gchar *id,
const gchar *parent_id,
@@ -573,33 +562,33 @@ camel_o365_store_summary_update_folder (CamelO365StoreSummary *store_summary,
gint32 unread_count,
gint32 children_count)
{
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
g_return_if_fail (id != NULL);
g_return_if_fail (display_name != NULL);
LOCK (store_summary);
- camel_o365_store_summary_set_folder_parent_id (store_summary, id, parent_id);
- camel_o365_store_summary_set_folder_total_count (store_summary, id, total_count);
- camel_o365_store_summary_set_folder_unread_count (store_summary, id, unread_count);
+ camel_m365_store_summary_set_folder_parent_id (store_summary, id, parent_id);
+ camel_m365_store_summary_set_folder_total_count (store_summary, id, total_count);
+ camel_m365_store_summary_set_folder_unread_count (store_summary, id, unread_count);
if (children_count != -1) {
- guint32 flags = camel_o365_store_summary_get_folder_flags (store_summary, id);
+ guint32 flags = camel_m365_store_summary_get_folder_flags (store_summary, id);
flags = (flags & (~(CAMEL_FOLDER_CHILDREN | CAMEL_FOLDER_NOCHILDREN))) |
(children_count ? CAMEL_FOLDER_CHILDREN : CAMEL_FOLDER_NOCHILDREN);
- camel_o365_store_summary_set_folder_flags (store_summary, id, flags);
+ camel_m365_store_summary_set_folder_flags (store_summary, id, flags);
}
/* Set display name as the last, because it updates internal hashes and depends on the stored data */
- camel_o365_store_summary_set_folder_display_name (store_summary, id, display_name,
with_hashes_update);
+ camel_m365_store_summary_set_folder_display_name (store_summary, id, display_name,
with_hashes_update);
UNLOCK (store_summary);
}
gboolean
-camel_o365_store_summary_get_folder (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_get_folder (CamelM365StoreSummary *store_summary,
const gchar *id,
gchar **out_full_name,
gchar **out_display_name,
@@ -607,13 +596,13 @@ camel_o365_store_summary_get_folder (CamelO365StoreSummary *store_summary,
gint32 *out_total_count,
gint32 *out_unread_count,
guint32 *out_flags,
- EO365FolderKind *out_kind,
+ EM365FolderKind *out_kind,
gboolean *out_is_foreign,
gboolean *out_is_public)
{
gboolean found;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), FALSE);
g_return_val_if_fail (id != NULL, FALSE);
LOCK (store_summary);
@@ -655,24 +644,24 @@ camel_o365_store_summary_get_folder (CamelO365StoreSummary *store_summary,
}
gchar *
-camel_o365_store_summary_dup_folder_full_name (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_dup_folder_full_name (CamelM365StoreSummary *store_summary,
const gchar *id)
{
gchar *value = NULL;
- if (!camel_o365_store_summary_get_folder (store_summary, id, &value, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL))
+ if (!camel_m365_store_summary_get_folder (store_summary, id, &value, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL))
value = NULL;
return value;
}
gchar *
-camel_o365_store_summary_dup_folder_id_for_full_name (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_dup_folder_id_for_full_name (CamelM365StoreSummary *store_summary,
const gchar *full_name)
{
gchar *id;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), NULL);
g_return_val_if_fail (full_name != NULL, NULL);
LOCK (store_summary);
@@ -685,14 +674,14 @@ camel_o365_store_summary_dup_folder_id_for_full_name (CamelO365StoreSummary *sto
}
gchar *
-camel_o365_store_summary_dup_folder_id_for_type (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_dup_folder_id_for_type (CamelM365StoreSummary *store_summary,
guint32 folder_type)
{
GHashTableIter iter;
gpointer key;
gchar *id = NULL;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), NULL);
folder_type = folder_type & CAMEL_FOLDER_TYPE_MASK;
g_return_val_if_fail (folder_type != 0, NULL);
@@ -704,7 +693,7 @@ camel_o365_store_summary_dup_folder_id_for_type (CamelO365StoreSummary *store_su
while (g_hash_table_iter_next (&iter, &key, NULL)) {
guint32 flags;
- flags = camel_o365_store_summary_get_folder_flags (store_summary, key);
+ flags = camel_m365_store_summary_get_folder_flags (store_summary, key);
if ((flags & CAMEL_FOLDER_TYPE_MASK) == folder_type) {
id = g_strdup (key);
@@ -755,7 +744,7 @@ typedef struct _RemovePrefixedData {
} RemovePrefixedData;
static gboolean
-o365_remove_prefixed_cb (gpointer key,
+m365_remove_prefixed_cb (gpointer key,
gpointer value,
gpointer user_data)
{
@@ -778,7 +767,7 @@ o365_remove_prefixed_cb (gpointer key,
}
static gchar *
-o365_store_summary_build_new_full_name (const gchar *old_full_name,
+m365_store_summary_build_new_full_name (const gchar *old_full_name,
const gchar *new_display_name)
{
gchar *encoded;
@@ -789,7 +778,7 @@ o365_store_summary_build_new_full_name (const gchar *old_full_name,
g_return_val_if_fail (new_display_name != NULL, NULL);
last_slash = strrchr (old_full_name, '/');
- encoded = o365_store_summary_encode_folder_name (new_display_name);
+ encoded = m365_store_summary_encode_folder_name (new_display_name);
full_name = g_string_sized_new ((last_slash ? (last_slash - old_full_name) : 0) + strlen (encoded) +
2);
if (last_slash)
@@ -803,7 +792,7 @@ o365_store_summary_build_new_full_name (const gchar *old_full_name,
}
gboolean
-camel_o365_store_summary_set_folder_display_name (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_set_folder_display_name (CamelM365StoreSummary *store_summary,
const gchar *id,
const gchar *display_name,
gboolean with_hashes_update)
@@ -811,7 +800,7 @@ camel_o365_store_summary_set_folder_display_name (CamelO365StoreSummary *store_s
gchar *current_display_name;
gboolean changed = FALSE;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), FALSE);
g_return_val_if_fail (id != NULL, FALSE);
g_return_val_if_fail (display_name != NULL, FALSE);
@@ -841,9 +830,9 @@ camel_o365_store_summary_set_folder_display_name (CamelO365StoreSummary *store_s
rpd.prefix_len = strlen (old_full_name);
rpd.removed = NULL;
- g_hash_table_foreach_steal (store_summary->priv->id_full_name_hash,
o365_remove_prefixed_cb, &rpd);
+ g_hash_table_foreach_steal (store_summary->priv->id_full_name_hash,
m365_remove_prefixed_cb, &rpd);
- new_full_name = o365_store_summary_build_new_full_name (old_full_name,
display_name);
+ new_full_name = m365_store_summary_build_new_full_name (old_full_name,
display_name);
diff = strlen (new_full_name) - rpd.prefix_len;
for (link = rpd.removed; link; link = g_slist_next (link)) {
@@ -874,9 +863,9 @@ camel_o365_store_summary_set_folder_display_name (CamelO365StoreSummary *store_s
} else {
gchar *parent_id, *encoded_folder_name, *id_copy, *new_full_name = NULL;
- encoded_folder_name = o365_store_summary_encode_folder_name (display_name);
+ encoded_folder_name = m365_store_summary_encode_folder_name (display_name);
- parent_id = camel_o365_store_summary_dup_folder_parent_id (store_summary, id);
+ parent_id = camel_m365_store_summary_dup_folder_parent_id (store_summary, id);
if (parent_id && *parent_id) {
const gchar *parent_full_name;
@@ -911,23 +900,23 @@ camel_o365_store_summary_set_folder_display_name (CamelO365StoreSummary *store_s
}
gchar *
-camel_o365_store_summary_dup_folder_display_name (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_dup_folder_display_name (CamelM365StoreSummary *store_summary,
const gchar *id)
{
gchar *value = NULL;
- if (!camel_o365_store_summary_get_folder (store_summary, id, NULL, &value, NULL, NULL, NULL, NULL,
NULL, NULL, NULL))
+ if (!camel_m365_store_summary_get_folder (store_summary, id, NULL, &value, NULL, NULL, NULL, NULL,
NULL, NULL, NULL))
value = NULL;
return value;
}
void
-camel_o365_store_summary_set_folder_parent_id (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_set_folder_parent_id (CamelM365StoreSummary *store_summary,
const gchar *id,
const gchar *parent_id)
{
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
g_return_if_fail (id != NULL);
LOCK (store_summary);
@@ -952,23 +941,23 @@ camel_o365_store_summary_set_folder_parent_id (CamelO365StoreSummary *store_summ
}
gchar *
-camel_o365_store_summary_dup_folder_parent_id (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_dup_folder_parent_id (CamelM365StoreSummary *store_summary,
const gchar *id)
{
gchar *value = NULL;
- if (!camel_o365_store_summary_get_folder (store_summary, id, NULL, NULL, &value, NULL, NULL, NULL,
NULL, NULL, NULL))
+ if (!camel_m365_store_summary_get_folder (store_summary, id, NULL, NULL, &value, NULL, NULL, NULL,
NULL, NULL, NULL))
value = NULL;
return value;
}
void
-camel_o365_store_summary_set_folder_total_count (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_set_folder_total_count (CamelM365StoreSummary *store_summary,
const gchar *id,
gint32 total_count)
{
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
g_return_if_fail (id != NULL);
LOCK (store_summary);
@@ -982,23 +971,23 @@ camel_o365_store_summary_set_folder_total_count (CamelO365StoreSummary *store_su
}
gint32
-camel_o365_store_summary_get_folder_total_count (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_get_folder_total_count (CamelM365StoreSummary *store_summary,
const gchar *id)
{
gint32 value = 0;
- if (!camel_o365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, &value, NULL, NULL,
NULL, NULL, NULL))
+ if (!camel_m365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, &value, NULL, NULL,
NULL, NULL, NULL))
value = 0;
return value;
}
void
-camel_o365_store_summary_set_folder_unread_count (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_set_folder_unread_count (CamelM365StoreSummary *store_summary,
const gchar *id,
gint32 unread_count)
{
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
g_return_if_fail (id != NULL);
LOCK (store_summary);
@@ -1012,23 +1001,23 @@ camel_o365_store_summary_set_folder_unread_count (CamelO365StoreSummary *store_s
}
gint32
-camel_o365_store_summary_get_folder_unread_count (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_get_folder_unread_count (CamelM365StoreSummary *store_summary,
const gchar *id)
{
gint32 value = 0;
- if (!camel_o365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, NULL, &value, NULL,
NULL, NULL, NULL))
+ if (!camel_m365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, NULL, &value, NULL,
NULL, NULL, NULL))
value = 0;
return value;
}
void
-camel_o365_store_summary_set_folder_flags (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_set_folder_flags (CamelM365StoreSummary *store_summary,
const gchar *id,
guint32 flags)
{
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
g_return_if_fail (id != NULL);
LOCK (store_summary);
@@ -1042,25 +1031,25 @@ camel_o365_store_summary_set_folder_flags (CamelO365StoreSummary *store_summary,
}
guint32
-camel_o365_store_summary_get_folder_flags (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_get_folder_flags (CamelM365StoreSummary *store_summary,
const gchar *id)
{
guint32 value = 0;
- if (!camel_o365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, NULL, NULL, &value,
NULL, NULL, NULL))
+ if (!camel_m365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, NULL, NULL, &value,
NULL, NULL, NULL))
value = 0;
return value;
}
guint32
-camel_o365_store_summary_get_folder_flags_for_full_name (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_get_folder_flags_for_full_name (CamelM365StoreSummary *store_summary,
const gchar *full_name)
{
const gchar *id;
guint32 flags = 0;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), 0);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), 0);
g_return_val_if_fail (full_name != NULL, 0);
LOCK (store_summary);
@@ -1068,57 +1057,57 @@ camel_o365_store_summary_get_folder_flags_for_full_name (CamelO365StoreSummary *
id = g_hash_table_lookup (store_summary->priv->full_name_id_hash, full_name);
if (id)
- flags = camel_o365_store_summary_get_folder_flags (store_summary, id);
+ flags = camel_m365_store_summary_get_folder_flags (store_summary, id);
UNLOCK (store_summary);
return flags;
}
-EO365FolderKind
-camel_o365_store_summary_get_folder_kind (CamelO365StoreSummary *store_summary,
+EM365FolderKind
+camel_m365_store_summary_get_folder_kind (CamelM365StoreSummary *store_summary,
const gchar *id)
{
- EO365FolderKind value = E_O365_FOLDER_KIND_UNKNOWN;
+ EM365FolderKind value = E_M365_FOLDER_KIND_UNKNOWN;
- if (!camel_o365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, NULL, NULL, NULL,
&value, NULL, NULL))
- value = E_O365_FOLDER_KIND_UNKNOWN;
+ if (!camel_m365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, NULL, NULL, NULL,
&value, NULL, NULL))
+ value = E_M365_FOLDER_KIND_UNKNOWN;
return value;
}
gboolean
-camel_o365_store_summary_get_folder_is_foreign (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_get_folder_is_foreign (CamelM365StoreSummary *store_summary,
const gchar *id)
{
gboolean value = FALSE;
- if (!camel_o365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, &value, NULL))
+ if (!camel_m365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, &value, NULL))
value = FALSE;
return value;
}
gboolean
-camel_o365_store_summary_get_folder_is_public (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_get_folder_is_public (CamelM365StoreSummary *store_summary,
const gchar *id)
{
gboolean value = FALSE;
- if (!camel_o365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, &value))
+ if (!camel_m365_store_summary_get_folder (store_summary, id, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, &value))
value = FALSE;
return value;
}
GSList * /* gchar * */
-camel_o365_store_summary_list_folder_ids (CamelO365StoreSummary *store_summary)
+camel_m365_store_summary_list_folder_ids (CamelM365StoreSummary *store_summary)
{
GSList *ids = NULL;
gchar **groups;
gint ii;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), NULL);
LOCK (store_summary);
@@ -1144,7 +1133,7 @@ camel_o365_store_summary_list_folder_ids (CamelO365StoreSummary *store_summary)
}
CamelFolderInfo *
-camel_o365_store_summary_build_folder_info_for_id (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_build_folder_info_for_id (CamelM365StoreSummary *store_summary,
const gchar *id)
{
CamelFolderInfo *info;
@@ -1154,12 +1143,12 @@ camel_o365_store_summary_build_folder_info_for_id (CamelO365StoreSummary *store_
gint32 unread_count = 0;
guint32 flags = 0;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), NULL);
g_return_val_if_fail (id != NULL, NULL);
LOCK (store_summary);
- if (camel_o365_store_summary_get_folder (store_summary, id, &full_name, &display_name, NULL,
&total_count, &unread_count, &flags, NULL, NULL, NULL)) {
+ if (camel_m365_store_summary_get_folder (store_summary, id, &full_name, &display_name, NULL,
&total_count, &unread_count, &flags, NULL, NULL, NULL)) {
info = camel_folder_info_new ();
info->full_name = full_name;
info->display_name = display_name;
@@ -1176,7 +1165,7 @@ camel_o365_store_summary_build_folder_info_for_id (CamelO365StoreSummary *store_
}
typedef struct _GatherInfosData {
- CamelO365StoreSummary *store_summary;
+ CamelM365StoreSummary *store_summary;
GPtrArray *folder_infos;
const gchar *prefix;
gint prefix_len;
@@ -1184,7 +1173,7 @@ typedef struct _GatherInfosData {
} GatherInfosData;
static void
-o365_store_summary_gather_folder_infos (gpointer key,
+m365_store_summary_gather_folder_infos (gpointer key,
gpointer value,
gpointer user_data)
{
@@ -1201,7 +1190,7 @@ o365_store_summary_gather_folder_infos (gpointer key,
if (gid->recursive || !*without_prefix) {
CamelFolderInfo *info;
- info = camel_o365_store_summary_build_folder_info_for_id (gid->store_summary, id);
+ info = camel_m365_store_summary_build_folder_info_for_id (gid->store_summary, id);
if (info)
g_ptr_array_add (gid->folder_infos, info);
@@ -1212,14 +1201,14 @@ o365_store_summary_gather_folder_infos (gpointer key,
}
CamelFolderInfo *
-camel_o365_store_summary_build_folder_info (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_build_folder_info (CamelM365StoreSummary *store_summary,
const gchar *top,
gboolean recursive)
{
CamelFolderInfo *info = NULL;
GatherInfosData gid;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), NULL);
if (!top)
top = "";
@@ -1232,7 +1221,7 @@ camel_o365_store_summary_build_folder_info (CamelO365StoreSummary *store_summary
gid.prefix_len = strlen (top);
gid.recursive = recursive;
- g_hash_table_foreach (store_summary->priv->id_full_name_hash, o365_store_summary_gather_folder_infos,
&gid);
+ g_hash_table_foreach (store_summary->priv->id_full_name_hash, m365_store_summary_gather_folder_infos,
&gid);
info = camel_folder_info_build (gid.folder_infos, top, '/', TRUE);
@@ -1244,9 +1233,9 @@ camel_o365_store_summary_build_folder_info (CamelO365StoreSummary *store_summary
}
static void
-o365_store_summary_folder_count_notify_cb (CamelFolderSummary *folder_summary,
+m365_store_summary_folder_count_notify_cb (CamelFolderSummary *folder_summary,
GParamSpec *param,
- CamelO365StoreSummary *store_summary)
+ CamelM365StoreSummary *store_summary)
{
CamelFolder *folder;
gchar *folder_id;
@@ -1254,14 +1243,14 @@ o365_store_summary_folder_count_notify_cb (CamelFolderSummary *folder_summary,
g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (folder_summary));
g_return_if_fail (param != NULL);
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
folder = camel_folder_summary_get_folder (folder_summary);
if (!folder)
return;
- folder_id = camel_o365_store_summary_dup_folder_id_for_full_name (store_summary,
camel_folder_get_full_name (folder));
+ folder_id = camel_m365_store_summary_dup_folder_id_for_full_name (store_summary,
camel_folder_get_full_name (folder));
/* This can happen on folder delete/unsubscribe, after folder summary clear */
if (!folder_id)
@@ -1269,10 +1258,10 @@ o365_store_summary_folder_count_notify_cb (CamelFolderSummary *folder_summary,
if (g_strcmp0 (g_param_spec_get_name (param), "saved-count") == 0) {
count = camel_folder_summary_get_saved_count (folder_summary);
- camel_o365_store_summary_set_folder_total_count (store_summary, folder_id, count);
+ camel_m365_store_summary_set_folder_total_count (store_summary, folder_id, count);
} else if (g_strcmp0 (g_param_spec_get_name (param), "unread-count") == 0) {
count = camel_folder_summary_get_unread_count (folder_summary);
- camel_o365_store_summary_set_folder_unread_count (store_summary, folder_id, count);
+ camel_m365_store_summary_set_folder_unread_count (store_summary, folder_id, count);
} else {
g_warn_if_reached ();
}
@@ -1281,18 +1270,18 @@ o365_store_summary_folder_count_notify_cb (CamelFolderSummary *folder_summary,
}
void
-camel_o365_store_summary_connect_folder_summary (CamelO365StoreSummary *store_summary,
+camel_m365_store_summary_connect_folder_summary (CamelM365StoreSummary *store_summary,
CamelFolderSummary *folder_summary)
{
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (folder_summary));
- g_signal_connect_object (folder_summary, "notify::saved-count", G_CALLBACK
(o365_store_summary_folder_count_notify_cb), store_summary, 0);
- g_signal_connect_object (folder_summary, "notify::unread-count", G_CALLBACK
(o365_store_summary_folder_count_notify_cb), store_summary, 0);
+ g_signal_connect_object (folder_summary, "notify::saved-count", G_CALLBACK
(m365_store_summary_folder_count_notify_cb), store_summary, 0);
+ g_signal_connect_object (folder_summary, "notify::unread-count", G_CALLBACK
(m365_store_summary_folder_count_notify_cb), store_summary, 0);
}
static gchar *
-camel_o365_category_to_string (const CamelO365Category *cat)
+camel_m365_category_to_string (const CamelM365Category *cat)
{
gchar *id, *display_name, *color = NULL, *str;
@@ -1317,10 +1306,10 @@ camel_o365_category_to_string (const CamelO365Category *cat)
return str;
}
-static CamelO365Category *
-camel_o365_category_from_string (const gchar *str)
+static CamelM365Category *
+camel_m365_category_from_string (const gchar *str)
{
- CamelO365Category *cat;
+ CamelM365Category *cat;
gchar **strv, *id, *display_name, *color;
g_return_val_if_fail (str != NULL, NULL);
@@ -1335,7 +1324,7 @@ camel_o365_category_from_string (const gchar *str)
display_name = g_uri_unescape_string (strv[1], NULL);
color = (strv[2] && strv[2][0]) ? g_uri_unescape_string (strv[2], NULL) : NULL;
- cat = camel_o365_category_new (id, display_name, color);
+ cat = camel_m365_category_new (id, display_name, color);
g_free (id);
g_free (display_name);
@@ -1345,13 +1334,13 @@ camel_o365_category_from_string (const gchar *str)
return cat;
}
-GHashTable * /* gchar *id ~> CamelO365Category * */
-camel_o365_store_summary_get_categories (CamelO365StoreSummary *store_summary)
+GHashTable * /* gchar *id ~> CamelM365Category * */
+camel_m365_store_summary_get_categories (CamelM365StoreSummary *store_summary)
{
GHashTable *categories;
gchar **strv;
- g_return_val_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary), NULL);
LOCK (store_summary);
@@ -1359,15 +1348,15 @@ camel_o365_store_summary_get_categories (CamelO365StoreSummary *store_summary)
UNLOCK (store_summary);
- categories = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, camel_o365_category_free);
+ categories = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, camel_m365_category_free);
if (strv) {
gint ii;
for (ii = 0; strv[ii]; ii++) {
- CamelO365Category *cat;
+ CamelM365Category *cat;
- cat = camel_o365_category_from_string (strv[ii]);
+ cat = camel_m365_category_from_string (strv[ii]);
if (cat)
g_hash_table_insert (categories, cat->id, cat);
}
@@ -1379,14 +1368,14 @@ camel_o365_store_summary_get_categories (CamelO365StoreSummary *store_summary)
}
void
-camel_o365_store_summary_set_categories (CamelO365StoreSummary *store_summary,
- GHashTable *categories) /* gchar *id ~> CamelO365Category * */
+camel_m365_store_summary_set_categories (CamelM365StoreSummary *store_summary,
+ GHashTable *categories) /* gchar *id ~> CamelM365Category * */
{
GPtrArray *array;
GHashTableIter iter;
gpointer value;
- g_return_if_fail (CAMEL_IS_O365_STORE_SUMMARY (store_summary));
+ g_return_if_fail (CAMEL_IS_M365_STORE_SUMMARY (store_summary));
g_return_if_fail (categories != NULL);
array = g_ptr_array_new_full (g_hash_table_size (categories), g_free);
@@ -1394,12 +1383,12 @@ camel_o365_store_summary_set_categories (CamelO365StoreSummary *store_summary,
g_hash_table_iter_init (&iter, categories);
while (g_hash_table_iter_next (&iter, NULL, &value)) {
- CamelO365Category *cat = value;
+ CamelM365Category *cat = value;
if (cat) {
gchar *str;
- str = camel_o365_category_to_string (cat);
+ str = camel_m365_category_to_string (cat);
if (str)
g_ptr_array_add (array, str);
@@ -1418,17 +1407,17 @@ camel_o365_store_summary_set_categories (CamelO365StoreSummary *store_summary,
g_ptr_array_free (array, TRUE);
}
-CamelO365Category *
-camel_o365_category_new (const gchar *id,
+CamelM365Category *
+camel_m365_category_new (const gchar *id,
const gchar *display_name,
const gchar *color)
{
- CamelO365Category *cat;
+ CamelM365Category *cat;
g_return_val_if_fail (id != NULL, NULL);
g_return_val_if_fail (display_name != NULL, NULL);
- cat = g_slice_new0 (CamelO365Category);
+ cat = g_slice_new0 (CamelM365Category);
cat->id = g_strdup (id);
cat->display_name = g_strdup (display_name);
cat->color = g_strdup (color);
@@ -1437,14 +1426,14 @@ camel_o365_category_new (const gchar *id,
}
void
-camel_o365_category_free (gpointer ptr)
+camel_m365_category_free (gpointer ptr)
{
- CamelO365Category *cat = ptr;
+ CamelM365Category *cat = ptr;
if (cat) {
g_free (cat->id);
g_free (cat->display_name);
g_free (cat->color);
- g_slice_free (CamelO365Category, cat);
+ g_slice_free (CamelM365Category, cat);
}
}
diff --git a/src/Microsoft365/camel/camel-m365-store-summary.h
b/src/Microsoft365/camel/camel-m365-store-summary.h
new file mode 100644
index 00000000..29f82a4d
--- /dev/null
+++ b/src/Microsoft365/camel/camel-m365-store-summary.h
@@ -0,0 +1,189 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef CAMEL_M365_STORE_SUMMARY_H
+#define CAMEL_M365_STORE_SUMMARY_H
+
+#include <camel/camel.h>
+
+#include "common/e-m365-enums.h"
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_M365_STORE_SUMMARY \
+ (camel_m365_store_summary_get_type ())
+#define CAMEL_M365_STORE_SUMMARY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_M365_STORE_SUMMARY, CamelM365StoreSummary))
+#define CAMEL_M365_STORE_SUMMARY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_M365_STORE_SUMMARY, CamelM365StoreSummaryClass))
+#define CAMEL_IS_M365_STORE_SUMMARY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_M365_STORE_SUMMARY))
+#define CAMEL_IS_M365_STORE_SUMMARY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_M365_STORE_SUMMARY))
+#define CAMEL_M365_STORE_SUMMARY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_M365_STORE_SUMMARY, CamelM365StoreSummaryClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelM365StoreSummary CamelM365StoreSummary;
+typedef struct _CamelM365StoreSummaryClass CamelM365StoreSummaryClass;
+typedef struct _CamelM365StoreSummaryPrivate CamelM365StoreSummaryPrivate;
+
+struct _CamelM365StoreSummary {
+ GObject parent;
+ CamelM365StoreSummaryPrivate *priv;
+};
+
+struct _CamelM365StoreSummaryClass {
+ GObjectClass parent_class;
+};
+
+GType camel_m365_store_summary_get_type (void);
+
+CamelM365StoreSummary *
+ camel_m365_store_summary_new (const gchar *filename);
+gboolean camel_m365_store_summary_load (CamelM365StoreSummary *store_summary,
+ GError **error);
+gboolean camel_m365_store_summary_save (CamelM365StoreSummary *store_summary,
+ GError **error);
+void camel_m365_store_summary_clear (CamelM365StoreSummary *store_summary);
+void camel_m365_store_summary_lock (CamelM365StoreSummary *store_summary);
+void camel_m365_store_summary_unlock (CamelM365StoreSummary *store_summary);
+void camel_m365_store_summary_rebuild_hashes (CamelM365StoreSummary *store_summary);
+void camel_m365_store_summary_set_delta_link (CamelM365StoreSummary *store_summary,
+ const gchar *delta_link);
+gchar * camel_m365_store_summary_dup_delta_link (CamelM365StoreSummary *store_summary);
+gboolean camel_m365_store_summary_has_folder (CamelM365StoreSummary *store_summary,
+ const gchar *id);
+gboolean camel_m365_store_summary_has_full_name (CamelM365StoreSummary *store_summary,
+ const gchar *full_name);
+void camel_m365_store_summary_remove_folder (CamelM365StoreSummary *store_summary,
+ const gchar *id);
+void camel_m365_store_summary_set_folder (CamelM365StoreSummary *store_summary,
+ gboolean with_hashes_update,
+ const gchar *id,
+ const gchar *parent_id,
+ const gchar *display_name,
+ gint32 total_count,
+ gint32 unread_count,
+ guint32 flags,
+ EM365FolderKind kind,
+ gboolean is_foreign,
+ gboolean is_public);
+void camel_m365_store_summary_update_folder (CamelM365StoreSummary *store_summary,
+ gboolean with_hashes_update,
+ const gchar *id,
+ const gchar *parent_id,
+ const gchar *display_name,
+ gint32 total_count,
+ gint32 unread_count,
+ gint32 children_count);
+gboolean camel_m365_store_summary_get_folder (CamelM365StoreSummary *store_summary,
+ const gchar *id,
+ gchar **out_full_name,
+ gchar **out_display_name,
+ gchar **out_parent_id,
+ gint32 *out_total_count,
+ gint32 *out_unread_count,
+ guint32 *out_flags,
+ EM365FolderKind *out_kind,
+ gboolean *out_is_foreign,
+ gboolean *out_is_public);
+gchar * camel_m365_store_summary_dup_folder_full_name
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id);
+gchar * camel_m365_store_summary_dup_folder_id_for_full_name
+ (CamelM365StoreSummary *store_summary,
+ const gchar *full_name);
+gchar * camel_m365_store_summary_dup_folder_id_for_type
+ (CamelM365StoreSummary *store_summary,
+ guint32 folder_type); /* The CAMEL_FOLDER_TYPE_...
of the CamelFolderInfoFlags */
+gboolean camel_m365_store_summary_set_folder_display_name
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id,
+ const gchar *display_name,
+ gboolean with_hashes_update);
+gchar * camel_m365_store_summary_dup_folder_display_name
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id);
+void camel_m365_store_summary_set_folder_parent_id
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id,
+ const gchar *parent_id);
+gchar * camel_m365_store_summary_dup_folder_parent_id
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id);
+void camel_m365_store_summary_set_folder_total_count
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id,
+ gint32 total_count);
+gint32 camel_m365_store_summary_get_folder_total_count
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id);
+void camel_m365_store_summary_set_folder_unread_count
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id,
+ gint32 unread_count);
+gint32 camel_m365_store_summary_get_folder_unread_count
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id);
+void camel_m365_store_summary_set_folder_flags
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id,
+ guint32 flags);
+guint32 camel_m365_store_summary_get_folder_flags
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id);
+guint32 camel_m365_store_summary_get_folder_flags_for_full_name
+ (CamelM365StoreSummary *store_summary,
+ const gchar *full_name);
+EM365FolderKind camel_m365_store_summary_get_folder_kind(CamelM365StoreSummary *store_summary,
+ const gchar *id);
+gboolean camel_m365_store_summary_get_folder_is_foreign
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id);
+gboolean camel_m365_store_summary_get_folder_is_public
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id);
+GSList * camel_m365_store_summary_list_folder_ids(CamelM365StoreSummary *store_summary); /* gchar
*folder_id */
+CamelFolderInfo *
+ camel_m365_store_summary_build_folder_info_for_id
+ (CamelM365StoreSummary *store_summary,
+ const gchar *id);
+CamelFolderInfo *
+ camel_m365_store_summary_build_folder_info
+ (CamelM365StoreSummary *store_summary,
+ const gchar *top,
+ gboolean recursive);
+void camel_m365_store_summary_connect_folder_summary
+ (CamelM365StoreSummary *store_summary,
+ CamelFolderSummary *folder_summary);
+
+typedef struct _CamelM365Category {
+ gchar *id;
+ gchar *display_name;
+ gchar *color;
+} CamelM365Category;
+
+GHashTable * camel_m365_store_summary_get_categories /* gchar *id ~> CamelM365Category * */
+ (CamelM365StoreSummary *store_summary);
+void camel_m365_store_summary_set_categories
+ (CamelM365StoreSummary *store_summary,
+ GHashTable *categories); /* gchar *id ~> CamelM365Category *
*/
+
+CamelM365Category *
+ camel_m365_category_new (const gchar *id,
+ const gchar *display_name,
+ const gchar *color);
+void camel_m365_category_free (gpointer ptr); /* CamelM365Category * */
+
+G_END_DECLS
+
+#endif /* CAMEL_M365_STORE_SUMMARY_H */
diff --git a/src/Office365/camel/camel-o365-store.c b/src/Microsoft365/camel/camel-m365-store.c
similarity index 59%
rename from src/Office365/camel/camel-o365-store.c
rename to src/Microsoft365/camel/camel-m365-store.c
index 05a90005..4bb2e1ec 100644
--- a/src/Office365/camel/camel-o365-store.c
+++ b/src/Microsoft365/camel/camel-m365-store.c
@@ -1,18 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
@@ -22,27 +11,27 @@
#include <e-util/e-util.h>
-#include "common/camel-o365-settings.h"
-#include "common/e-o365-connection.h"
-#include "camel-o365-folder.h"
-#include "camel-o365-store-summary.h"
-#include "camel-o365-utils.h"
+#include "common/camel-m365-settings.h"
+#include "common/e-m365-connection.h"
+#include "camel-m365-folder.h"
+#include "camel-m365-store-summary.h"
+#include "camel-m365-utils.h"
-#include "camel-o365-store.h"
+#include "camel-m365-store.h"
#define LOCK(_store) g_rec_mutex_lock (&(_store->priv->property_lock))
#define UNLOCK(_store) g_rec_mutex_unlock (&(_store->priv->property_lock))
-struct _CamelO365StorePrivate {
+struct _CamelM365StorePrivate {
GRecMutex property_lock;
gchar *storage_path;
- CamelO365StoreSummary *summary;
- EO365Connection *cnc;
+ CamelM365StoreSummary *summary;
+ EM365Connection *cnc;
GHashTable *default_folders;
};
-static void camel_o365_store_initable_init (GInitableIface *iface);
-static void camel_o365_subscribable_init (CamelSubscribableInterface *iface);
+static void camel_m365_store_initable_init (GInitableIface *iface);
+static void camel_m365_subscribable_init (CamelSubscribableInterface *iface);
static GInitableIface *parent_initable_interface;
enum {
@@ -51,31 +40,31 @@ enum {
PROP_HOST_REACHABLE
};
-G_DEFINE_TYPE_WITH_CODE (CamelO365Store, camel_o365_store, CAMEL_TYPE_OFFLINE_STORE,
- G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, camel_o365_store_initable_init)
+G_DEFINE_TYPE_WITH_CODE (CamelM365Store, camel_m365_store, CAMEL_TYPE_OFFLINE_STORE,
+ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, camel_m365_store_initable_init)
G_IMPLEMENT_INTERFACE (CAMEL_TYPE_NETWORK_SERVICE, NULL)
- G_IMPLEMENT_INTERFACE (CAMEL_TYPE_SUBSCRIBABLE, camel_o365_subscribable_init)
- G_ADD_PRIVATE (CamelO365Store))
+ G_IMPLEMENT_INTERFACE (CAMEL_TYPE_SUBSCRIBABLE, camel_m365_subscribable_init)
+ G_ADD_PRIVATE (CamelM365Store))
static gboolean
-o365_store_construct (CamelService *service,
+m365_store_construct (CamelService *service,
CamelSession *session,
CamelProvider *provider,
GError **error)
{
- CamelO365Store *o365_store;
+ CamelM365Store *m365_store;
gchar *summary_file, *session_storage_path;
guint32 store_flags;
GError *local_error = NULL;
- o365_store = (CamelO365Store *) service;
+ m365_store = (CamelM365Store *) service;
- store_flags = camel_store_get_flags (CAMEL_STORE (o365_store));
+ store_flags = camel_store_get_flags (CAMEL_STORE (m365_store));
- /* Disable virtual trash and junk folders. Office365 has real folders for that */
+ /* Disable virtual trash and junk folders. Microsoft365 has real folders for that */
store_flags &= ~(CAMEL_STORE_VTRASH | CAMEL_STORE_VJUNK);
store_flags |= CAMEL_STORE_REAL_JUNK_FOLDER;
- camel_store_set_flags (CAMEL_STORE (o365_store), store_flags);
+ camel_store_set_flags (CAMEL_STORE (m365_store), store_flags);
session_storage_path = g_strdup (camel_service_get_user_cache_dir (service));
@@ -87,14 +76,14 @@ o365_store_construct (CamelService *service,
return FALSE;
}
- o365_store->priv->storage_path = session_storage_path;
+ m365_store->priv->storage_path = session_storage_path;
- g_mkdir_with_parents (o365_store->priv->storage_path, 0700);
+ g_mkdir_with_parents (m365_store->priv->storage_path, 0700);
- summary_file = g_build_filename (o365_store->priv->storage_path, "folder-tree", NULL);
- o365_store->priv->summary = camel_o365_store_summary_new (summary_file);
+ summary_file = g_build_filename (m365_store->priv->storage_path, "folder-tree", NULL);
+ m365_store->priv->summary = camel_m365_store_summary_new (summary_file);
- if (!camel_o365_store_summary_load (o365_store->priv->summary, &local_error))
+ if (!camel_m365_store_summary_load (m365_store->priv->summary, &local_error))
g_warning ("%s: Failed to load store summary '%s': %s", G_STRFUNC, summary_file, local_error
? local_error->message : "Unknown error");
g_clear_error (&local_error);
@@ -104,7 +93,7 @@ o365_store_construct (CamelService *service,
}
static gboolean
-o365_store_initable_init (GInitable *initable,
+m365_store_initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
@@ -127,7 +116,7 @@ o365_store_initable_init (GInitable *initable,
session = camel_service_ref_session (service);
- ret = o365_store_construct (service, session, NULL, error);
+ ret = m365_store_construct (service, session, NULL, error);
g_object_unref (session);
@@ -135,17 +124,17 @@ o365_store_initable_init (GInitable *initable,
}
static GList *
-o365_store_query_auth_types_sync (CamelService *service,
+m365_store_query_auth_types_sync (CamelService *service,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (CAMEL_IS_O365_STORE (service), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (service), NULL);
return NULL;
}
static gchar *
-o365_store_get_name (CamelService *service,
+m365_store_get_name (CamelService *service,
gboolean brief)
{
gchar *name;
@@ -159,8 +148,8 @@ o365_store_get_name (CamelService *service,
}
static gboolean
-o365_store_read_default_folders (CamelO365Store *o365_store,
- EO365Connection *cnc,
+m365_store_read_default_folders (CamelM365Store *m365_store,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
@@ -180,17 +169,17 @@ o365_store_read_default_folders (CamelO365Store *o365_store,
gboolean success;
guint ii;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (o365_store), FALSE);
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (m365_store), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
- LOCK (o365_store);
+ LOCK (m365_store);
- if (g_hash_table_size (o365_store->priv->default_folders)) {
- UNLOCK (o365_store);
+ if (g_hash_table_size (m365_store->priv->default_folders)) {
+ UNLOCK (m365_store);
return TRUE;
}
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
requests = g_ptr_array_new_full (G_N_ELEMENTS (default_folders), g_object_unref);
@@ -198,7 +187,7 @@ o365_store_read_default_folders (CamelO365Store *o365_store,
SoupMessage *message;
gchar *uri;
- uri = e_o365_connection_construct_uri (cnc, TRUE, NULL, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, NULL, E_M365_API_V1_0, NULL,
"mailFolders",
NULL,
default_folders[ii].name,
@@ -221,29 +210,29 @@ o365_store_read_default_folders (CamelO365Store *o365_store,
g_ptr_array_add (requests, message);
}
- success = e_o365_connection_batch_request_sync (cnc, E_O365_API_V1_0, requests, cancellable, error);
+ success = e_m365_connection_batch_request_sync (cnc, E_M365_API_V1_0, requests, cancellable, error);
if (success) {
g_warn_if_fail (requests->len == G_N_ELEMENTS (default_folders));
- LOCK (o365_store);
+ LOCK (m365_store);
for (ii = 0; ii < requests->len; ii++) {
SoupMessage *message = g_ptr_array_index (requests, ii);
JsonNode *node = NULL;
if (message->status_code > 0 && SOUP_STATUS_IS_SUCCESSFUL (message->status_code) &&
- e_o365_connection_json_node_from_message (message, NULL, &node, cancellable,
NULL) &&
+ e_m365_connection_json_node_from_message (message, NULL, &node, cancellable,
NULL) &&
node && JSON_NODE_HOLDS_OBJECT (node)) {
JsonObject *object = json_node_get_object (node);
if (object) {
const gchar *id;
- id = e_o365_json_get_string_member (object, "id", NULL);
+ id = e_m365_json_get_string_member (object, "id", NULL);
if (id && *id) {
- g_hash_table_insert (o365_store->priv->default_folders,
g_strdup (id),
+ g_hash_table_insert (m365_store->priv->default_folders,
g_strdup (id),
GUINT_TO_POINTER (default_folders[ii].flags));
}
}
@@ -253,7 +242,7 @@ o365_store_read_default_folders (CamelO365Store *o365_store,
json_node_unref (node);
}
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
}
g_ptr_array_unref (requests);
@@ -262,7 +251,7 @@ o365_store_read_default_folders (CamelO365Store *o365_store,
}
static gboolean
-o365_store_equal_label_tag_cb (gconstpointer ptr1,
+m365_store_equal_label_tag_cb (gconstpointer ptr1,
gconstpointer ptr2)
{
const gchar *evo_label_def = ptr1;
@@ -278,7 +267,7 @@ o365_store_equal_label_tag_cb (gconstpointer ptr1,
}
static gboolean
-o365_store_find_in_ptr_array (GPtrArray *haystack,
+m365_store_find_in_ptr_array (GPtrArray *haystack,
gconstpointer needle,
GEqualFunc equal_func,
guint *out_index)
@@ -305,8 +294,8 @@ o365_store_find_in_ptr_array (GPtrArray *haystack,
/* Returns whether had been done any changes */
static gboolean
-o365_store_save_category_changes (GHashTable *old_categories, /* gchar *id ~> CamelO365Category * */
- GHashTable *new_categories) /* gchar *id ~> CamelO365Category * */
+m365_store_save_category_changes (GHashTable *old_categories, /* gchar *id ~> CamelM365Category * */
+ GHashTable *new_categories) /* gchar *id ~> CamelM365Category * */
{
GHashTableIter iter;
GSettings *settings;
@@ -332,7 +321,7 @@ o365_store_save_category_changes (GHashTable *old_categories, /* gchar *id ~> Ca
g_hash_table_iter_init (&iter, new_categories);
while (g_hash_table_iter_next (&iter, NULL, &value)) {
- CamelO365Category *new_cat = value, *old_cat;
+ CamelM365Category *new_cat = value, *old_cat;
gchar *tag = NULL;
if (!new_cat)
@@ -343,11 +332,11 @@ o365_store_save_category_changes (GHashTable *old_categories, /* gchar *id ~> Ca
if (g_strcmp0 (old_cat->display_name, new_cat->display_name) != 0 ||
g_strcmp0 (old_cat->color, new_cat->color) != 0) {
/* Old category changed name or color */
- tag = camel_o365_utils_encode_category_name (new_cat->display_name);
+ tag = camel_m365_utils_encode_category_name (new_cat->display_name);
}
} else {
/* This is a new category */
- tag = camel_o365_utils_encode_category_name (new_cat->display_name);
+ tag = camel_m365_utils_encode_category_name (new_cat->display_name);
}
if (tag && *tag) {
@@ -363,10 +352,10 @@ o365_store_save_category_changes (GHashTable *old_categories, /* gchar *id ~> Ca
}
if (old_cat && g_strcmp0 (old_cat->display_name, new_cat->display_name) != 0) {
- gchar *old_tag = camel_o365_utils_encode_category_name
(old_cat->display_name);
+ gchar *old_tag = camel_m365_utils_encode_category_name
(old_cat->display_name);
if (old_tag && *old_tag) {
- if (!o365_store_find_in_ptr_array (evo_labels, old_tag,
o365_store_equal_label_tag_cb, &index))
+ if (!m365_store_find_in_ptr_array (evo_labels, old_tag,
m365_store_equal_label_tag_cb, &index))
index = (guint) -1;
}
@@ -379,7 +368,7 @@ o365_store_save_category_changes (GHashTable *old_categories, /* gchar *id ~> Ca
}
if (index == (guint) -1 &&
- !o365_store_find_in_ptr_array (evo_labels, tag, o365_store_equal_label_tag_cb,
&index))
+ !m365_store_find_in_ptr_array (evo_labels, tag, m365_store_equal_label_tag_cb,
&index))
index = (guint) -1;
label_def = g_strconcat (new_cat->display_name, "|", new_cat->color ? new_cat->color
: "#FF0000", "|", tag, NULL);
@@ -403,14 +392,14 @@ o365_store_save_category_changes (GHashTable *old_categories, /* gchar *id ~> Ca
g_hash_table_iter_init (&iter, old_categories);
while (g_hash_table_iter_next (&iter, NULL, &value)) {
- CamelO365Category *old_cat = value;
+ CamelM365Category *old_cat = value;
gchar *old_tag;
guint index;
if (!old_cat)
continue;
- old_tag = camel_o365_utils_encode_category_name (old_cat->display_name);
+ old_tag = camel_m365_utils_encode_category_name (old_cat->display_name);
for (ii = 0; old_tag && old_tag[ii]; ii++) {
if (old_tag[ii] == '|')
@@ -418,7 +407,7 @@ o365_store_save_category_changes (GHashTable *old_categories, /* gchar *id ~> Ca
}
if (old_tag &&
- o365_store_find_in_ptr_array (evo_labels, old_tag, o365_store_equal_label_tag_cb,
&index))
+ m365_store_find_in_ptr_array (evo_labels, old_tag, m365_store_equal_label_tag_cb,
&index))
g_ptr_array_remove_index (evo_labels, index);
g_free (old_tag);
@@ -439,47 +428,47 @@ o365_store_save_category_changes (GHashTable *old_categories, /* gchar *id ~> Ca
}
static void
-o365_store_get_categories_cb (CamelSession *session,
+m365_store_get_categories_cb (CamelSession *session,
GCancellable *cancellable,
gpointer user_data,
GError **error)
{
- CamelO365Store *o365_store = user_data;
- EO365Connection *cnc;
+ CamelM365Store *m365_store = user_data;
+ EM365Connection *cnc;
GSList *categories = NULL;
- g_return_if_fail (CAMEL_IS_O365_STORE (o365_store));
+ g_return_if_fail (CAMEL_IS_M365_STORE (m365_store));
- cnc = camel_o365_store_ref_connection (o365_store);
+ cnc = camel_m365_store_ref_connection (m365_store);
if (!cnc)
return;
- if (e_o365_connection_get_categories_sync (cnc, NULL, &categories, cancellable, error)) {
+ if (e_m365_connection_get_categories_sync (cnc, NULL, &categories, cancellable, error)) {
GHashTable *old_categories, *new_categories;
GSList *link;
- new_categories = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
camel_o365_category_free);
+ new_categories = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
camel_m365_category_free);
for (link = categories; link; link = g_slist_next (link)) {
- EO365Category *category = link->data;
- CamelO365Category *cat;
+ EM365Category *category = link->data;
+ CamelM365Category *cat;
const gchar *id, *display_name, *color;
if (!category)
continue;
- id = e_o365_category_get_id (category);
- display_name = e_o365_category_get_display_name (category);
- color = e_o365_category_get_color (category);
+ id = e_m365_category_get_id (category);
+ display_name = e_m365_category_get_display_name (category);
+ color = e_m365_category_get_color (category);
if (!id || !display_name)
continue;
- if (display_name != camel_o365_utils_rename_label (display_name, TRUE))
+ if (display_name != camel_m365_utils_rename_label (display_name, TRUE))
continue;
- cat = camel_o365_category_new (id, display_name, color);
+ cat = camel_m365_category_new (id, display_name, color);
if (cat)
g_hash_table_insert (new_categories, cat->id, cat);
@@ -487,11 +476,11 @@ o365_store_get_categories_cb (CamelSession *session,
g_slist_free_full (categories, (GDestroyNotify) json_object_unref);
- old_categories = camel_o365_store_summary_get_categories (o365_store->priv->summary);
+ old_categories = camel_m365_store_summary_get_categories (m365_store->priv->summary);
- if (o365_store_save_category_changes (old_categories, new_categories)) {
- camel_o365_store_summary_set_categories (o365_store->priv->summary, new_categories);
- camel_o365_store_summary_save (o365_store->priv->summary, NULL);
+ if (m365_store_save_category_changes (old_categories, new_categories)) {
+ camel_m365_store_summary_set_categories (m365_store->priv->summary, new_categories);
+ camel_m365_store_summary_save (m365_store->priv->summary, NULL);
}
g_hash_table_destroy (new_categories);
@@ -502,33 +491,33 @@ o365_store_get_categories_cb (CamelSession *session,
}
static gboolean
-o365_store_connect_sync (CamelService *service,
+m365_store_connect_sync (CamelService *service,
GCancellable *cancellable,
GError **error)
{
- CamelO365Store *o365_store;
- EO365Connection *cnc;
+ CamelM365Store *m365_store;
+ EM365Connection *cnc;
gboolean success = FALSE;
/* Chain up to parent's method. */
- if (!CAMEL_SERVICE_CLASS (camel_o365_store_parent_class)->connect_sync (service, cancellable, error))
+ if (!CAMEL_SERVICE_CLASS (camel_m365_store_parent_class)->connect_sync (service, cancellable, error))
return FALSE;
if (camel_service_get_connection_status (service) == CAMEL_SERVICE_DISCONNECTED)
return FALSE;
- o365_store = CAMEL_O365_STORE (service);
- cnc = camel_o365_store_ref_connection (o365_store);
+ m365_store = CAMEL_M365_STORE (service);
+ cnc = camel_m365_store_ref_connection (m365_store);
if (!cnc) {
- cnc = camel_o365_utils_new_connection (service, NULL);
+ cnc = camel_m365_utils_new_connection (service, NULL);
if (cnc) {
- LOCK (o365_store);
+ LOCK (m365_store);
- o365_store->priv->cnc = g_object_ref (cnc);
+ m365_store->priv->cnc = g_object_ref (cnc);
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
}
}
@@ -537,13 +526,13 @@ o365_store_connect_sync (CamelService *service,
session = camel_service_ref_session (service);
- success = camel_session_authenticate_sync (session, service, "Office365", cancellable, error);
+ success = camel_session_authenticate_sync (session, service, "Microsoft365", cancellable,
error);
if (success) {
camel_session_submit_job (
session, _("Look up Microsoft 365 categories"),
- o365_store_get_categories_cb,
- g_object_ref (o365_store),
+ m365_store_get_categories_cb,
+ g_object_ref (m365_store),
g_object_unref);
}
@@ -557,19 +546,19 @@ o365_store_connect_sync (CamelService *service,
}
static gboolean
-o365_store_disconnect_sync (CamelService *service,
+m365_store_disconnect_sync (CamelService *service,
gboolean clean,
GCancellable *cancellable,
GError **error)
{
- CamelO365Store *o365_store = CAMEL_O365_STORE (service);
- EO365Connection *cnc;
+ CamelM365Store *m365_store = CAMEL_M365_STORE (service);
+ EM365Connection *cnc;
gboolean success = TRUE;
- cnc = camel_o365_store_ref_connection (o365_store);
+ cnc = camel_m365_store_ref_connection (m365_store);
if (cnc) {
- success = e_o365_connection_disconnect_sync (cnc, cancellable, error);
+ success = e_m365_connection_disconnect_sync (cnc, cancellable, error);
g_clear_object (&cnc);
}
@@ -578,26 +567,26 @@ o365_store_disconnect_sync (CamelService *service,
return FALSE;
/* Chain up to parent's method. */
- return CAMEL_SERVICE_CLASS (camel_o365_store_parent_class)->disconnect_sync (service, clean,
cancellable, error);
+ return CAMEL_SERVICE_CLASS (camel_m365_store_parent_class)->disconnect_sync (service, clean,
cancellable, error);
}
static CamelAuthenticationResult
-o365_store_authenticate_sync (CamelService *service,
+m365_store_authenticate_sync (CamelService *service,
const gchar *mechanism,
GCancellable *cancellable,
GError **error)
{
CamelAuthenticationResult result;
- CamelO365Store *o365_store;
- EO365Connection *cnc;
+ CamelM365Store *m365_store;
+ EM365Connection *cnc;
- o365_store = CAMEL_O365_STORE (service);
- cnc = camel_o365_store_ref_connection (o365_store);
+ m365_store = CAMEL_M365_STORE (service);
+ cnc = camel_m365_store_ref_connection (m365_store);
if (!cnc)
return CAMEL_AUTHENTICATION_ERROR;
- switch (e_o365_connection_authenticate_sync (cnc, NULL, E_O365_FOLDER_KIND_MAIL, NULL, NULL, NULL,
NULL, cancellable, error)) {
+ switch (e_m365_connection_authenticate_sync (cnc, NULL, E_M365_FOLDER_KIND_MAIL, NULL, NULL, NULL,
NULL, cancellable, error)) {
case E_SOURCE_AUTHENTICATION_ERROR:
case E_SOURCE_AUTHENTICATION_ERROR_SSL_FAILED:
default:
@@ -606,7 +595,7 @@ o365_store_authenticate_sync (CamelService *service,
case E_SOURCE_AUTHENTICATION_ACCEPTED:
result = CAMEL_AUTHENTICATION_ACCEPTED;
- o365_store_read_default_folders (o365_store, cnc, cancellable, NULL);
+ m365_store_read_default_folders (m365_store, cnc, cancellable, NULL);
break;
case E_SOURCE_AUTHENTICATION_REJECTED:
case E_SOURCE_AUTHENTICATION_REQUIRED:
@@ -620,19 +609,19 @@ o365_store_authenticate_sync (CamelService *service,
}
static CamelFolder *
-o365_store_get_folder_sync (CamelStore *store,
+m365_store_get_folder_sync (CamelStore *store,
const gchar *folder_name,
guint32 flags,
GCancellable *cancellable,
GError **error)
{
- CamelO365Store *o365_store;
+ CamelM365Store *m365_store;
CamelFolder *folder = NULL;
gchar *fid, *folder_dir, *display_name;
- o365_store = CAMEL_O365_STORE (store);
+ m365_store = CAMEL_M365_STORE (store);
- fid = camel_o365_store_summary_dup_folder_id_for_full_name (o365_store->priv->summary, folder_name);
+ fid = camel_m365_store_summary_dup_folder_id_for_full_name (m365_store->priv->summary, folder_name);
if (!fid) {
g_set_error (
@@ -642,10 +631,10 @@ o365_store_get_folder_sync (CamelStore *store,
return NULL;
}
- display_name = camel_o365_store_summary_dup_folder_display_name (o365_store->priv->summary, fid);
- folder_dir = g_build_filename (o365_store->priv->storage_path, "folders", folder_name, NULL);
+ display_name = camel_m365_store_summary_dup_folder_display_name (m365_store->priv->summary, fid);
+ folder_dir = g_build_filename (m365_store->priv->storage_path, "folders", folder_name, NULL);
- folder = camel_o365_folder_new (store, display_name, folder_name, folder_dir, cancellable, error);
+ folder = camel_m365_folder_new (store, display_name, folder_name, folder_dir, cancellable, error);
g_free (display_name);
g_free (folder_dir);
@@ -658,44 +647,44 @@ o365_store_get_folder_sync (CamelStore *store,
}
static void
-o365_store_save_summary (CamelO365StoreSummary *summary,
+m365_store_save_summary (CamelM365StoreSummary *summary,
const gchar *where)
{
GError *error = NULL;
- if (!camel_o365_store_summary_save (summary, &error))
+ if (!camel_m365_store_summary_save (summary, &error))
g_warning ("%s: Failed to save store summary: %s", where, error ? error->message : "Unknown
error");
g_clear_error (&error);
}
static CamelFolderInfo *
-o365_store_create_folder_sync (CamelStore *store,
+m365_store_create_folder_sync (CamelStore *store,
const gchar *parent_name,
const gchar *folder_name,
GCancellable *cancellable,
GError **error)
{
- CamelO365Store *o365_store;
- EO365MailFolder *mail_folder = NULL;
+ CamelM365Store *m365_store;
+ EM365MailFolder *mail_folder = NULL;
gchar *fid = NULL;
gchar *full_name;
- EO365Connection *cnc;
+ EM365Connection *cnc;
CamelFolderInfo *fi = NULL;
guint32 flags;
gboolean success;
GError *local_error = NULL;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (store), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (store), NULL);
- o365_store = CAMEL_O365_STORE (store);
+ m365_store = CAMEL_M365_STORE (store);
if (parent_name && *parent_name)
full_name = g_strdup_printf ("%s/%s", parent_name, folder_name);
else
full_name = g_strdup (folder_name);
- fid = camel_o365_store_summary_dup_folder_id_for_full_name (o365_store->priv->summary, full_name);
+ fid = camel_m365_store_summary_dup_folder_id_for_full_name (m365_store->priv->summary, full_name);
if (fid) {
g_free (fid);
@@ -711,7 +700,7 @@ o365_store_create_folder_sync (CamelStore *store,
/* Get Parent folder ID */
if (parent_name && parent_name[0]) {
- fid = camel_o365_store_summary_dup_folder_id_for_full_name (o365_store->priv->summary,
parent_name);
+ fid = camel_m365_store_summary_dup_folder_id_for_full_name (m365_store->priv->summary,
parent_name);
if (!fid) {
g_set_error (error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
@@ -721,48 +710,48 @@ o365_store_create_folder_sync (CamelStore *store,
}
}
- if (!camel_o365_store_ensure_connected (o365_store, &cnc, cancellable, error)) {
+ if (!camel_m365_store_ensure_connected (m365_store, &cnc, cancellable, error)) {
g_free (fid);
return NULL;
}
- success = e_o365_connection_create_mail_folder_sync (cnc, NULL, fid, folder_name, &mail_folder,
cancellable, &local_error);
+ success = e_m365_connection_create_mail_folder_sync (cnc, NULL, fid, folder_name, &mail_folder,
cancellable, &local_error);
g_object_unref (cnc);
g_free (fid);
if (!success) {
- camel_o365_store_maybe_disconnect (o365_store, local_error);
+ camel_m365_store_maybe_disconnect (m365_store, local_error);
g_propagate_error (error, local_error);
return NULL;
}
- flags = e_o365_mail_folder_get_child_folder_count (mail_folder) ? CAMEL_STORE_INFO_FOLDER_CHILDREN :
CAMEL_STORE_INFO_FOLDER_NOCHILDREN;
+ flags = e_m365_mail_folder_get_child_folder_count (mail_folder) ? CAMEL_STORE_INFO_FOLDER_CHILDREN :
CAMEL_STORE_INFO_FOLDER_NOCHILDREN;
- camel_o365_store_summary_set_folder (o365_store->priv->summary, TRUE,
- e_o365_folder_get_id (mail_folder),
- e_o365_folder_get_parent_folder_id (mail_folder),
- e_o365_folder_get_display_name (mail_folder),
- e_o365_mail_folder_get_total_item_count (mail_folder),
- e_o365_mail_folder_get_unread_item_count (mail_folder),
- flags, E_O365_FOLDER_KIND_MAIL, FALSE, FALSE);
+ camel_m365_store_summary_set_folder (m365_store->priv->summary, TRUE,
+ e_m365_folder_get_id (mail_folder),
+ e_m365_folder_get_parent_folder_id (mail_folder),
+ e_m365_folder_get_display_name (mail_folder),
+ e_m365_mail_folder_get_total_item_count (mail_folder),
+ e_m365_mail_folder_get_unread_item_count (mail_folder),
+ flags, E_M365_FOLDER_KIND_MAIL, FALSE, FALSE);
- fi = camel_o365_store_summary_build_folder_info_for_id (o365_store->priv->summary,
e_o365_folder_get_id (mail_folder));
+ fi = camel_m365_store_summary_build_folder_info_for_id (m365_store->priv->summary,
e_m365_folder_get_id (mail_folder));
camel_store_folder_created (store, fi);
- camel_subscribable_folder_subscribed (CAMEL_SUBSCRIBABLE (o365_store), fi);
+ camel_subscribable_folder_subscribed (CAMEL_SUBSCRIBABLE (m365_store), fi);
json_object_unref (mail_folder);
- o365_store_save_summary (o365_store->priv->summary, G_STRFUNC);
+ m365_store_save_summary (m365_store->priv->summary, G_STRFUNC);
return fi;
}
static void
-o365_store_notify_created_recursive (CamelStore *store,
+m365_store_notify_created_recursive (CamelStore *store,
CamelFolderInfo *folder_info)
{
while (folder_info) {
@@ -770,51 +759,51 @@ o365_store_notify_created_recursive (CamelStore *store,
camel_subscribable_folder_subscribed (CAMEL_SUBSCRIBABLE (store), folder_info);
if (folder_info->child)
- o365_store_notify_created_recursive (store, folder_info->child);
+ m365_store_notify_created_recursive (store, folder_info->child);
folder_info = folder_info->next;
}
}
static gboolean
-o365_store_move_mail_folder (CamelO365Store *o365_store,
- EO365Connection *cnc,
+m365_store_move_mail_folder (CamelM365Store *m365_store,
+ EM365Connection *cnc,
const gchar *folder_id,
const gchar *des_folder_id,
GCancellable *cancellable,
GError **error)
{
- EO365MailFolder *moved_mail_folder = NULL;
+ EM365MailFolder *moved_mail_folder = NULL;
gboolean success;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (o365_store), FALSE);
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (m365_store), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (folder_id != NULL, FALSE);
g_return_val_if_fail (des_folder_id != NULL, FALSE);
g_return_val_if_fail (g_strcmp0 (folder_id, des_folder_id) != 0, FALSE);
- success = e_o365_connection_copy_move_mail_folder_sync (cnc, NULL, folder_id, des_folder_id, FALSE,
&moved_mail_folder, cancellable, error);
+ success = e_m365_connection_copy_move_mail_folder_sync (cnc, NULL, folder_id, des_folder_id, FALSE,
&moved_mail_folder, cancellable, error);
if (success && moved_mail_folder) {
CamelFolderInfo *fi;
gchar *new_full_name;
- fi = camel_o365_store_summary_build_folder_info_for_id (o365_store->priv->summary, folder_id);
+ fi = camel_m365_store_summary_build_folder_info_for_id (m365_store->priv->summary, folder_id);
- camel_o365_store_summary_set_folder_parent_id (o365_store->priv->summary, folder_id,
e_o365_folder_get_parent_folder_id (moved_mail_folder));
- camel_o365_store_summary_rebuild_hashes (o365_store->priv->summary);
+ camel_m365_store_summary_set_folder_parent_id (m365_store->priv->summary, folder_id,
e_m365_folder_get_parent_folder_id (moved_mail_folder));
+ camel_m365_store_summary_rebuild_hashes (m365_store->priv->summary);
- camel_subscribable_folder_unsubscribed (CAMEL_SUBSCRIBABLE (o365_store), fi);
- camel_store_folder_deleted (CAMEL_STORE (o365_store), fi);
+ camel_subscribable_folder_unsubscribed (CAMEL_SUBSCRIBABLE (m365_store), fi);
+ camel_store_folder_deleted (CAMEL_STORE (m365_store), fi);
camel_folder_info_free (fi);
- new_full_name = camel_o365_store_summary_dup_folder_full_name (o365_store->priv->summary,
folder_id);
+ new_full_name = camel_m365_store_summary_dup_folder_full_name (m365_store->priv->summary,
folder_id);
g_warn_if_fail (new_full_name != NULL);
- fi = camel_o365_store_summary_build_folder_info (o365_store->priv->summary, new_full_name,
TRUE);
+ fi = camel_m365_store_summary_build_folder_info (m365_store->priv->summary, new_full_name,
TRUE);
- o365_store_notify_created_recursive (CAMEL_STORE (o365_store), fi);
+ m365_store_notify_created_recursive (CAMEL_STORE (m365_store), fi);
json_object_unref (moved_mail_folder);
camel_folder_info_free (fi);
@@ -825,22 +814,22 @@ o365_store_move_mail_folder (CamelO365Store *o365_store,
}
static void
-o365_store_delete_folders_from_summary_recursive (CamelO365Store *o365_store,
+m365_store_delete_folders_from_summary_recursive (CamelM365Store *m365_store,
CamelFolderInfo *fi,
gboolean send_signals)
{
- CamelStore *store = send_signals ? CAMEL_STORE (o365_store) : NULL;
- CamelSubscribable *subscribable = send_signals ? CAMEL_SUBSCRIBABLE (o365_store) : NULL;
+ CamelStore *store = send_signals ? CAMEL_STORE (m365_store) : NULL;
+ CamelSubscribable *subscribable = send_signals ? CAMEL_SUBSCRIBABLE (m365_store) : NULL;
while (fi) {
gchar *folder_id;
if (fi->child)
- o365_store_delete_folders_from_summary_recursive (o365_store, fi->child,
send_signals);
+ m365_store_delete_folders_from_summary_recursive (m365_store, fi->child,
send_signals);
- folder_id = camel_o365_store_summary_dup_folder_id_for_full_name (o365_store->priv->summary,
fi->full_name);
+ folder_id = camel_m365_store_summary_dup_folder_id_for_full_name (m365_store->priv->summary,
fi->full_name);
if (folder_id) {
- camel_o365_store_summary_remove_folder (o365_store->priv->summary, folder_id);
+ camel_m365_store_summary_remove_folder (m365_store->priv->summary, folder_id);
g_free (folder_id);
}
@@ -854,14 +843,14 @@ o365_store_delete_folders_from_summary_recursive (CamelO365Store *o365_store,
}
static gboolean
-o365_store_delete_folder_sync (CamelStore *store,
+m365_store_delete_folder_sync (CamelStore *store,
const gchar *folder_name,
GCancellable *cancellable,
GError **error)
{
- CamelO365Store *o365_store;
+ CamelM365Store *m365_store;
CamelFolderInfo *folder_info;
- EO365Connection *cnc = NULL;
+ EM365Connection *cnc = NULL;
gchar *folder_id;
gchar *trash_folder_id;
gchar *trash_full_name;
@@ -869,9 +858,9 @@ o365_store_delete_folder_sync (CamelStore *store,
gboolean is_under_trash_folder, claim_unsubscribe = TRUE;
GError *local_error = NULL;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (store), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (store), FALSE);
- o365_store = CAMEL_O365_STORE (store);
+ m365_store = CAMEL_M365_STORE (store);
folder_info = camel_store_get_folder_info_sync (store, folder_name,
CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED,
@@ -884,7 +873,7 @@ o365_store_delete_folder_sync (CamelStore *store,
return FALSE;
}
- folder_id = camel_o365_store_summary_dup_folder_id_for_full_name (o365_store->priv->summary,
folder_name);
+ folder_id = camel_m365_store_summary_dup_folder_id_for_full_name (m365_store->priv->summary,
folder_name);
if (!folder_id) {
camel_folder_info_free (folder_info);
@@ -894,8 +883,8 @@ o365_store_delete_folder_sync (CamelStore *store,
return FALSE;
}
- trash_folder_id = camel_o365_store_summary_dup_folder_id_for_type (o365_store->priv->summary,
CAMEL_FOLDER_TYPE_TRASH);
- trash_full_name = camel_o365_store_summary_dup_folder_full_name (o365_store->priv->summary,
trash_folder_id);
+ trash_folder_id = camel_m365_store_summary_dup_folder_id_for_type (m365_store->priv->summary,
CAMEL_FOLDER_TYPE_TRASH);
+ trash_full_name = camel_m365_store_summary_dup_folder_full_name (m365_store->priv->summary,
trash_folder_id);
if (!trash_full_name) {
camel_folder_info_free (folder_info);
@@ -917,7 +906,7 @@ o365_store_delete_folder_sync (CamelStore *store,
g_free (trash_full_name);
- if (!camel_o365_store_ensure_connected (o365_store, &cnc, cancellable, error)) {
+ if (!camel_m365_store_ensure_connected (m365_store, &cnc, cancellable, error)) {
camel_folder_info_free (folder_info);
g_free (trash_folder_id);
g_free (folder_id);
@@ -925,15 +914,15 @@ o365_store_delete_folder_sync (CamelStore *store,
return FALSE;
}
- if (camel_o365_store_summary_get_folder_is_foreign (o365_store->priv->summary, folder_id) ||
- camel_o365_store_summary_get_folder_is_public (o365_store->priv->summary, folder_id)) {
+ if (camel_m365_store_summary_get_folder_is_foreign (m365_store->priv->summary, folder_id) ||
+ camel_m365_store_summary_get_folder_is_public (m365_store->priv->summary, folder_id)) {
/* do not delete foreign or public folders,
* only remove them from the local cache */
success = TRUE;
} else if (is_under_trash_folder) {
- success = e_o365_connection_delete_mail_folder_sync (cnc, NULL, folder_id, cancellable,
&local_error);
+ success = e_m365_connection_delete_mail_folder_sync (cnc, NULL, folder_id, cancellable,
&local_error);
} else {
- success = o365_store_move_mail_folder (o365_store, cnc, folder_id, "deleteditems",
cancellable, &local_error);
+ success = m365_store_move_mail_folder (m365_store, cnc, folder_id, "deleteditems",
cancellable, &local_error);
claim_unsubscribe = FALSE;
}
@@ -944,23 +933,23 @@ o365_store_delete_folder_sync (CamelStore *store,
g_free (trash_folder_id);
g_free (folder_id);
- camel_o365_store_maybe_disconnect (o365_store, local_error);
+ camel_m365_store_maybe_disconnect (m365_store, local_error);
g_propagate_error (error, local_error);
return FALSE;
}
if (is_under_trash_folder)
- o365_store_delete_folders_from_summary_recursive (o365_store, folder_info, FALSE);
+ m365_store_delete_folders_from_summary_recursive (m365_store, folder_info, FALSE);
if (claim_unsubscribe) {
- camel_subscribable_folder_unsubscribed (CAMEL_SUBSCRIBABLE (o365_store), folder_info);
+ camel_subscribable_folder_unsubscribed (CAMEL_SUBSCRIBABLE (m365_store), folder_info);
camel_store_folder_deleted (store, folder_info);
}
camel_folder_info_free (folder_info);
- o365_store_save_summary (o365_store->priv->summary, G_STRFUNC);
+ m365_store_save_summary (m365_store->priv->summary, G_STRFUNC);
g_free (trash_folder_id);
g_free (folder_id);
@@ -969,27 +958,27 @@ o365_store_delete_folder_sync (CamelStore *store,
}
static gboolean
-o365_store_rename_folder_sync (CamelStore *store,
+m365_store_rename_folder_sync (CamelStore *store,
const gchar *old_name,
const gchar *new_name,
GCancellable *cancellable,
GError **error)
{
- CamelO365Store *o365_store;
- EO365Connection *cnc;
+ CamelM365Store *m365_store;
+ EM365Connection *cnc;
const gchar *old_slash, *new_slash;
gint parent_len;
gchar *folder_id;
gboolean success = TRUE;
GError *local_error = NULL;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (store), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (store), FALSE);
if (!g_strcmp0 (old_name, new_name))
return TRUE;
- o365_store = CAMEL_O365_STORE (store);
- folder_id = camel_o365_store_summary_dup_folder_id_for_full_name (o365_store->priv->summary,
old_name);
+ m365_store = CAMEL_M365_STORE (store);
+ folder_id = camel_m365_store_summary_dup_folder_id_for_full_name (m365_store->priv->summary,
old_name);
if (!folder_id) {
g_set_error (error, CAMEL_STORE_ERROR, CAMEL_STORE_ERROR_NO_FOLDER,
@@ -998,7 +987,7 @@ o365_store_rename_folder_sync (CamelStore *store,
return FALSE;
}
- if (!camel_o365_store_ensure_connected (o365_store, &cnc, cancellable, error)) {
+ if (!camel_m365_store_ensure_connected (m365_store, &cnc, cancellable, error)) {
g_free (folder_id);
return FALSE;
}
@@ -1027,7 +1016,7 @@ o365_store_rename_folder_sync (CamelStore *store,
gchar *new_parent;
new_parent = g_strndup (new_name, new_slash - new_name - 1);
- new_parent_id = camel_o365_store_summary_dup_folder_id_for_full_name
(o365_store->priv->summary, new_parent);
+ new_parent_id = camel_m365_store_summary_dup_folder_id_for_full_name
(m365_store->priv->summary, new_parent);
if (!new_parent_id) {
g_set_error (error, CAMEL_STORE_ERROR, CAMEL_STORE_ERROR_NO_FOLDER,
@@ -1044,20 +1033,20 @@ o365_store_rename_folder_sync (CamelStore *store,
new_parent_id = NULL;
}
- success = o365_store_move_mail_folder (o365_store, cnc, folder_id, new_parent_id ?
new_parent_id : "msgfolderroot", cancellable, &local_error);
+ success = m365_store_move_mail_folder (m365_store, cnc, folder_id, new_parent_id ?
new_parent_id : "msgfolderroot", cancellable, &local_error);
g_free (new_parent_id);
}
/* Then rename the folder, if needed */
if (success && g_strcmp0 (old_slash, new_slash) != 0) {
- EO365MailFolder *mail_folder = NULL;
+ EM365MailFolder *mail_folder = NULL;
- success = e_o365_connection_rename_mail_folder_sync (cnc, NULL, folder_id, new_slash,
&mail_folder, cancellable, &local_error);
+ success = e_m365_connection_rename_mail_folder_sync (cnc, NULL, folder_id, new_slash,
&mail_folder, cancellable, &local_error);
if (mail_folder) {
- camel_o365_store_summary_set_folder_display_name (o365_store->priv->summary,
folder_id,
- e_o365_folder_get_display_name (mail_folder), TRUE);
+ camel_m365_store_summary_set_folder_display_name (m365_store->priv->summary,
folder_id,
+ e_m365_folder_get_display_name (mail_folder), TRUE);
json_object_unref (mail_folder);
}
@@ -1066,7 +1055,7 @@ o365_store_rename_folder_sync (CamelStore *store,
if (success) {
CamelFolderInfo *fi;
- fi = camel_o365_store_summary_build_folder_info_for_id (o365_store->priv->summary, folder_id);
+ fi = camel_m365_store_summary_build_folder_info_for_id (m365_store->priv->summary, folder_id);
if (fi) {
camel_store_folder_renamed (store, old_name, fi);
@@ -1074,10 +1063,10 @@ o365_store_rename_folder_sync (CamelStore *store,
}
}
- o365_store_save_summary (o365_store->priv->summary, G_STRFUNC);
+ m365_store_save_summary (m365_store->priv->summary, G_STRFUNC);
if (!success && local_error) {
- camel_o365_store_maybe_disconnect (o365_store, local_error);
+ camel_m365_store_maybe_disconnect (m365_store, local_error);
g_propagate_error (error, local_error);
}
@@ -1117,14 +1106,14 @@ folder_renamed_data_free (gpointer ptr)
}
typedef struct _FoldersDeltaData {
- CamelO365Store *o365_store;
+ CamelM365Store *m365_store;
GSList *added_ids; /* gchar *, folder ids */
GSList *renamed_data; /* FolderRenamedData * */
GSList *removed_fis; /* CamelFolderInfo * */
} FoldersDeltaData;
static gboolean
-camel_o365_got_folders_delta_cb (EO365Connection *cnc,
+camel_m365_got_folders_delta_cb (EM365Connection *cnc,
const GSList *results, /* JsonObject * - the returned objects from the
server */
gpointer user_data,
GCancellable *cancellable,
@@ -1135,38 +1124,38 @@ camel_o365_got_folders_delta_cb (EO365Connection *cnc,
g_return_val_if_fail (fdd, FALSE);
- LOCK (fdd->o365_store);
+ LOCK (fdd->m365_store);
for (link = (GSList *) results; link; link = g_slist_next (link)) {
JsonObject *object = link->data;
- const gchar *id = e_o365_folder_get_id (object);
+ const gchar *id = e_m365_folder_get_id (object);
- if (e_o365_delta_is_removed_object (object)) {
+ if (e_m365_delta_is_removed_object (object)) {
CamelFolderInfo *info;
- info = camel_o365_store_summary_build_folder_info_for_id
(fdd->o365_store->priv->summary, id);
+ info = camel_m365_store_summary_build_folder_info_for_id
(fdd->m365_store->priv->summary, id);
if (info)
fdd->removed_fis = g_slist_prepend (fdd->removed_fis, info);
- camel_o365_store_summary_remove_folder (fdd->o365_store->priv->summary, id);
+ camel_m365_store_summary_remove_folder (fdd->m365_store->priv->summary, id);
} else {
gchar *old_full_name = NULL;
guint32 flags;
- if (camel_o365_store_summary_has_folder (fdd->o365_store->priv->summary, id))
- old_full_name = camel_o365_store_summary_dup_folder_full_name
(fdd->o365_store->priv->summary, id);
+ if (camel_m365_store_summary_has_folder (fdd->m365_store->priv->summary, id))
+ old_full_name = camel_m365_store_summary_dup_folder_full_name
(fdd->m365_store->priv->summary, id);
- flags = e_o365_mail_folder_get_child_folder_count (object) ?
CAMEL_STORE_INFO_FOLDER_CHILDREN : CAMEL_STORE_INFO_FOLDER_NOCHILDREN;
+ flags = e_m365_mail_folder_get_child_folder_count (object) ?
CAMEL_STORE_INFO_FOLDER_CHILDREN : CAMEL_STORE_INFO_FOLDER_NOCHILDREN;
- flags |= GPOINTER_TO_UINT (g_hash_table_lookup
(fdd->o365_store->priv->default_folders, id));
+ flags |= GPOINTER_TO_UINT (g_hash_table_lookup
(fdd->m365_store->priv->default_folders, id));
- camel_o365_store_summary_set_folder (fdd->o365_store->priv->summary, FALSE, id,
- e_o365_folder_get_parent_folder_id (object),
- e_o365_folder_get_display_name (object),
- e_o365_mail_folder_get_total_item_count (object),
- e_o365_mail_folder_get_unread_item_count (object),
- flags, E_O365_FOLDER_KIND_MAIL, FALSE, FALSE);
+ camel_m365_store_summary_set_folder (fdd->m365_store->priv->summary, FALSE, id,
+ e_m365_folder_get_parent_folder_id (object),
+ e_m365_folder_get_display_name (object),
+ e_m365_mail_folder_get_total_item_count (object),
+ e_m365_mail_folder_get_unread_item_count (object),
+ flags, E_M365_FOLDER_KIND_MAIL, FALSE, FALSE);
if (old_full_name)
fdd->renamed_data = g_slist_prepend (fdd->renamed_data,
folder_renamed_data_new (g_strdup (id), old_full_name));
@@ -1175,23 +1164,23 @@ camel_o365_got_folders_delta_cb (EO365Connection *cnc,
}
}
- UNLOCK (fdd->o365_store);
+ UNLOCK (fdd->m365_store);
return TRUE;
}
static void
-o365_store_forget_all_folders (CamelO365Store *o365_store)
+m365_store_forget_all_folders (CamelM365Store *m365_store)
{
CamelStore *store;
CamelSubscribable *subscribable;
GSList *ids, *link;
- g_return_if_fail (CAMEL_IS_O365_STORE (o365_store));
+ g_return_if_fail (CAMEL_IS_M365_STORE (m365_store));
- store = CAMEL_STORE (o365_store);
- subscribable = CAMEL_SUBSCRIBABLE (o365_store);
- ids = camel_o365_store_summary_list_folder_ids (o365_store->priv->summary);
+ store = CAMEL_STORE (m365_store);
+ subscribable = CAMEL_SUBSCRIBABLE (m365_store);
+ ids = camel_m365_store_summary_list_folder_ids (m365_store->priv->summary);
if (!ids)
return;
@@ -1200,7 +1189,7 @@ o365_store_forget_all_folders (CamelO365Store *o365_store)
const gchar *id = link->data;
CamelFolderInfo *fi;
- fi = camel_o365_store_summary_build_folder_info_for_id (o365_store->priv->summary, id);
+ fi = camel_m365_store_summary_build_folder_info_for_id (m365_store->priv->summary, id);
camel_subscribable_folder_unsubscribed (subscribable, fi);
camel_store_folder_deleted (store, fi);
camel_folder_info_free (fi);
@@ -1208,26 +1197,26 @@ o365_store_forget_all_folders (CamelO365Store *o365_store)
g_slist_free_full (ids, g_free);
- camel_o365_store_summary_set_delta_link (o365_store->priv->summary, "");
- camel_o365_store_summary_clear (o365_store->priv->summary);
+ camel_m365_store_summary_set_delta_link (m365_store->priv->summary, "");
+ camel_m365_store_summary_clear (m365_store->priv->summary);
}
static CamelFolderInfo *
-o365_store_get_folder_info_sync (CamelStore *store,
+m365_store_get_folder_info_sync (CamelStore *store,
const gchar *top,
guint32 flags,
GCancellable *cancellable,
GError **error)
{
- CamelO365Store *o365_store;
+ CamelM365Store *m365_store;
CamelFolderInfo *fi;
gboolean success = TRUE;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (store), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (store), NULL);
- o365_store = CAMEL_O365_STORE (store);
+ m365_store = CAMEL_M365_STORE (store);
- if (camel_offline_store_get_online (CAMEL_OFFLINE_STORE (o365_store))) {
+ if (camel_offline_store_get_online (CAMEL_OFFLINE_STORE (m365_store))) {
gboolean refresh_online;
refresh_online = !(flags & CAMEL_STORE_FOLDER_INFO_FAST) ||
@@ -1236,68 +1225,68 @@ o365_store_get_folder_info_sync (CamelStore *store,
if (!refresh_online) {
gchar *delta_link;
- LOCK (o365_store);
+ LOCK (m365_store);
- delta_link = camel_o365_store_summary_dup_delta_link (o365_store->priv->summary);
+ delta_link = camel_m365_store_summary_dup_delta_link (m365_store->priv->summary);
refresh_online = !delta_link || !*delta_link;
g_free (delta_link);
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
}
if (refresh_online) {
- EO365Connection *cnc;
+ EM365Connection *cnc;
- cnc = camel_o365_store_ref_connection (o365_store);
+ cnc = camel_m365_store_ref_connection (m365_store);
if (cnc) {
FoldersDeltaData fdd;
gchar *old_delta_link, *new_delta_link = NULL;
GError *local_error = NULL;
- LOCK (o365_store);
+ LOCK (m365_store);
- old_delta_link = camel_o365_store_summary_dup_delta_link
(o365_store->priv->summary);
+ old_delta_link = camel_m365_store_summary_dup_delta_link
(m365_store->priv->summary);
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
- fdd.o365_store = o365_store;
+ fdd.m365_store = m365_store;
fdd.added_ids = NULL;
fdd.renamed_data = NULL;
fdd.removed_fis = NULL;
- success = e_o365_connection_get_folders_delta_sync (cnc, NULL,
E_O365_FOLDER_KIND_MAIL, NULL, old_delta_link, 0,
- camel_o365_got_folders_delta_cb, &fdd, &new_delta_link, cancellable,
&local_error);
+ success = e_m365_connection_get_folders_delta_sync (cnc, NULL,
E_M365_FOLDER_KIND_MAIL, NULL, old_delta_link, 0,
+ camel_m365_got_folders_delta_cb, &fdd, &new_delta_link, cancellable,
&local_error);
- if (old_delta_link && *old_delta_link &&
e_o365_connection_util_delta_token_failed (local_error)) {
+ if (old_delta_link && *old_delta_link &&
e_m365_connection_util_delta_token_failed (local_error)) {
g_clear_pointer (&old_delta_link, g_free);
g_clear_error (&local_error);
- o365_store_forget_all_folders (o365_store);
+ m365_store_forget_all_folders (m365_store);
- success = e_o365_connection_get_folders_delta_sync (cnc, NULL,
E_O365_FOLDER_KIND_MAIL, NULL, NULL, 0,
- camel_o365_got_folders_delta_cb, &fdd, &new_delta_link,
cancellable, error);
+ success = e_m365_connection_get_folders_delta_sync (cnc, NULL,
E_M365_FOLDER_KIND_MAIL, NULL, NULL, 0,
+ camel_m365_got_folders_delta_cb, &fdd, &new_delta_link,
cancellable, error);
}
if (local_error)
g_propagate_error (error, local_error);
if (success) {
- CamelSubscribable *subscribable = CAMEL_SUBSCRIBABLE (o365_store);
+ CamelSubscribable *subscribable = CAMEL_SUBSCRIBABLE (m365_store);
CamelFolderInfo *info;
GSList *link;
- LOCK (o365_store);
+ LOCK (m365_store);
- camel_o365_store_summary_set_delta_link (o365_store->priv->summary,
new_delta_link);
- o365_store_save_summary (o365_store->priv->summary, G_STRFUNC);
+ camel_m365_store_summary_set_delta_link (m365_store->priv->summary,
new_delta_link);
+ m365_store_save_summary (m365_store->priv->summary, G_STRFUNC);
fdd.added_ids = g_slist_reverse (fdd.added_ids);
fdd.renamed_data = g_slist_reverse (fdd.renamed_data);
fdd.removed_fis = g_slist_reverse (fdd.removed_fis);
if (fdd.added_ids || fdd.renamed_data || fdd.removed_fis)
- camel_o365_store_summary_rebuild_hashes
(o365_store->priv->summary);
+ camel_m365_store_summary_rebuild_hashes
(m365_store->priv->summary);
for (link = fdd.removed_fis; link; link = g_slist_next (link)) {
info = link->data;
@@ -1309,7 +1298,7 @@ o365_store_get_folder_info_sync (CamelStore *store,
for (link = fdd.added_ids; link; link = g_slist_next (link)) {
const gchar *id = link->data;
- info = camel_o365_store_summary_build_folder_info_for_id
(o365_store->priv->summary, id);
+ info = camel_m365_store_summary_build_folder_info_for_id
(m365_store->priv->summary, id);
if (info) {
camel_store_folder_created (store, info);
@@ -1321,7 +1310,7 @@ o365_store_get_folder_info_sync (CamelStore *store,
for (link = fdd.renamed_data; link; link = g_slist_next (link)) {
const FolderRenamedData *frd = link->data;
- info = camel_o365_store_summary_build_folder_info_for_id
(o365_store->priv->summary, frd->id);
+ info = camel_m365_store_summary_build_folder_info_for_id
(m365_store->priv->summary, frd->id);
if (info) {
camel_store_folder_renamed (store, frd->old_name,
info);
@@ -1329,7 +1318,7 @@ o365_store_get_folder_info_sync (CamelStore *store,
}
}
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
}
g_slist_free_full (fdd.added_ids, g_free);
@@ -1344,11 +1333,11 @@ o365_store_get_folder_info_sync (CamelStore *store,
}
if (success) {
- LOCK (o365_store);
+ LOCK (m365_store);
- fi = camel_o365_store_summary_build_folder_info (o365_store->priv->summary, top, (flags &
CAMEL_STORE_FOLDER_INFO_RECURSIVE) != 0);
+ fi = camel_m365_store_summary_build_folder_info (m365_store->priv->summary, top, (flags &
CAMEL_STORE_FOLDER_INFO_RECURSIVE) != 0);
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
} else {
fi = NULL;
}
@@ -1358,24 +1347,24 @@ o365_store_get_folder_info_sync (CamelStore *store,
/* Hold the property lock before calling this function */
static void
-o365_store_save_setup_folder_locked (CamelO365Store *o365_store,
+m365_store_save_setup_folder_locked (CamelM365Store *m365_store,
GHashTable *save_setup,
guint32 folder_type, /* one of TYPE constants from CamelFolderInfoFlags
*/
const gchar *property_name)
{
gchar *folder_id;
- g_return_if_fail (CAMEL_IS_O365_STORE (o365_store));
+ g_return_if_fail (CAMEL_IS_M365_STORE (m365_store));
g_return_if_fail (save_setup != NULL);
g_return_if_fail (folder_type != 0);
g_return_if_fail (property_name != NULL);
- folder_id = camel_o365_store_summary_dup_folder_id_for_type (o365_store->priv->summary, folder_type);
+ folder_id = camel_m365_store_summary_dup_folder_id_for_type (m365_store->priv->summary, folder_type);
if (folder_id) {
gchar *fullname;
- fullname = camel_o365_store_summary_dup_folder_full_name (o365_store->priv->summary,
folder_id);
+ fullname = camel_m365_store_summary_dup_folder_full_name (m365_store->priv->summary,
folder_id);
if (fullname && *fullname) {
g_hash_table_insert (save_setup,
@@ -1391,43 +1380,43 @@ o365_store_save_setup_folder_locked (CamelO365Store *o365_store,
}
static gboolean
-o365_store_initial_setup_with_connection_sync (CamelStore *store,
+m365_store_initial_setup_with_connection_sync (CamelStore *store,
GHashTable *save_setup,
- EO365Connection *cnc,
+ EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
- CamelO365Store *o365_store;
+ CamelM365Store *m365_store;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (store), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (store), FALSE);
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
- o365_store = CAMEL_O365_STORE (store);
+ m365_store = CAMEL_M365_STORE (store);
if (cnc) {
g_object_ref (cnc);
} else {
- if (!camel_o365_store_ensure_connected (o365_store, &cnc, cancellable, error))
+ if (!camel_m365_store_ensure_connected (m365_store, &cnc, cancellable, error))
return FALSE;
g_return_val_if_fail (cnc != NULL, FALSE);
}
- if (!o365_store_read_default_folders (o365_store, cnc, cancellable, error)) {
+ if (!m365_store_read_default_folders (m365_store, cnc, cancellable, error)) {
g_clear_object (&cnc);
return FALSE;
}
if (save_setup) {
- LOCK (o365_store);
+ LOCK (m365_store);
- o365_store_save_setup_folder_locked (o365_store, save_setup, CAMEL_FOLDER_TYPE_SENT,
CAMEL_STORE_SETUP_SENT_FOLDER);
- o365_store_save_setup_folder_locked (o365_store, save_setup, CAMEL_FOLDER_TYPE_DRAFTS,
CAMEL_STORE_SETUP_DRAFTS_FOLDER);
- o365_store_save_setup_folder_locked (o365_store, save_setup, CAMEL_FOLDER_TYPE_ARCHIVE,
CAMEL_STORE_SETUP_ARCHIVE_FOLDER);
+ m365_store_save_setup_folder_locked (m365_store, save_setup, CAMEL_FOLDER_TYPE_SENT,
CAMEL_STORE_SETUP_SENT_FOLDER);
+ m365_store_save_setup_folder_locked (m365_store, save_setup, CAMEL_FOLDER_TYPE_DRAFTS,
CAMEL_STORE_SETUP_DRAFTS_FOLDER);
+ m365_store_save_setup_folder_locked (m365_store, save_setup, CAMEL_FOLDER_TYPE_ARCHIVE,
CAMEL_STORE_SETUP_ARCHIVE_FOLDER);
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
}
g_clear_object (&cnc);
@@ -1436,40 +1425,40 @@ o365_store_initial_setup_with_connection_sync (CamelStore *store,
}
static gboolean
-o365_store_initial_setup_sync (CamelStore *store,
+m365_store_initial_setup_sync (CamelStore *store,
GHashTable *save_setup,
GCancellable *cancellable,
GError **error)
{
- return o365_store_initial_setup_with_connection_sync (store, save_setup, NULL, cancellable, error);
+ return m365_store_initial_setup_with_connection_sync (store, save_setup, NULL, cancellable, error);
}
static CamelFolder *
-o365_store_get_trash_folder_sync (CamelStore *store,
+m365_store_get_trash_folder_sync (CamelStore *store,
GCancellable *cancellable,
GError **error)
{
- CamelO365Store *o365_store;
+ CamelM365Store *m365_store;
CamelFolder *folder = NULL;
gchar *folder_id, *folder_name;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (store), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (store), NULL);
- o365_store = CAMEL_O365_STORE (store);
+ m365_store = CAMEL_M365_STORE (store);
- LOCK (o365_store);
+ LOCK (m365_store);
- folder_id = camel_o365_store_summary_dup_folder_id_for_type (o365_store->priv->summary,
CAMEL_FOLDER_TYPE_TRASH);
+ folder_id = camel_m365_store_summary_dup_folder_id_for_type (m365_store->priv->summary,
CAMEL_FOLDER_TYPE_TRASH);
if (!folder_id) {
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
g_set_error_literal (error, CAMEL_STORE_ERROR, CAMEL_STORE_ERROR_NO_FOLDER, _("Could not
locate Trash folder"));
return NULL;
}
- folder_name = camel_o365_store_summary_dup_folder_full_name (o365_store->priv->summary, folder_id);
+ folder_name = camel_m365_store_summary_dup_folder_full_name (m365_store->priv->summary, folder_id);
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
folder = camel_store_get_folder_sync (store, folder_name, 0, cancellable, error);
@@ -1506,26 +1495,26 @@ o365_store_get_trash_folder_sync (CamelStore *store,
}
static CamelFolder *
-o365_store_get_junk_folder_sync (CamelStore *store,
+m365_store_get_junk_folder_sync (CamelStore *store,
GCancellable *cancellable,
GError **error)
{
- CamelO365Store *o365_store;
+ CamelM365Store *m365_store;
CamelFolder *folder = NULL;
gchar *folder_id, *folder_name;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (store), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (store), NULL);
- o365_store = CAMEL_O365_STORE (store);
+ m365_store = CAMEL_M365_STORE (store);
- folder_id = camel_o365_store_summary_dup_folder_id_for_type (o365_store->priv->summary,
CAMEL_FOLDER_TYPE_JUNK);
+ folder_id = camel_m365_store_summary_dup_folder_id_for_type (m365_store->priv->summary,
CAMEL_FOLDER_TYPE_JUNK);
if (!folder_id) {
g_set_error_literal (error, CAMEL_STORE_ERROR, CAMEL_STORE_ERROR_NO_FOLDER, _("Could not
locate Junk folder"));
return NULL;
}
- folder_name = camel_o365_store_summary_dup_folder_full_name (o365_store->priv->summary, folder_id);
+ folder_name = camel_m365_store_summary_dup_folder_full_name (m365_store->priv->summary, folder_id);
folder = camel_store_get_folder_sync (store, folder_name, 0, cancellable, error);
@@ -1536,12 +1525,12 @@ o365_store_get_junk_folder_sync (CamelStore *store,
}
static gboolean
-o365_store_can_refresh_folder (CamelStore *store,
+m365_store_can_refresh_folder (CamelStore *store,
CamelFolderInfo *info,
GError **error)
{
CamelSettings *settings;
- CamelO365Settings *o365_settings;
+ CamelM365Settings *m365_settings;
gboolean check_all;
/* Skip unselectable folders from automatic refresh */
@@ -1550,8 +1539,8 @@ o365_store_can_refresh_folder (CamelStore *store,
settings = camel_service_ref_settings (CAMEL_SERVICE (store));
- o365_settings = CAMEL_O365_SETTINGS (settings);
- check_all = camel_o365_settings_get_check_all (o365_settings);
+ m365_settings = CAMEL_M365_SETTINGS (settings);
+ check_all = camel_m365_settings_get_check_all (m365_settings);
g_object_unref (settings);
@@ -1559,20 +1548,20 @@ o365_store_can_refresh_folder (CamelStore *store,
return TRUE;
/* Delegate decision to parent class */
- return CAMEL_STORE_CLASS (camel_o365_store_parent_class)->can_refresh_folder (store, info, error);
+ return CAMEL_STORE_CLASS (camel_m365_store_parent_class)->can_refresh_folder (store, info, error);
}
static gboolean
-o365_store_folder_is_subscribed (CamelSubscribable *subscribable,
+m365_store_folder_is_subscribed (CamelSubscribable *subscribable,
const gchar *folder_name)
{
- CamelO365Store *o365_store = CAMEL_O365_STORE (subscribable);
+ CamelM365Store *m365_store = CAMEL_M365_STORE (subscribable);
- return camel_o365_store_summary_has_full_name (o365_store->priv->summary, folder_name);
+ return camel_m365_store_summary_has_full_name (m365_store->priv->summary, folder_name);
}
static gboolean
-o365_store_subscribe_folder_sync (CamelSubscribable *subscribable,
+m365_store_subscribe_folder_sync (CamelSubscribable *subscribable,
const gchar *folder_name,
GCancellable *cancellable,
GError **error)
@@ -1581,7 +1570,7 @@ o365_store_subscribe_folder_sync (CamelSubscribable *subscribable,
}
static gboolean
-o365_store_unsubscribe_folder_sync (CamelSubscribable *subscribable,
+m365_store_unsubscribe_folder_sync (CamelSubscribable *subscribable,
const gchar *folder_name,
GCancellable *cancellable,
GError **error)
@@ -1590,7 +1579,7 @@ o365_store_unsubscribe_folder_sync (CamelSubscribable *subscribable,
}
static void
-o365_store_set_property (GObject *object,
+m365_store_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
@@ -1607,7 +1596,7 @@ o365_store_set_property (GObject *object,
}
static void
-o365_store_get_property (GObject *object,
+m365_store_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
@@ -1631,52 +1620,52 @@ o365_store_get_property (GObject *object,
}
static void
-o365_store_dispose (GObject *object)
+m365_store_dispose (GObject *object)
{
- CamelO365Store *o365_store = CAMEL_O365_STORE (object);
+ CamelM365Store *m365_store = CAMEL_M365_STORE (object);
- LOCK (o365_store);
+ LOCK (m365_store);
- if (o365_store->priv->summary) {
- o365_store_save_summary (o365_store->priv->summary, G_STRFUNC);
- g_clear_object (&o365_store->priv->summary);
+ if (m365_store->priv->summary) {
+ m365_store_save_summary (m365_store->priv->summary, G_STRFUNC);
+ g_clear_object (&m365_store->priv->summary);
}
- g_clear_object (&o365_store->priv->cnc);
+ g_clear_object (&m365_store->priv->cnc);
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_store_parent_class)->dispose (object);
+ G_OBJECT_CLASS (camel_m365_store_parent_class)->dispose (object);
}
static void
-o365_store_finalize (GObject *object)
+m365_store_finalize (GObject *object)
{
- CamelO365Store *o365_store;
+ CamelM365Store *m365_store;
- o365_store = CAMEL_O365_STORE (object);
+ m365_store = CAMEL_M365_STORE (object);
- g_rec_mutex_clear (&o365_store->priv->property_lock);
- g_hash_table_destroy (o365_store->priv->default_folders);
- g_free (o365_store->priv->storage_path);
+ g_rec_mutex_clear (&m365_store->priv->property_lock);
+ g_hash_table_destroy (m365_store->priv->default_folders);
+ g_free (m365_store->priv->storage_path);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_store_parent_class)->finalize (object);
+ G_OBJECT_CLASS (camel_m365_store_parent_class)->finalize (object);
}
static void
-camel_o365_store_class_init (CamelO365StoreClass *class)
+camel_m365_store_class_init (CamelM365StoreClass *class)
{
GObjectClass *object_class;
CamelServiceClass *service_class;
CamelStoreClass *store_class;
object_class = G_OBJECT_CLASS (class);
- object_class->set_property = o365_store_set_property;
- object_class->get_property = o365_store_get_property;
- object_class->dispose = o365_store_dispose;
- object_class->finalize = o365_store_finalize;
+ object_class->set_property = m365_store_set_property;
+ object_class->get_property = m365_store_get_property;
+ object_class->dispose = m365_store_dispose;
+ object_class->finalize = m365_store_finalize;
/* Inherited from CamelNetworkService */
g_object_class_override_property (
@@ -1691,106 +1680,106 @@ camel_o365_store_class_init (CamelO365StoreClass *class)
"host-reachable");
service_class = CAMEL_SERVICE_CLASS (class);
- service_class->settings_type = CAMEL_TYPE_O365_SETTINGS;
- service_class->query_auth_types_sync = o365_store_query_auth_types_sync;
- service_class->get_name = o365_store_get_name;
- service_class->connect_sync = o365_store_connect_sync;
- service_class->disconnect_sync = o365_store_disconnect_sync;
- service_class->authenticate_sync = o365_store_authenticate_sync;
+ service_class->settings_type = CAMEL_TYPE_M365_SETTINGS;
+ service_class->query_auth_types_sync = m365_store_query_auth_types_sync;
+ service_class->get_name = m365_store_get_name;
+ service_class->connect_sync = m365_store_connect_sync;
+ service_class->disconnect_sync = m365_store_disconnect_sync;
+ service_class->authenticate_sync = m365_store_authenticate_sync;
store_class = CAMEL_STORE_CLASS (class);
- store_class->get_folder_sync = o365_store_get_folder_sync;
- store_class->create_folder_sync = o365_store_create_folder_sync;
- store_class->delete_folder_sync = o365_store_delete_folder_sync;
- store_class->rename_folder_sync = o365_store_rename_folder_sync;
- store_class->get_folder_info_sync = o365_store_get_folder_info_sync;
- store_class->initial_setup_sync = o365_store_initial_setup_sync;
- store_class->get_trash_folder_sync = o365_store_get_trash_folder_sync;
- store_class->get_junk_folder_sync = o365_store_get_junk_folder_sync;
- store_class->can_refresh_folder = o365_store_can_refresh_folder;
+ store_class->get_folder_sync = m365_store_get_folder_sync;
+ store_class->create_folder_sync = m365_store_create_folder_sync;
+ store_class->delete_folder_sync = m365_store_delete_folder_sync;
+ store_class->rename_folder_sync = m365_store_rename_folder_sync;
+ store_class->get_folder_info_sync = m365_store_get_folder_info_sync;
+ store_class->initial_setup_sync = m365_store_initial_setup_sync;
+ store_class->get_trash_folder_sync = m365_store_get_trash_folder_sync;
+ store_class->get_junk_folder_sync = m365_store_get_junk_folder_sync;
+ store_class->can_refresh_folder = m365_store_can_refresh_folder;
}
static void
-camel_o365_store_initable_init (GInitableIface *iface)
+camel_m365_store_initable_init (GInitableIface *iface)
{
parent_initable_interface = g_type_interface_peek_parent (iface);
- iface->init = o365_store_initable_init;
+ iface->init = m365_store_initable_init;
}
static void
-camel_o365_subscribable_init (CamelSubscribableInterface *iface)
+camel_m365_subscribable_init (CamelSubscribableInterface *iface)
{
- iface->folder_is_subscribed = o365_store_folder_is_subscribed;
- iface->subscribe_folder_sync = o365_store_subscribe_folder_sync;
- iface->unsubscribe_folder_sync = o365_store_unsubscribe_folder_sync;
+ iface->folder_is_subscribed = m365_store_folder_is_subscribed;
+ iface->subscribe_folder_sync = m365_store_subscribe_folder_sync;
+ iface->unsubscribe_folder_sync = m365_store_unsubscribe_folder_sync;
}
static void
-camel_o365_store_init (CamelO365Store *o365_store)
+camel_m365_store_init (CamelM365Store *m365_store)
{
- o365_store->priv = camel_o365_store_get_instance_private (o365_store);
+ m365_store->priv = camel_m365_store_get_instance_private (m365_store);
- g_rec_mutex_init (&o365_store->priv->property_lock);
- o365_store->priv->default_folders = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ g_rec_mutex_init (&m365_store->priv->property_lock);
+ m365_store->priv->default_folders = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
}
-CamelO365StoreSummary *
-camel_o365_store_ref_store_summary (CamelO365Store *o365_store)
+CamelM365StoreSummary *
+camel_m365_store_ref_store_summary (CamelM365Store *m365_store)
{
- CamelO365StoreSummary *summary;
+ CamelM365StoreSummary *summary;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (o365_store), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (m365_store), NULL);
- LOCK (o365_store);
+ LOCK (m365_store);
- summary = o365_store->priv->summary;
+ summary = m365_store->priv->summary;
if (summary)
g_object_ref (summary);
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
return summary;
}
-EO365Connection *
-camel_o365_store_ref_connection (CamelO365Store *o365_store)
+EM365Connection *
+camel_m365_store_ref_connection (CamelM365Store *m365_store)
{
- EO365Connection *cnc = NULL;
+ EM365Connection *cnc = NULL;
- g_return_val_if_fail (CAMEL_IS_O365_STORE (o365_store), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (m365_store), NULL);
- LOCK (o365_store);
+ LOCK (m365_store);
- if (o365_store->priv->cnc)
- cnc = g_object_ref (o365_store->priv->cnc);
+ if (m365_store->priv->cnc)
+ cnc = g_object_ref (m365_store->priv->cnc);
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
return cnc;
}
gboolean
-camel_o365_store_ensure_connected (CamelO365Store *o365_store,
- EO365Connection **out_cnc, /* out, nullable, transfer full */
+camel_m365_store_ensure_connected (CamelM365Store *m365_store,
+ EM365Connection **out_cnc, /* out, nullable, transfer full */
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (CAMEL_IS_O365_STORE (o365_store), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_STORE (m365_store), FALSE);
- if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (o365_store))) {
+ if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (m365_store))) {
g_set_error_literal (error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_UNAVAILABLE,
_("You must be working online to complete this operation"));
return FALSE;
}
- if (!camel_service_connect_sync ((CamelService *) o365_store, cancellable, error))
+ if (!camel_service_connect_sync ((CamelService *) m365_store, cancellable, error))
return FALSE;
if (out_cnc) {
- *out_cnc = camel_o365_store_ref_connection (o365_store);
+ *out_cnc = camel_m365_store_ref_connection (m365_store);
if (!*out_cnc) {
g_set_error_literal (error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_UNAVAILABLE,
@@ -1804,39 +1793,39 @@ camel_o365_store_ensure_connected (CamelO365Store *o365_store,
}
void
-camel_o365_store_maybe_disconnect (CamelO365Store *o365_store,
+camel_m365_store_maybe_disconnect (CamelM365Store *m365_store,
const GError *error)
{
CamelService *service;
- g_return_if_fail (CAMEL_IS_O365_STORE (o365_store));
+ g_return_if_fail (CAMEL_IS_M365_STORE (m365_store));
if (!error)
return;
- service = CAMEL_SERVICE (o365_store);
+ service = CAMEL_SERVICE (m365_store);
if (camel_service_get_connection_status (service) != CAMEL_SERVICE_CONNECTED)
return;
#if 0
- if (g_error_matches (error, O365_CONNECTION_ERROR, O365_CONNECTION_ERROR_NORESPONSE) ||
- g_error_matches (error, O365_CONNECTION_ERROR, O365_CONNECTION_ERROR_AUTHENTICATION_FAILED))
+ if (g_error_matches (error, M365_CONNECTION_ERROR, M365_CONNECTION_ERROR_NORESPONSE) ||
+ g_error_matches (error, M365_CONNECTION_ERROR, M365_CONNECTION_ERROR_AUTHENTICATION_FAILED))
camel_service_disconnect_sync (service, FALSE, NULL, NULL);
#endif
}
void
-camel_o365_store_connect_folder_summary (CamelO365Store *o365_store,
+camel_m365_store_connect_folder_summary (CamelM365Store *m365_store,
CamelFolderSummary *folder_summary)
{
- g_return_if_fail (CAMEL_IS_O365_STORE (o365_store));
+ g_return_if_fail (CAMEL_IS_M365_STORE (m365_store));
g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (folder_summary));
- LOCK (o365_store);
+ LOCK (m365_store);
- if (o365_store->priv->summary)
- camel_o365_store_summary_connect_folder_summary (o365_store->priv->summary, folder_summary);
+ if (m365_store->priv->summary)
+ camel_m365_store_summary_connect_folder_summary (m365_store->priv->summary, folder_summary);
- UNLOCK (o365_store);
+ UNLOCK (m365_store);
}
diff --git a/src/Microsoft365/camel/camel-m365-store.h b/src/Microsoft365/camel/camel-m365-store.h
new file mode 100644
index 00000000..c20d207c
--- /dev/null
+++ b/src/Microsoft365/camel/camel-m365-store.h
@@ -0,0 +1,70 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef CAMEL_M365_STORE_H
+#define CAMEL_M365_STORE_H
+
+#include <camel/camel.h>
+
+#include "common/e-m365-connection.h"
+#include "camel-m365-store-summary.h"
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_M365_STORE \
+ (camel_m365_store_get_type ())
+#define CAMEL_M365_STORE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_M365_STORE, CamelM365Store))
+#define CAMEL_M365_STORE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_M365_STORE, CamelM365StoreClass))
+#define CAMEL_IS_M365_STORE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_M365_STORE))
+#define CAMEL_IS_M365_STORE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_M365_STORE))
+#define CAMEL_M365_STORE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_M365_STORE, CamelM365StoreClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelM365Store CamelM365Store;
+typedef struct _CamelM365StoreClass CamelM365StoreClass;
+typedef struct _CamelM365StorePrivate CamelM365StorePrivate;
+
+struct _CamelM365Store {
+ CamelOfflineStore parent;
+ CamelM365StorePrivate *priv;
+};
+
+struct _CamelM365StoreClass {
+ CamelOfflineStoreClass parent_class;
+};
+
+GType camel_m365_store_get_type (void);
+
+CamelM365StoreSummary *
+ camel_m365_store_ref_store_summary
+ (CamelM365Store *m365_store);
+EM365Connection *
+ camel_m365_store_ref_connection (CamelM365Store *m365_store);
+gboolean camel_m365_store_ensure_connected
+ (CamelM365Store *m365_store,
+ EM365Connection **out_cnc, /* out, nullable, transfer full */
+ GCancellable *cancellable,
+ GError **error);
+void camel_m365_store_maybe_disconnect
+ (CamelM365Store *m365_store,
+ const GError *error);
+void camel_m365_store_connect_folder_summary
+ (CamelM365Store *m365_store,
+ CamelFolderSummary *folder_summary);
+
+G_END_DECLS
+
+#endif /* CAMEL_M365_STORE_H */
diff --git a/src/Office365/camel/camel-o365-transport.c b/src/Microsoft365/camel/camel-m365-transport.c
similarity index 59%
rename from src/Office365/camel/camel-o365-transport.c
rename to src/Microsoft365/camel/camel-m365-transport.c
index 61c4f4eb..fb12f412 100644
--- a/src/Office365/camel/camel-o365-transport.c
+++ b/src/Microsoft365/camel/camel-m365-transport.c
@@ -1,18 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
@@ -23,26 +12,26 @@
#include <libemail-engine/libemail-engine.h>
-#include "common/camel-o365-settings.h"
-#include "common/e-o365-connection.h"
-#include "camel-o365-store.h"
-#include "camel-o365-utils.h"
+#include "common/camel-m365-settings.h"
+#include "common/e-m365-connection.h"
+#include "camel-m365-store.h"
+#include "camel-m365-utils.h"
-#include "camel-o365-transport.h"
+#include "camel-m365-transport.h"
#define LOCK(_transport) g_mutex_lock (&_transport->priv->property_lock)
#define UNLOCK(_transport) g_mutex_unlock (&_transport->priv->property_lock)
-struct _CamelO365TransportPrivate
+struct _CamelM365TransportPrivate
{
GMutex property_lock;
- EO365Connection *cnc;
+ EM365Connection *cnc;
};
-G_DEFINE_TYPE_WITH_PRIVATE (CamelO365Transport, camel_o365_transport, CAMEL_TYPE_TRANSPORT)
+G_DEFINE_TYPE_WITH_PRIVATE (CamelM365Transport, camel_m365_transport, CAMEL_TYPE_TRANSPORT)
static gboolean
-o365_transport_is_server_side_sent_folder (CamelService *service,
+m365_transport_is_server_side_sent_folder (CamelService *service,
GCancellable *cancellable)
{
CamelSession *session;
@@ -50,7 +39,7 @@ o365_transport_is_server_side_sent_folder (CamelService *service,
ESource *sibling, *source = NULL;
gboolean is_server_side = FALSE;
- g_return_val_if_fail (CAMEL_IS_O365_TRANSPORT (service), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_TRANSPORT (service), FALSE);
session = camel_service_ref_session (service);
@@ -98,24 +87,24 @@ o365_transport_is_server_side_sent_folder (CamelService *service,
e_source_mail_submission_get_sent_folder (subm_extension) &&
e_mail_folder_uri_parse (session,
e_source_mail_submission_get_sent_folder (subm_extension),
- &store, &folder_name, NULL) && CAMEL_IS_O365_STORE (store)) {
- CamelO365Store *o365_store = CAMEL_O365_STORE (store);
- CamelO365StoreSummary *o365_store_summary;
+ &store, &folder_name, NULL) && CAMEL_IS_M365_STORE (store)) {
+ CamelM365Store *m365_store = CAMEL_M365_STORE (store);
+ CamelM365StoreSummary *m365_store_summary;
gchar *folder_id_str;
- o365_store_summary = camel_o365_store_ref_store_summary (o365_store);
- folder_id_str = camel_o365_store_summary_dup_folder_id_for_full_name
(o365_store_summary, folder_name);
+ m365_store_summary = camel_m365_store_ref_store_summary (m365_store);
+ folder_id_str = camel_m365_store_summary_dup_folder_id_for_full_name
(m365_store_summary, folder_name);
if (folder_id_str && *folder_id_str) {
guint32 flags;
- flags = camel_o365_store_summary_get_folder_flags
(o365_store_summary, folder_id_str);
+ flags = camel_m365_store_summary_get_folder_flags
(m365_store_summary, folder_id_str);
if ((flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_SENT) {
is_server_side = TRUE;
}
}
- g_clear_object (&o365_store_summary);
+ g_clear_object (&m365_store_summary);
g_free (folder_id_str);
}
@@ -133,51 +122,51 @@ o365_transport_is_server_side_sent_folder (CamelService *service,
return is_server_side;
}
-static EO365Connection *
-o365_transport_ref_connection (CamelO365Transport *o365_transport)
+static EM365Connection *
+m365_transport_ref_connection (CamelM365Transport *m365_transport)
{
- EO365Connection *cnc = NULL;
+ EM365Connection *cnc = NULL;
- g_return_val_if_fail (CAMEL_IS_O365_TRANSPORT (o365_transport), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_TRANSPORT (m365_transport), NULL);
- LOCK (o365_transport);
+ LOCK (m365_transport);
- if (o365_transport->priv->cnc)
- cnc = g_object_ref (o365_transport->priv->cnc);
+ if (m365_transport->priv->cnc)
+ cnc = g_object_ref (m365_transport->priv->cnc);
- UNLOCK (o365_transport);
+ UNLOCK (m365_transport);
return cnc;
}
static gboolean
-o365_transport_connect_sync (CamelService *service,
+m365_transport_connect_sync (CamelService *service,
GCancellable *cancellable,
GError **error)
{
- CamelO365Transport *o365_transport;
- EO365Connection *cnc;
+ CamelM365Transport *m365_transport;
+ EM365Connection *cnc;
gboolean success = FALSE;
/* Chain up to parent's method. */
- if (!CAMEL_SERVICE_CLASS (camel_o365_transport_parent_class)->connect_sync (service, cancellable,
error))
+ if (!CAMEL_SERVICE_CLASS (camel_m365_transport_parent_class)->connect_sync (service, cancellable,
error))
return FALSE;
if (camel_service_get_connection_status (service) == CAMEL_SERVICE_DISCONNECTED)
return FALSE;
- o365_transport = CAMEL_O365_TRANSPORT (service);
- cnc = o365_transport_ref_connection (o365_transport);
+ m365_transport = CAMEL_M365_TRANSPORT (service);
+ cnc = m365_transport_ref_connection (m365_transport);
if (!cnc) {
- cnc = camel_o365_utils_new_connection (service, NULL);
+ cnc = camel_m365_utils_new_connection (service, NULL);
if (cnc) {
- LOCK (o365_transport);
+ LOCK (m365_transport);
- o365_transport->priv->cnc = g_object_ref (cnc);
+ m365_transport->priv->cnc = g_object_ref (cnc);
- UNLOCK (o365_transport);
+ UNLOCK (m365_transport);
}
}
@@ -186,7 +175,7 @@ o365_transport_connect_sync (CamelService *service,
session = camel_service_ref_session (service);
- success = camel_session_authenticate_sync (session, service, "Office365", cancellable, error);
+ success = camel_session_authenticate_sync (session, service, "Microsoft365", cancellable,
error);
g_clear_object (&session);
g_clear_object (&cnc);
@@ -198,19 +187,19 @@ o365_transport_connect_sync (CamelService *service,
}
static gboolean
-o365_transport_disconnect_sync (CamelService *service,
+m365_transport_disconnect_sync (CamelService *service,
gboolean clean,
GCancellable *cancellable,
GError **error)
{
- CamelO365Transport *o365_transport = CAMEL_O365_TRANSPORT (service);
- EO365Connection *cnc;
+ CamelM365Transport *m365_transport = CAMEL_M365_TRANSPORT (service);
+ EM365Connection *cnc;
gboolean success = TRUE;
- cnc = o365_transport_ref_connection (o365_transport);
+ cnc = m365_transport_ref_connection (m365_transport);
if (cnc) {
- success = e_o365_connection_disconnect_sync (cnc, cancellable, error);
+ success = e_m365_connection_disconnect_sync (cnc, cancellable, error);
g_clear_object (&cnc);
}
@@ -219,26 +208,26 @@ o365_transport_disconnect_sync (CamelService *service,
return FALSE;
/* Chain up to parent's method. */
- return CAMEL_SERVICE_CLASS (camel_o365_transport_parent_class)->disconnect_sync (service, clean,
cancellable, error);
+ return CAMEL_SERVICE_CLASS (camel_m365_transport_parent_class)->disconnect_sync (service, clean,
cancellable, error);
}
static CamelAuthenticationResult
-o365_transport_authenticate_sync (CamelService *service,
+m365_transport_authenticate_sync (CamelService *service,
const gchar *mechanism,
GCancellable *cancellable,
GError **error)
{
CamelAuthenticationResult result;
- CamelO365Transport *o365_transport;
- EO365Connection *cnc;
+ CamelM365Transport *m365_transport;
+ EM365Connection *cnc;
- o365_transport = CAMEL_O365_TRANSPORT (service);
- cnc = o365_transport_ref_connection (o365_transport);
+ m365_transport = CAMEL_M365_TRANSPORT (service);
+ cnc = m365_transport_ref_connection (m365_transport);
if (!cnc)
return CAMEL_AUTHENTICATION_ERROR;
- switch (e_o365_connection_authenticate_sync (cnc, NULL, E_O365_FOLDER_KIND_MAIL, NULL, NULL, NULL,
NULL, cancellable, error)) {
+ switch (e_m365_connection_authenticate_sync (cnc, NULL, E_M365_FOLDER_KIND_MAIL, NULL, NULL, NULL,
NULL, cancellable, error)) {
case E_SOURCE_AUTHENTICATION_ERROR:
case E_SOURCE_AUTHENTICATION_ERROR_SSL_FAILED:
default:
@@ -259,7 +248,7 @@ o365_transport_authenticate_sync (CamelService *service,
}
static gchar *
-o365_transport_get_name (CamelService *service,
+m365_transport_get_name (CamelService *service,
gboolean brief)
{
gchar *name;
@@ -273,7 +262,7 @@ o365_transport_get_name (CamelService *service,
}
static gboolean
-o365_send_to_sync (CamelTransport *transport,
+m365_send_to_sync (CamelTransport *transport,
CamelMimeMessage *message,
CamelAddress *from,
CamelAddress *recipients,
@@ -283,7 +272,7 @@ o365_send_to_sync (CamelTransport *transport,
{
CamelInternetAddress *use_from;
CamelService *service;
- EO365Connection *cnc;
+ EM365Connection *cnc;
JsonBuilder *builder;
gchar *appended_id = NULL;
gboolean is_server_side_sent;
@@ -319,7 +308,7 @@ o365_send_to_sync (CamelTransport *transport,
}
}
- cnc = o365_transport_ref_connection (CAMEL_O365_TRANSPORT (service));
+ cnc = m365_transport_ref_connection (CAMEL_M365_TRANSPORT (service));
if (!cnc) {
g_set_error_literal (
@@ -328,25 +317,25 @@ o365_send_to_sync (CamelTransport *transport,
return FALSE;
}
- is_server_side_sent = o365_transport_is_server_side_sent_folder (service, cancellable);
+ is_server_side_sent = m365_transport_is_server_side_sent_folder (service, cancellable);
if (is_server_side_sent && out_sent_message_saved)
*out_sent_message_saved = TRUE;
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
- e_o365_json_begin_object_member (builder, "message");
+ e_m365_json_begin_object_member (builder, NULL);
+ e_m365_json_begin_object_member (builder, "message");
- success = camel_o365_utils_fill_message_object_sync (builder, message, NULL, from, recipients, TRUE,
NULL, cancellable, error);
+ success = camel_m365_utils_fill_message_object_sync (builder, message, NULL, from, recipients, TRUE,
NULL, cancellable, error);
- e_o365_json_end_object_member (builder); /* message */
+ e_m365_json_end_object_member (builder); /* message */
if (!is_server_side_sent)
- e_o365_json_add_boolean_member (builder, "saveToSentItems", FALSE);
+ e_m365_json_add_boolean_member (builder, "saveToSentItems", FALSE);
- e_o365_json_end_object_member (builder);
+ e_m365_json_end_object_member (builder);
- success = success && e_o365_connection_send_mail_sync (cnc, NULL, builder, cancellable, error);
+ success = success && e_m365_connection_send_mail_sync (cnc, NULL, builder, cancellable, error);
g_object_unref (cnc);
g_free (appended_id);
@@ -355,57 +344,57 @@ o365_send_to_sync (CamelTransport *transport,
}
static void
-o365_transport_dispose (GObject *object)
+m365_transport_dispose (GObject *object)
{
- CamelO365Transport *o365_transport = CAMEL_O365_TRANSPORT (object);
+ CamelM365Transport *m365_transport = CAMEL_M365_TRANSPORT (object);
- LOCK (o365_transport);
+ LOCK (m365_transport);
- g_clear_object (&o365_transport->priv->cnc);
+ g_clear_object (&m365_transport->priv->cnc);
- UNLOCK (o365_transport);
+ UNLOCK (m365_transport);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_transport_parent_class)->dispose (object);
+ G_OBJECT_CLASS (camel_m365_transport_parent_class)->dispose (object);
}
static void
-o365_transport_finalize (GObject *object)
+m365_transport_finalize (GObject *object)
{
- CamelO365Transport *o365_transport = CAMEL_O365_TRANSPORT (object);
+ CamelM365Transport *m365_transport = CAMEL_M365_TRANSPORT (object);
- g_mutex_clear (&o365_transport->priv->property_lock);
+ g_mutex_clear (&m365_transport->priv->property_lock);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_transport_parent_class)->finalize (object);
+ G_OBJECT_CLASS (camel_m365_transport_parent_class)->finalize (object);
}
static void
-camel_o365_transport_class_init (CamelO365TransportClass *class)
+camel_m365_transport_class_init (CamelM365TransportClass *class)
{
GObjectClass *object_class;
CamelServiceClass *service_class;
CamelTransportClass *transport_class;
object_class = G_OBJECT_CLASS (class);
- object_class->dispose = o365_transport_dispose;
- object_class->finalize = o365_transport_finalize;
+ object_class->dispose = m365_transport_dispose;
+ object_class->finalize = m365_transport_finalize;
service_class = CAMEL_SERVICE_CLASS (class);
- service_class->settings_type = CAMEL_TYPE_O365_SETTINGS;
- service_class->get_name = o365_transport_get_name;
- service_class->connect_sync = o365_transport_connect_sync;
- service_class->disconnect_sync = o365_transport_disconnect_sync;
- service_class->authenticate_sync = o365_transport_authenticate_sync;
+ service_class->settings_type = CAMEL_TYPE_M365_SETTINGS;
+ service_class->get_name = m365_transport_get_name;
+ service_class->connect_sync = m365_transport_connect_sync;
+ service_class->disconnect_sync = m365_transport_disconnect_sync;
+ service_class->authenticate_sync = m365_transport_authenticate_sync;
transport_class = CAMEL_TRANSPORT_CLASS (class);
- transport_class->send_to_sync = o365_send_to_sync;
+ transport_class->send_to_sync = m365_send_to_sync;
}
static void
-camel_o365_transport_init (CamelO365Transport *o365_transport)
+camel_m365_transport_init (CamelM365Transport *m365_transport)
{
- o365_transport->priv = camel_o365_transport_get_instance_private (o365_transport);
+ m365_transport->priv = camel_m365_transport_get_instance_private (m365_transport);
- g_mutex_init (&o365_transport->priv->property_lock);
+ g_mutex_init (&m365_transport->priv->property_lock);
}
diff --git a/src/Microsoft365/camel/camel-m365-transport.h b/src/Microsoft365/camel/camel-m365-transport.h
new file mode 100644
index 00000000..f25c5856
--- /dev/null
+++ b/src/Microsoft365/camel/camel-m365-transport.h
@@ -0,0 +1,50 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef CAMEL_M365_TRANSPORT_H
+#define CAMEL_M365_TRANSPORT_H
+
+#include <camel/camel.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_M365_TRANSPORT \
+ (camel_m365_transport_get_type ())
+#define CAMEL_M365_TRANSPORT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_M365_TRANSPORT, CamelM365Transport))
+#define CAMEL_M365_TRANSPORT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_M365_TRANSPORT, CamelM365TransportClass))
+#define CAMEL_IS_M365_TRANSPORT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_M365_TRANSPORT))
+#define CAMEL_IS_M365_TRANSPORT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_M365_TRANSPORT))
+#define CAMEL_M365_TRANSPORT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_M365_TRANSPORT, CamelM365TransportClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelM365Transport CamelM365Transport;
+typedef struct _CamelM365TransportClass CamelM365TransportClass;
+typedef struct _CamelM365TransportPrivate CamelM365TransportPrivate;
+
+struct _CamelM365Transport {
+ CamelTransport parent;
+ CamelM365TransportPrivate *priv;
+};
+
+struct _CamelM365TransportClass {
+ CamelTransportClass parent_class;
+};
+
+GType camel_m365_transport_get_type (void);
+
+G_END_DECLS
+
+#endif /* CAMEL_M365_TRANSPORT_H */
diff --git a/src/Office365/camel/camel-o365-utils.c b/src/Microsoft365/camel/camel-m365-utils.c
similarity index 77%
rename from src/Office365/camel/camel-o365-utils.c
rename to src/Microsoft365/camel/camel-m365-utils.c
index 3d24749b..9d496693 100644
--- a/src/Office365/camel/camel-o365-utils.c
+++ b/src/Microsoft365/camel/camel-m365-utils.c
@@ -1,29 +1,18 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
#include <libemail-engine/libemail-engine.h>
-#include "camel-o365-utils.h"
+#include "camel-m365-utils.h"
/* Unref with g_object_unref() when done with it */
static ESource *
-camel_o365_utils_ref_corresponding_source (CamelService *service,
+camel_m365_utils_ref_corresponding_source (CamelService *service,
GCancellable *cancellable)
{
ESourceRegistry *registry = NULL;
@@ -62,24 +51,24 @@ camel_o365_utils_ref_corresponding_source (CamelService *service,
return source;
}
-EO365Connection *
-camel_o365_utils_new_connection (CamelService *service,
+EM365Connection *
+camel_m365_utils_new_connection (CamelService *service,
GCancellable *cancellable)
{
CamelSettings *settings;
- EO365Connection *cnc;
+ EM365Connection *cnc;
ESource *source;
g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
- source = camel_o365_utils_ref_corresponding_source (service, cancellable);
+ source = camel_m365_utils_ref_corresponding_source (service, cancellable);
if (!source)
return NULL;
settings = camel_service_ref_settings (service);
- cnc = e_o365_connection_new (source, CAMEL_O365_SETTINGS (settings));
+ cnc = e_m365_connection_new (source, CAMEL_M365_SETTINGS (settings));
e_binding_bind_property (
service, "proxy-resolver",
@@ -94,7 +83,7 @@ camel_o365_utils_new_connection (CamelService *service,
/* From Outlook name (which allows spaces) to Evolution name */
gchar *
-camel_o365_utils_encode_category_name (const gchar *name)
+camel_m365_utils_encode_category_name (const gchar *name)
{
if (name && strchr (name, ' ')) {
GString *str;
@@ -118,7 +107,7 @@ camel_o365_utils_encode_category_name (const gchar *name)
/* From Evolution name to Outlook name (which allows spaces) */
gchar *
-camel_o365_utils_decode_category_name (const gchar *flag)
+camel_m365_utils_decode_category_name (const gchar *flag)
{
if (flag && strchr (flag, '_')) {
GString *str = g_string_sized_new (strlen (flag));
@@ -145,7 +134,7 @@ camel_o365_utils_decode_category_name (const gchar *flag)
}
gboolean
-camel_o365_utils_is_system_user_flag (const gchar *name)
+camel_m365_utils_is_system_user_flag (const gchar *name)
{
if (!name)
return FALSE;
@@ -155,7 +144,7 @@ camel_o365_utils_is_system_user_flag (const gchar *name)
}
const gchar *
-camel_o365_utils_rename_label (const gchar *cat,
+camel_m365_utils_rename_label (const gchar *cat,
gboolean from_cat)
{
gint ii;
@@ -188,7 +177,7 @@ camel_o365_utils_rename_label (const gchar *cat,
}
static void
-o365_utils_add_address (JsonBuilder *builder,
+m365_utils_add_address (JsonBuilder *builder,
CamelInternetAddress *addr,
void (* add_func) (JsonBuilder *builder,
const gchar *name,
@@ -206,7 +195,7 @@ o365_utils_add_address (JsonBuilder *builder,
}
static void
-o365_utils_add_address_array (JsonBuilder *builder,
+m365_utils_add_address_array (JsonBuilder *builder,
CamelInternetAddress *addr,
void (* begin_func) (JsonBuilder *builder),
void (* end_func) (JsonBuilder *builder),
@@ -236,7 +225,7 @@ o365_utils_add_address_array (JsonBuilder *builder,
if (known_recipients && address && *address)
g_hash_table_add (known_recipients, (gpointer) address);
- e_o365_add_recipient (builder, NULL, name, address);
+ e_m365_add_recipient (builder, NULL, name, address);
}
}
@@ -258,7 +247,7 @@ o365_utils_add_address_array (JsonBuilder *builder,
if (known_recipients && address && *address)
g_hash_table_add (known_recipients, (gpointer) address);
- e_o365_add_recipient (builder, NULL, name, address);
+ e_m365_add_recipient (builder, NULL, name, address);
}
}
}
@@ -268,7 +257,7 @@ o365_utils_add_address_array (JsonBuilder *builder,
}
static void
-o365_utils_add_headers (JsonBuilder *builder,
+m365_utils_add_headers (JsonBuilder *builder,
const CamelNameValueArray *headers,
CamelInternetAddress **out_sender,
gboolean *out_request_read_receipt)
@@ -289,13 +278,13 @@ o365_utils_add_headers (JsonBuilder *builder,
/* The Graph API allows only X- headers to be saved */
if (g_ascii_strncasecmp (name, "X-", 2) == 0) {
if (!did_add)
- e_o365_mail_message_begin_internet_message_headers (builder);
+ e_m365_mail_message_begin_internet_message_headers (builder);
did_add++;
- /* Preserve only the first five... (see the comment at
o365_folder_append_message_sync()) */
+ /* Preserve only the first five... (see the comment at
m365_folder_append_message_sync()) */
if (did_add < 5)
- e_o365_add_internet_message_header (builder, name, value);
+ e_m365_add_internet_message_header (builder, name, value);
}
if (out_sender && g_ascii_strcasecmp (name, "Sender") == 0) {
@@ -322,11 +311,11 @@ o365_utils_add_headers (JsonBuilder *builder,
}
if (did_add)
- e_o365_mail_message_end_internet_message_headers (builder);
+ e_m365_mail_message_end_internet_message_headers (builder);
}
static CamelStream *
-o365_utils_get_content_stream (CamelMimePart *part,
+m365_utils_get_content_stream (CamelMimePart *part,
gssize *out_wrote_bytes,
GCancellable *cancellable)
{
@@ -405,7 +394,7 @@ o365_utils_get_content_stream (CamelMimePart *part,
}
static gboolean
-o365_utils_part_is_attachment (CamelMimePart *part,
+m365_utils_part_is_attachment (CamelMimePart *part,
gboolean *out_is_inline)
{
const CamelContentDisposition *content_disposition;
@@ -435,7 +424,7 @@ enum {
};
static void
-o365_utils_add_file_attachment_content (JsonBuilder *builder,
+m365_utils_add_file_attachment_content (JsonBuilder *builder,
CamelDataWrapper *dw,
guint32 add_flags,
GCancellable *cancellable)
@@ -452,7 +441,7 @@ o365_utils_add_file_attachment_content (JsonBuilder *builder,
content_type_str = camel_content_type_format (ct);
if ((add_flags & ADD_ATTACHMENT_WITH_CONTENT_TYPE) != 0)
- e_o365_attachment_add_content_type (builder, content_type_str);
+ e_m365_attachment_add_content_type (builder, content_type_str);
content_stream = camel_stream_mem_new ();
filter_stream = camel_stream_filter_new (content_stream);
@@ -482,10 +471,10 @@ o365_utils_add_file_attachment_content (JsonBuilder *builder,
content_id = camel_mime_part_get_content_id (part);
if (content_id)
- e_o365_file_attachment_add_content_id (builder, content_id);
+ e_m365_file_attachment_add_content_id (builder, content_id);
- if (o365_utils_part_is_attachment (part, &is_inline) && is_inline)
- e_o365_attachment_add_is_inline (builder, TRUE);
+ if (m365_utils_part_is_attachment (part, &is_inline) && is_inline)
+ e_m365_attachment_add_is_inline (builder, TRUE);
dw = camel_medium_get_content (CAMEL_MEDIUM (part));
}
@@ -504,13 +493,13 @@ o365_utils_add_file_attachment_content (JsonBuilder *builder,
/* Ensure the string is NUL-terminated */
g_byte_array_append (data, (const guchar *) "\0", 1);
- e_o365_file_attachment_add_content_bytes (builder, (const gchar *) data->data);
+ e_m365_file_attachment_add_content_bytes (builder, (const gchar *) data->data);
g_object_unref (content_stream);
}
static void
-o365_utils_add_file_attachment (JsonBuilder *builder,
+m365_utils_add_file_attachment (JsonBuilder *builder,
CamelDataWrapper *dw,
GCancellable *cancellable)
{
@@ -519,43 +508,43 @@ o365_utils_add_file_attachment (JsonBuilder *builder,
g_return_if_fail (builder != NULL);
g_return_if_fail (dw != NULL);
- o365_utils_add_file_attachment_content (builder, dw, ADD_ATTACHMENT_WITH_CONTENT_TYPE |
ADD_ATTACHMENT_DECODE_CONTENT, cancellable);
+ m365_utils_add_file_attachment_content (builder, dw, ADD_ATTACHMENT_WITH_CONTENT_TYPE |
ADD_ATTACHMENT_DECODE_CONTENT, cancellable);
if (CAMEL_IS_MIME_PART (dw))
filename = camel_mime_part_get_filename (CAMEL_MIME_PART (dw));
if (filename)
- e_o365_attachment_add_name (builder, filename);
+ e_m365_attachment_add_name (builder, filename);
else
- e_o365_attachment_add_name (builder, "attachment.dat");
+ e_m365_attachment_add_name (builder, "attachment.dat");
}
static void
-o365_utils_add_smime_encrypted_attachment (JsonBuilder *builder,
+m365_utils_add_smime_encrypted_attachment (JsonBuilder *builder,
CamelDataWrapper *dw,
GCancellable *cancellable)
{
g_return_if_fail (builder != NULL);
g_return_if_fail (dw != NULL);
- e_o365_attachment_add_name (builder, "smime.p7m");
+ e_m365_attachment_add_name (builder, "smime.p7m");
- o365_utils_add_file_attachment_content (builder, dw, ADD_ATTACHMENT_WITH_CONTENT_TYPE |
ADD_ATTACHMENT_DECODE_CONTENT, cancellable);
+ m365_utils_add_file_attachment_content (builder, dw, ADD_ATTACHMENT_WITH_CONTENT_TYPE |
ADD_ATTACHMENT_DECODE_CONTENT, cancellable);
}
static void
-o365_utils_add_smime_signed_attachment (JsonBuilder *builder,
+m365_utils_add_smime_signed_attachment (JsonBuilder *builder,
CamelDataWrapper *dw,
GCancellable *cancellable)
{
- e_o365_attachment_add_content_type (builder, "multipart/signed");
- e_o365_attachment_add_name (builder, "smime.txt");
+ e_m365_attachment_add_content_type (builder, "multipart/signed");
+ e_m365_attachment_add_name (builder, "smime.txt");
- o365_utils_add_file_attachment_content (builder, dw, ADD_ATTACHMENT_PREFIX_CONTENT_TYPE_HEADER,
cancellable);
+ m365_utils_add_file_attachment_content (builder, dw, ADD_ATTACHMENT_PREFIX_CONTENT_TYPE_HEADER,
cancellable);
}
static gboolean
-o365_utils_do_smime_signed (CamelMultipart *multipart,
+m365_utils_do_smime_signed (CamelMultipart *multipart,
CamelMimePart **out_body_part,
GSList **out_attachments,
GCancellable *cancellable)
@@ -587,7 +576,7 @@ o365_utils_do_smime_signed (CamelMultipart *multipart,
}
static gboolean
-o365_utils_do_multipart (CamelMultipart *mp,
+m365_utils_do_multipart (CamelMultipart *mp,
gboolean *is_first,
CamelMimePart **out_body_part,
GSList **out_attachments,
@@ -615,7 +604,7 @@ o365_utils_do_multipart (CamelMultipart *mp,
dw = camel_medium_get_content (CAMEL_MEDIUM (part));
if (CAMEL_IS_MULTIPART (dw)) {
- if (!o365_utils_do_multipart (CAMEL_MULTIPART (dw), is_first, out_body_part,
out_attachments, cancellable))
+ if (!m365_utils_do_multipart (CAMEL_MULTIPART (dw), is_first, out_body_part,
out_attachments, cancellable))
return FALSE;
continue;
}
@@ -629,7 +618,7 @@ o365_utils_do_multipart (CamelMultipart *mp,
*is_first = FALSE;
} else if ((ii == 0 || parent_is_alternative) &&
camel_content_type_is (type, "text", "html") &&
- !o365_utils_part_is_attachment (part, NULL)) {
+ !m365_utils_part_is_attachment (part, NULL)) {
g_clear_object (out_body_part);
*out_body_part = g_object_ref (part);
} else {
@@ -641,7 +630,7 @@ o365_utils_do_multipart (CamelMultipart *mp,
}
static CamelMimePart *
-o365_utils_get_body_part (CamelMimeMessage *message,
+m365_utils_get_body_part (CamelMimeMessage *message,
GSList **out_attachments,
GCancellable *cancellable)
{
@@ -666,9 +655,9 @@ o365_utils_get_body_part (CamelMimeMessage *message,
multipart = CAMEL_MULTIPART (dw);
if (CAMEL_IS_MULTIPART_SIGNED (multipart) && camel_multipart_get_number (multipart)
== 2) {
- o365_utils_do_smime_signed (multipart, &body_part, out_attachments,
cancellable);
+ m365_utils_do_smime_signed (multipart, &body_part, out_attachments,
cancellable);
} else {
- o365_utils_do_multipart (multipart, &is_first, &body_part, out_attachments,
cancellable);
+ m365_utils_do_multipart (multipart, &is_first, &body_part, out_attachments,
cancellable);
}
} else if (dw) {
CamelContentType *type;
@@ -692,7 +681,7 @@ o365_utils_get_body_part (CamelMimeMessage *message,
}
void
-camel_o365_utils_add_message_flags (JsonBuilder *builder,
+camel_m365_utils_add_message_flags (JsonBuilder *builder,
CamelMessageInfo *info,
CamelMimeMessage *message)
{
@@ -711,30 +700,30 @@ camel_o365_utils_add_message_flags (JsonBuilder *builder,
for (ii = 0; ii < len; ii++) {
const gchar *name = camel_named_flags_get (user_flags, ii);
- if (!camel_o365_utils_is_system_user_flag (name)) {
+ if (!camel_m365_utils_is_system_user_flag (name)) {
const gchar *renamed;
- renamed = camel_o365_utils_rename_label (name, FALSE);
+ renamed = camel_m365_utils_rename_label (name, FALSE);
if (renamed && *renamed && renamed != name) {
if (!did_add) {
did_add = TRUE;
- e_o365_mail_message_begin_categories (builder);
+ e_m365_mail_message_begin_categories (builder);
}
- e_o365_mail_message_add_category (builder, renamed);
+ e_m365_mail_message_add_category (builder, renamed);
} else if (renamed == name && name && *name) {
gchar *cat;
- cat = camel_o365_utils_decode_category_name (name);
+ cat = camel_m365_utils_decode_category_name (name);
if (cat && *cat) {
if (!did_add) {
did_add = TRUE;
- e_o365_mail_message_begin_categories (builder);
+ e_m365_mail_message_begin_categories (builder);
}
- e_o365_mail_message_add_category (builder, cat);
+ e_m365_mail_message_add_category (builder, cat);
}
g_free (cat);
@@ -743,7 +732,7 @@ camel_o365_utils_add_message_flags (JsonBuilder *builder,
}
if (did_add)
- e_o365_mail_message_end_categories (builder);
+ e_m365_mail_message_end_categories (builder);
}
if (message && !(flags & CAMEL_MESSAGE_FLAGGED)) {
@@ -762,14 +751,14 @@ camel_o365_utils_add_message_flags (JsonBuilder *builder,
}
}
- e_o365_mail_message_add_importance (builder,
- (flags & CAMEL_MESSAGE_FLAGGED) != 0 ? E_O365_IMPORTANCE_HIGH : E_O365_IMPORTANCE_NORMAL);
+ e_m365_mail_message_add_importance (builder,
+ (flags & CAMEL_MESSAGE_FLAGGED) != 0 ? E_M365_IMPORTANCE_HIGH : E_M365_IMPORTANCE_NORMAL);
- e_o365_mail_message_add_is_read (builder, (flags & CAMEL_MESSAGE_SEEN) != 0);
+ e_m365_mail_message_add_is_read (builder, (flags & CAMEL_MESSAGE_SEEN) != 0);
}
static void
-o365_utils_add_attachment_object (JsonBuilder *builder,
+m365_utils_add_attachment_object (JsonBuilder *builder,
CamelDataWrapper *dw,
GCancellable *cancellable)
{
@@ -777,22 +766,22 @@ o365_utils_add_attachment_object (JsonBuilder *builder,
ct = camel_data_wrapper_get_mime_type_field (dw);
- e_o365_attachment_begin_attachment (builder, E_O365_ATTACHMENT_DATA_TYPE_FILE);
+ e_m365_attachment_begin_attachment (builder, E_M365_ATTACHMENT_DATA_TYPE_FILE);
if (camel_content_type_is (ct, "application", "x-pkcs7-mime") ||
camel_content_type_is (ct, "application", "pkcs7-mime")) {
- o365_utils_add_smime_encrypted_attachment (builder, dw, cancellable);
+ m365_utils_add_smime_encrypted_attachment (builder, dw, cancellable);
} else if (CAMEL_IS_MULTIPART_SIGNED (dw)) {
- o365_utils_add_smime_signed_attachment (builder, dw, cancellable);
+ m365_utils_add_smime_signed_attachment (builder, dw, cancellable);
} else {
- o365_utils_add_file_attachment (builder, dw, cancellable);
+ m365_utils_add_file_attachment (builder, dw, cancellable);
}
- e_o365_json_end_object_member (builder);
+ e_m365_json_end_object_member (builder);
}
gboolean
-camel_o365_utils_fill_message_object_sync (JsonBuilder *builder,
+camel_m365_utils_fill_message_object_sync (JsonBuilder *builder,
CamelMimeMessage *message,
CamelMessageInfo *info,
CamelAddress *override_from,
@@ -816,10 +805,10 @@ camel_o365_utils_fill_message_object_sync (JsonBuilder *builder,
tmp = camel_mime_message_get_message_id (message);
if (tmp && *tmp)
- e_o365_mail_message_add_internet_message_id (builder, tmp);
+ e_m365_mail_message_add_internet_message_id (builder, tmp);
tmp = camel_mime_message_get_subject (message);
- e_o365_mail_message_add_subject (builder, tmp ? tmp : "");
+ e_m365_mail_message_add_subject (builder, tmp ? tmp : "");
tt = camel_mime_message_get_date (message, &offset);
@@ -828,7 +817,7 @@ camel_o365_utils_fill_message_object_sync (JsonBuilder *builder,
tt += (offset / 100) * 60 * 60;
tt += (offset % 100) * 60;
- e_o365_mail_message_add_sent_date_time (builder, tt);
+ e_m365_mail_message_add_sent_date_time (builder, tt);
}
offset = 0;
@@ -839,7 +828,7 @@ camel_o365_utils_fill_message_object_sync (JsonBuilder *builder,
tt += (offset / 100) * 60 * 60;
tt += (offset % 100) * 60;
- e_o365_mail_message_add_received_date_time (builder, tt);
+ e_m365_mail_message_add_received_date_time (builder, tt);
}
if (override_recipients)
@@ -849,32 +838,32 @@ camel_o365_utils_fill_message_object_sync (JsonBuilder *builder,
addr = CAMEL_INTERNET_ADDRESS (override_from);
else
addr = camel_mime_message_get_from (message);
- o365_utils_add_address (builder, addr, e_o365_mail_message_add_from);
+ m365_utils_add_address (builder, addr, e_m365_mail_message_add_from);
addr = camel_mime_message_get_reply_to (message);
- o365_utils_add_address_array (builder, addr, e_o365_mail_message_begin_reply_to,
e_o365_mail_message_end_reply_to, NULL, NULL);
+ m365_utils_add_address_array (builder, addr, e_m365_mail_message_begin_reply_to,
e_m365_mail_message_end_reply_to, NULL, NULL);
addr = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
- o365_utils_add_address_array (builder, addr, e_o365_mail_message_begin_to_recipients,
e_o365_mail_message_end_to_recipients, known_recipients, NULL);
+ m365_utils_add_address_array (builder, addr, e_m365_mail_message_begin_to_recipients,
e_m365_mail_message_end_to_recipients, known_recipients, NULL);
addr = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
- o365_utils_add_address_array (builder, addr, e_o365_mail_message_begin_cc_recipients,
e_o365_mail_message_end_cc_recipients, known_recipients, NULL);
+ m365_utils_add_address_array (builder, addr, e_m365_mail_message_begin_cc_recipients,
e_m365_mail_message_end_cc_recipients, known_recipients, NULL);
addr = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC);
- o365_utils_add_address_array (builder, addr, e_o365_mail_message_begin_bcc_recipients,
e_o365_mail_message_end_bcc_recipients, known_recipients, override_recipients);
+ m365_utils_add_address_array (builder, addr, e_m365_mail_message_begin_bcc_recipients,
e_m365_mail_message_end_bcc_recipients, known_recipients, override_recipients);
if (known_recipients) {
g_hash_table_destroy (known_recipients);
known_recipients = NULL;
}
- o365_utils_add_headers (builder, camel_medium_get_headers (CAMEL_MEDIUM (message)), &sender,
&request_read_receipt);
+ m365_utils_add_headers (builder, camel_medium_get_headers (CAMEL_MEDIUM (message)), &sender,
&request_read_receipt);
if (sender) {
const gchar *name = NULL, *address = NULL;
if (camel_internet_address_get (sender, 0, &name, &address) && ((name && *name) || (address
&& *address)))
- e_o365_mail_message_add_sender (builder, name, address);
+ e_m365_mail_message_add_sender (builder, name, address);
g_clear_object (&sender);
} else if (override_from) {
@@ -882,26 +871,26 @@ camel_o365_utils_fill_message_object_sync (JsonBuilder *builder,
}
if (request_read_receipt)
- e_o365_mail_message_add_is_read_receipt_requested (builder, TRUE);
+ e_m365_mail_message_add_is_read_receipt_requested (builder, TRUE);
- body_part = o365_utils_get_body_part (message, &attachments, cancellable);
+ body_part = m365_utils_get_body_part (message, &attachments, cancellable);
if (body_part) {
CamelContentType *ct;
- EO365ItemBodyContentTypeType o365_content_type = E_O365_ITEM_BODY_CONTENT_TYPE_UNKNOWN;
+ EM365ItemBodyContentTypeType m365_content_type = E_M365_ITEM_BODY_CONTENT_TYPE_UNKNOWN;
ct = camel_mime_part_get_content_type (body_part);
if (ct && camel_content_type_is (ct, "text", "html"))
- o365_content_type = E_O365_ITEM_BODY_CONTENT_TYPE_HTML;
+ m365_content_type = E_M365_ITEM_BODY_CONTENT_TYPE_HTML;
else if (ct && camel_content_type_is (ct, "text", "plain"))
- o365_content_type = E_O365_ITEM_BODY_CONTENT_TYPE_TEXT;
+ m365_content_type = E_M365_ITEM_BODY_CONTENT_TYPE_TEXT;
- if (o365_content_type != E_O365_ITEM_BODY_CONTENT_TYPE_UNKNOWN) {
+ if (m365_content_type != E_M365_ITEM_BODY_CONTENT_TYPE_UNKNOWN) {
CamelStream *mem;
gssize wrote = -1;
- mem = o365_utils_get_content_stream (body_part, &wrote, cancellable);
+ mem = m365_utils_get_content_stream (body_part, &wrote, cancellable);
if (mem && wrote >= 0) {
GByteArray *byte_array;
@@ -913,7 +902,7 @@ camel_o365_utils_fill_message_object_sync (JsonBuilder *builder,
/* Ensure the string is NUL-terminated */
g_byte_array_append (byte_array, (const guchar *) "\0", 1);
- e_o365_mail_message_add_body (builder, o365_content_type, (const gchar *)
byte_array->data);
+ e_m365_mail_message_add_body (builder, m365_content_type, (const gchar *)
byte_array->data);
}
g_clear_object (&mem);
@@ -921,26 +910,26 @@ camel_o365_utils_fill_message_object_sync (JsonBuilder *builder,
g_object_unref (body_part);
} else {
- e_o365_json_add_null_member (builder, "body");
+ e_m365_json_add_null_member (builder, "body");
}
if (info || is_send)
- camel_o365_utils_add_message_flags (builder, info, is_send ? message : NULL);
+ camel_m365_utils_add_message_flags (builder, info, is_send ? message : NULL);
if (out_attachments) {
*out_attachments = attachments;
} else if (attachments) {
GSList *link;
- e_o365_json_begin_array_member (builder, "attachments");
+ e_m365_json_begin_array_member (builder, "attachments");
for (link = attachments; link && success; link = g_slist_next (link)) {
CamelDataWrapper *dw = link->data;
- o365_utils_add_attachment_object (builder, dw, cancellable);
+ m365_utils_add_attachment_object (builder, dw, cancellable);
}
- e_o365_json_end_array_member (builder);
+ e_m365_json_end_array_member (builder);
g_slist_free_full (attachments, g_object_unref);
}
@@ -949,7 +938,7 @@ camel_o365_utils_fill_message_object_sync (JsonBuilder *builder,
}
gboolean
-camel_o365_utils_create_message_sync (EO365Connection *cnc,
+camel_m365_utils_create_message_sync (EM365Connection *cnc,
const gchar *folder_id,
CamelMimeMessage *message,
CamelMessageInfo *info,
@@ -957,28 +946,28 @@ camel_o365_utils_create_message_sync (EO365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
- EO365MailMessage *appended_message = NULL;
+ EM365MailMessage *appended_message = NULL;
GSList *attachments = NULL;
JsonBuilder *builder;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), FALSE);
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
+ e_m365_json_begin_object_member (builder, NULL);
- if (!camel_o365_utils_fill_message_object_sync (builder, message, info, NULL, NULL, FALSE,
&attachments, cancellable, error)) {
+ if (!camel_m365_utils_fill_message_object_sync (builder, message, info, NULL, NULL, FALSE,
&attachments, cancellable, error)) {
g_slist_free_full (attachments, g_object_unref);
g_object_unref (builder);
return FALSE;
}
- e_o365_json_end_object_member (builder);
+ e_m365_json_end_object_member (builder);
- success = e_o365_connection_create_mail_message_sync (cnc, NULL, folder_id, builder,
&appended_message, cancellable, error);
+ success = e_m365_connection_create_mail_message_sync (cnc, NULL, folder_id, builder,
&appended_message, cancellable, error);
g_warn_if_fail ((success && appended_message) || (!success && !appended_message));
@@ -988,7 +977,7 @@ camel_o365_utils_create_message_sync (EO365Connection *cnc,
GSList *link;
const gchar *message_id;
- message_id = e_o365_mail_message_get_id (appended_message);
+ message_id = e_m365_mail_message_get_id (appended_message);
if (out_appended_id)
*out_appended_id = g_strdup (message_id);
@@ -998,9 +987,9 @@ camel_o365_utils_create_message_sync (EO365Connection *cnc,
builder = json_builder_new_immutable ();
- o365_utils_add_attachment_object (builder, dw, cancellable);
+ m365_utils_add_attachment_object (builder, dw, cancellable);
- success = e_o365_connection_add_mail_message_attachment_sync (cnc, NULL, message_id,
builder, NULL, cancellable, error);
+ success = e_m365_connection_add_mail_message_attachment_sync (cnc, NULL, message_id,
builder, NULL, cancellable, error);
g_object_unref (builder);
}
diff --git a/src/Microsoft365/camel/camel-m365-utils.h b/src/Microsoft365/camel/camel-m365-utils.h
new file mode 100644
index 00000000..aff72a3a
--- /dev/null
+++ b/src/Microsoft365/camel/camel-m365-utils.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef CAMEL_M365_UTILS_H
+#define CAMEL_M365_UTILS_H
+
+#include <camel/camel.h>
+
+#include "common/e-m365-connection.h"
+
+EM365Connection *
+ camel_m365_utils_new_connection (CamelService *service,
+ GCancellable *cancellable);
+gchar * camel_m365_utils_encode_category_name
+ (const gchar *name);
+gchar * camel_m365_utils_decode_category_name
+ (const gchar *flag);
+gboolean camel_m365_utils_is_system_user_flag
+ (const gchar *name);
+const gchar * camel_m365_utils_rename_label (const gchar *cat,
+ gboolean from_cat);
+void camel_m365_utils_add_message_flags
+ (JsonBuilder *builder,
+ CamelMessageInfo *info,
+ CamelMimeMessage *message);
+gboolean camel_m365_utils_fill_message_object_sync
+ (JsonBuilder *builder,
+ CamelMimeMessage *message,
+ CamelMessageInfo *info,
+ CamelAddress *override_from,
+ CamelAddress *override_recipients, /* it merges them, not
really override */
+ gboolean is_send,
+ GSList **out_attachments,
+ GCancellable *cancellable,
+ GError **error);
+gboolean camel_m365_utils_create_message_sync
+ (EM365Connection *cnc,
+ const gchar *folder_id,
+ CamelMimeMessage *message,
+ CamelMessageInfo *info,
+ gchar **out_appended_id,
+ GCancellable *cancellable,
+ GError **error);
+
+#endif /* CAMEL_M365_UTILS_H */
diff --git a/src/Microsoft365/camel/libcamelmicrosoft365.urls
b/src/Microsoft365/camel/libcamelmicrosoft365.urls
new file mode 100644
index 00000000..a74a6fc6
--- /dev/null
+++ b/src/Microsoft365/camel/libcamelmicrosoft365.urls
@@ -0,0 +1 @@
+microsoft365
diff --git a/src/Microsoft365/common/CMakeLists.txt b/src/Microsoft365/common/CMakeLists.txt
new file mode 100644
index 00000000..48737d7b
--- /dev/null
+++ b/src/Microsoft365/common/CMakeLists.txt
@@ -0,0 +1,69 @@
+glib_mkenums(e-m365-enumtypes e-m365-enums.h E_M365_ENUMTYPES_H)
+
+set(SOURCES
+ camel-sasl-xoauth2-microsoft365.c
+ camel-sasl-xoauth2-microsoft365.h
+ camel-m365-settings.c
+ camel-m365-settings.h
+ e-m365-connection.c
+ e-m365-connection.h
+ e-m365-enums.h
+ e-m365-json-utils.c
+ e-m365-json-utils.h
+ e-oauth2-service-microsoft365.c
+ e-oauth2-service-microsoft365.h
+ e-source-m365-folder.c
+ e-source-m365-folder.h
+ ${CMAKE_CURRENT_BINARY_DIR}/e-m365-enumtypes.c
+ ${CMAKE_CURRENT_BINARY_DIR}/e-m365-enumtypes.h
+)
+
+add_library(evolution-microsoft365 SHARED
+ ${SOURCES}
+)
+
+target_compile_definitions(evolution-microsoft365 PRIVATE
+ -DG_LOG_DOMAIN=\"evolution-microsoft365\"
+)
+
+target_compile_options(evolution-microsoft365 PUBLIC
+ ${CAMEL_CFLAGS}
+ ${EVOLUTION_CALENDAR_CFLAGS}
+ ${JSON_GLIB_CFLAGS}
+ ${LIBEBACKEND_CFLAGS}
+ ${LIBECAL_CFLAGS}
+ ${LIBEDATACAL_CFLAGS}
+ ${LIBEDATASERVER_CFLAGS}
+ ${SOUP_CFLAGS}
+)
+
+target_include_directories(evolution-microsoft365 PUBLIC
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_BINARY_DIR}/src/Microsoft365
+ ${CMAKE_SOURCE_DIR}/src/Microsoft365
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CAMEL_INCLUDE_DIRS}
+ ${EVOLUTION_CALENDAR_INCLUDE_DIRS}
+ ${JSON_GLIB_INCLUDE_DIRS}
+ ${LIBEBACKEND_INCLUDE_DIRS}
+ ${LIBECAL_INCLUDE_DIRS}
+ ${LIBEDATACAL_INCLUDE_DIRS}
+ ${LIBEDATASERVER_INCLUDE_DIRS}
+ ${SOUP_INCLUDE_DIRS}
+)
+
+target_link_libraries(evolution-microsoft365
+ ${CAMEL_LDFLAGS}
+ ${EVOLUTION_CALENDAR_LDFLAGS}
+ ${JSON_GLIB_LDFLAGS}
+ ${LIBEBACKEND_LDFLAGS}
+ ${LIBECAL_LDFLAGS}
+ ${LIBEDATACAL_LDFLAGS}
+ ${LIBEDATASERVER_LDFLAGS}
+ ${SOUP_LDFLAGS}
+)
+
+install(TARGETS evolution-microsoft365
+ DESTINATION ${privsolibdir}
+)
diff --git a/src/Office365/common/camel-o365-settings.c b/src/Microsoft365/common/camel-m365-settings.c
similarity index 66%
rename from src/Office365/common/camel-o365-settings.c
rename to src/Microsoft365/common/camel-m365-settings.c
index 52579232..daeac748 100644
--- a/src/Office365/common/camel-o365-settings.c
+++ b/src/Microsoft365/common/camel-m365-settings.c
@@ -1,18 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
@@ -20,9 +9,9 @@
#include <libebackend/libebackend.h>
#include <libedataserver/libedataserver.h>
-#include "camel-o365-settings.h"
+#include "camel-m365-settings.h"
-struct _CamelO365SettingsPrivate {
+struct _CamelM365SettingsPrivate {
GMutex property_lock;
gboolean use_impersonation;
gboolean check_all;
@@ -59,12 +48,12 @@ enum {
PROP_CONCURRENT_CONNECTIONS
};
-G_DEFINE_TYPE_WITH_CODE (CamelO365Settings, camel_o365_settings, CAMEL_TYPE_OFFLINE_SETTINGS,
+G_DEFINE_TYPE_WITH_CODE (CamelM365Settings, camel_m365_settings, CAMEL_TYPE_OFFLINE_SETTINGS,
G_IMPLEMENT_INTERFACE (CAMEL_TYPE_NETWORK_SETTINGS, NULL)
- G_ADD_PRIVATE (CamelO365Settings))
+ G_ADD_PRIVATE (CamelM365Settings))
static void
-o365_settings_set_property (GObject *object,
+m365_settings_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
@@ -77,26 +66,26 @@ o365_settings_set_property (GObject *object,
return;
case PROP_CHECK_ALL:
- camel_o365_settings_set_check_all (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_check_all (
+ CAMEL_M365_SETTINGS (object),
g_value_get_boolean (value));
return;
case PROP_EMAIL:
- camel_o365_settings_set_email (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_email (
+ CAMEL_M365_SETTINGS (object),
g_value_get_string (value));
return;
case PROP_FILTER_JUNK:
- camel_o365_settings_set_filter_junk (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_filter_junk (
+ CAMEL_M365_SETTINGS (object),
g_value_get_boolean (value));
return;
case PROP_FILTER_JUNK_INBOX:
- camel_o365_settings_set_filter_junk_inbox (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_filter_junk_inbox (
+ CAMEL_M365_SETTINGS (object),
g_value_get_boolean (value));
return;
@@ -119,8 +108,8 @@ o365_settings_set_property (GObject *object,
return;
case PROP_TIMEOUT:
- camel_o365_settings_set_timeout (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_timeout (
+ CAMEL_M365_SETTINGS (object),
g_value_get_uint (value));
return;
@@ -131,44 +120,44 @@ o365_settings_set_property (GObject *object,
return;
case PROP_USE_IMPERSONATION:
- camel_o365_settings_set_use_impersonation (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_use_impersonation (
+ CAMEL_M365_SETTINGS (object),
g_value_get_boolean (value));
return;
case PROP_IMPERSONATE_USER:
- camel_o365_settings_set_impersonate_user (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_impersonate_user (
+ CAMEL_M365_SETTINGS (object),
g_value_get_string (value));
return;
case PROP_OVERRIDE_OAUTH2:
- camel_o365_settings_set_override_oauth2 (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_override_oauth2 (
+ CAMEL_M365_SETTINGS (object),
g_value_get_boolean (value));
return;
case PROP_OAUTH2_TENANT:
- camel_o365_settings_set_oauth2_tenant (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_oauth2_tenant (
+ CAMEL_M365_SETTINGS (object),
g_value_get_string (value));
return;
case PROP_OAUTH2_CLIENT_ID:
- camel_o365_settings_set_oauth2_client_id (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_oauth2_client_id (
+ CAMEL_M365_SETTINGS (object),
g_value_get_string (value));
return;
case PROP_OAUTH2_REDIRECT_URI:
- camel_o365_settings_set_oauth2_redirect_uri (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_oauth2_redirect_uri (
+ CAMEL_M365_SETTINGS (object),
g_value_get_string (value));
return;
case PROP_CONCURRENT_CONNECTIONS:
- camel_o365_settings_set_concurrent_connections (
- CAMEL_O365_SETTINGS (object),
+ camel_m365_settings_set_concurrent_connections (
+ CAMEL_M365_SETTINGS (object),
g_value_get_uint (value));
return;
}
@@ -177,7 +166,7 @@ o365_settings_set_property (GObject *object,
}
static void
-o365_settings_get_property (GObject *object,
+m365_settings_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
@@ -193,29 +182,29 @@ o365_settings_get_property (GObject *object,
case PROP_CHECK_ALL:
g_value_set_boolean (
value,
- camel_o365_settings_get_check_all (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_get_check_all (
+ CAMEL_M365_SETTINGS (object)));
return;
case PROP_EMAIL:
g_value_take_string (
value,
- camel_o365_settings_dup_email (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_dup_email (
+ CAMEL_M365_SETTINGS (object)));
return;
case PROP_FILTER_JUNK:
g_value_set_boolean (
value,
- camel_o365_settings_get_filter_junk (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_get_filter_junk (
+ CAMEL_M365_SETTINGS (object)));
return;
case PROP_FILTER_JUNK_INBOX:
g_value_set_boolean (
value,
- camel_o365_settings_get_filter_junk_inbox (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_get_filter_junk_inbox (
+ CAMEL_M365_SETTINGS (object)));
return;
case PROP_HOST:
@@ -242,8 +231,8 @@ o365_settings_get_property (GObject *object,
case PROP_TIMEOUT:
g_value_set_uint (
value,
- camel_o365_settings_get_timeout (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_get_timeout (
+ CAMEL_M365_SETTINGS (object)));
return;
case PROP_USER:
@@ -256,50 +245,50 @@ o365_settings_get_property (GObject *object,
case PROP_USE_IMPERSONATION:
g_value_set_boolean (
value,
- camel_o365_settings_get_use_impersonation (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_get_use_impersonation (
+ CAMEL_M365_SETTINGS (object)));
return;
case PROP_IMPERSONATE_USER:
g_value_take_string (
value,
- camel_o365_settings_dup_impersonate_user (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_dup_impersonate_user (
+ CAMEL_M365_SETTINGS (object)));
return;
case PROP_OVERRIDE_OAUTH2:
g_value_set_boolean (
value,
- camel_o365_settings_get_override_oauth2 (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_get_override_oauth2 (
+ CAMEL_M365_SETTINGS (object)));
return;
case PROP_OAUTH2_TENANT:
g_value_take_string (
value,
- camel_o365_settings_dup_oauth2_tenant (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_dup_oauth2_tenant (
+ CAMEL_M365_SETTINGS (object)));
return;
case PROP_OAUTH2_CLIENT_ID:
g_value_take_string (
value,
- camel_o365_settings_dup_oauth2_client_id (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_dup_oauth2_client_id (
+ CAMEL_M365_SETTINGS (object)));
return;
case PROP_OAUTH2_REDIRECT_URI:
g_value_take_string (
value,
- camel_o365_settings_dup_oauth2_redirect_uri (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_dup_oauth2_redirect_uri (
+ CAMEL_M365_SETTINGS (object)));
return;
case PROP_CONCURRENT_CONNECTIONS:
g_value_set_uint (
value,
- camel_o365_settings_get_concurrent_connections (
- CAMEL_O365_SETTINGS (object)));
+ camel_m365_settings_get_concurrent_connections (
+ CAMEL_M365_SETTINGS (object)));
return;
}
@@ -307,30 +296,30 @@ o365_settings_get_property (GObject *object,
}
static void
-o365_settings_finalize (GObject *object)
+m365_settings_finalize (GObject *object)
{
- CamelO365Settings *o365_settings = CAMEL_O365_SETTINGS (object);
+ CamelM365Settings *m365_settings = CAMEL_M365_SETTINGS (object);
- g_mutex_clear (&o365_settings->priv->property_lock);
+ g_mutex_clear (&m365_settings->priv->property_lock);
- g_free (o365_settings->priv->email);
- g_free (o365_settings->priv->oauth2_tenant);
- g_free (o365_settings->priv->oauth2_client_id);
- g_free (o365_settings->priv->oauth2_redirect_uri);
+ g_free (m365_settings->priv->email);
+ g_free (m365_settings->priv->oauth2_tenant);
+ g_free (m365_settings->priv->oauth2_client_id);
+ g_free (m365_settings->priv->oauth2_redirect_uri);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (camel_o365_settings_parent_class)->finalize (object);
+ G_OBJECT_CLASS (camel_m365_settings_parent_class)->finalize (object);
}
static void
-camel_o365_settings_class_init (CamelO365SettingsClass *class)
+camel_m365_settings_class_init (CamelM365SettingsClass *class)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (class);
- object_class->set_property = o365_settings_set_property;
- object_class->get_property = o365_settings_get_property;
- object_class->finalize = o365_settings_finalize;
+ object_class->set_property = m365_settings_set_property;
+ object_class->get_property = m365_settings_get_property;
+ object_class->finalize = m365_settings_finalize;
/* Inherited from CamelNetworkSettings. */
g_object_class_override_property (
@@ -511,16 +500,16 @@ camel_o365_settings_class_init (CamelO365SettingsClass *class)
}
static void
-camel_o365_settings_init (CamelO365Settings *settings)
+camel_m365_settings_init (CamelM365Settings *settings)
{
- settings->priv = camel_o365_settings_get_instance_private (settings);
+ settings->priv = camel_m365_settings_get_instance_private (settings);
g_mutex_init (&settings->priv->property_lock);
}
/* transfer none. Checks the settings from the ESource extension related to backend. */
-CamelO365Settings *
-camel_o365_settings_get_from_backend (struct _EBackend *backend,
+CamelM365Settings *
+camel_m365_settings_get_from_backend (struct _EBackend *backend,
struct _ESourceRegistry *registry)
{
ESource *source;
@@ -534,8 +523,8 @@ camel_o365_settings_get_from_backend (struct _EBackend *backend,
g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
source = e_backend_get_source (backend);
- extension_name = e_source_camel_get_extension_name ("office365");
- e_source_camel_generate_subtype ("office365", CAMEL_TYPE_O365_SETTINGS);
+ extension_name = e_source_camel_get_extension_name ("microsoft365");
+ e_source_camel_generate_subtype ("microsoft365", CAMEL_TYPE_M365_SETTINGS);
if (registry) {
/* It's either in the 'source' or in the collection parent. */
@@ -551,22 +540,22 @@ camel_o365_settings_get_from_backend (struct _EBackend *backend,
g_object_unref (collection);
- return CAMEL_O365_SETTINGS (settings);
+ return CAMEL_M365_SETTINGS (settings);
}
gboolean
-camel_o365_settings_get_use_impersonation (CamelO365Settings *settings)
+camel_m365_settings_get_use_impersonation (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), FALSE);
return settings->priv->use_impersonation;
}
void
-camel_o365_settings_set_use_impersonation (CamelO365Settings *settings,
+camel_m365_settings_set_use_impersonation (CamelM365Settings *settings,
gboolean use_impersonation)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
if ((settings->priv->use_impersonation ? 1 : 0) == (use_impersonation ? 1 : 0))
return;
@@ -577,24 +566,24 @@ camel_o365_settings_set_use_impersonation (CamelO365Settings *settings,
}
const gchar *
-camel_o365_settings_get_impersonate_user (CamelO365Settings *settings)
+camel_m365_settings_get_impersonate_user (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
return settings->priv->impersonate_user;
}
gchar *
-camel_o365_settings_dup_impersonate_user (CamelO365Settings *settings)
+camel_m365_settings_dup_impersonate_user (CamelM365Settings *settings)
{
const gchar *protected;
gchar *duplicate;
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
g_mutex_lock (&settings->priv->property_lock);
- protected = camel_o365_settings_get_impersonate_user (settings);
+ protected = camel_m365_settings_get_impersonate_user (settings);
duplicate = g_strdup (protected);
g_mutex_unlock (&settings->priv->property_lock);
@@ -603,10 +592,10 @@ camel_o365_settings_dup_impersonate_user (CamelO365Settings *settings)
}
void
-camel_o365_settings_set_impersonate_user (CamelO365Settings *settings,
+camel_m365_settings_set_impersonate_user (CamelM365Settings *settings,
const gchar *impersonate_user)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
g_mutex_lock (&settings->priv->property_lock);
@@ -624,18 +613,18 @@ camel_o365_settings_set_impersonate_user (CamelO365Settings *settings,
}
gboolean
-camel_o365_settings_get_check_all (CamelO365Settings *settings)
+camel_m365_settings_get_check_all (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), FALSE);
return settings->priv->check_all;
}
void
-camel_o365_settings_set_check_all (CamelO365Settings *settings,
+camel_m365_settings_set_check_all (CamelM365Settings *settings,
gboolean check_all)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
if ((settings->priv->check_all ? 1 : 0) == (check_all ? 1 : 0))
return;
@@ -646,24 +635,24 @@ camel_o365_settings_set_check_all (CamelO365Settings *settings,
}
const gchar *
-camel_o365_settings_get_email (CamelO365Settings *settings)
+camel_m365_settings_get_email (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
return settings->priv->email;
}
gchar *
-camel_o365_settings_dup_email (CamelO365Settings *settings)
+camel_m365_settings_dup_email (CamelM365Settings *settings)
{
const gchar *protected;
gchar *duplicate;
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
g_mutex_lock (&settings->priv->property_lock);
- protected = camel_o365_settings_get_email (settings);
+ protected = camel_m365_settings_get_email (settings);
duplicate = g_strdup (protected);
g_mutex_unlock (&settings->priv->property_lock);
@@ -672,10 +661,10 @@ camel_o365_settings_dup_email (CamelO365Settings *settings)
}
void
-camel_o365_settings_set_email (CamelO365Settings *settings,
+camel_m365_settings_set_email (CamelM365Settings *settings,
const gchar *email)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
g_mutex_lock (&settings->priv->property_lock);
@@ -693,18 +682,18 @@ camel_o365_settings_set_email (CamelO365Settings *settings,
}
gboolean
-camel_o365_settings_get_filter_junk (CamelO365Settings *settings)
+camel_m365_settings_get_filter_junk (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), FALSE);
return settings->priv->filter_junk;
}
void
-camel_o365_settings_set_filter_junk (CamelO365Settings *settings,
+camel_m365_settings_set_filter_junk (CamelM365Settings *settings,
gboolean filter_junk)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
if ((settings->priv->filter_junk ? 1 : 0) == (filter_junk ? 1 : 0))
return;
@@ -715,18 +704,18 @@ camel_o365_settings_set_filter_junk (CamelO365Settings *settings,
}
gboolean
-camel_o365_settings_get_filter_junk_inbox (CamelO365Settings *settings)
+camel_m365_settings_get_filter_junk_inbox (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), FALSE);
return settings->priv->filter_junk_inbox;
}
void
-camel_o365_settings_set_filter_junk_inbox (CamelO365Settings *settings,
+camel_m365_settings_set_filter_junk_inbox (CamelM365Settings *settings,
gboolean filter_junk_inbox)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
if ((settings->priv->filter_junk_inbox ? 1 : 0) == (filter_junk_inbox ? 1 : 0))
return;
@@ -737,18 +726,18 @@ camel_o365_settings_set_filter_junk_inbox (CamelO365Settings *settings,
}
guint
-camel_o365_settings_get_timeout (CamelO365Settings *settings)
+camel_m365_settings_get_timeout (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), 0);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), 0);
return settings->priv->timeout;
}
void
-camel_o365_settings_set_timeout (CamelO365Settings *settings,
+camel_m365_settings_set_timeout (CamelM365Settings *settings,
guint timeout)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
if (settings->priv->timeout == timeout)
return;
@@ -759,18 +748,18 @@ camel_o365_settings_set_timeout (CamelO365Settings *settings,
}
gboolean
-camel_o365_settings_get_override_oauth2 (CamelO365Settings *settings)
+camel_m365_settings_get_override_oauth2 (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), FALSE);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), FALSE);
return settings->priv->override_oauth2;
}
void
-camel_o365_settings_set_override_oauth2 (CamelO365Settings *settings,
+camel_m365_settings_set_override_oauth2 (CamelM365Settings *settings,
gboolean override_oauth2)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
if ((settings->priv->override_oauth2 ? 1 : 0) == (override_oauth2 ? 1 : 0))
return;
@@ -781,24 +770,24 @@ camel_o365_settings_set_override_oauth2 (CamelO365Settings *settings,
}
const gchar *
-camel_o365_settings_get_oauth2_tenant (CamelO365Settings *settings)
+camel_m365_settings_get_oauth2_tenant (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
return settings->priv->oauth2_tenant;
}
gchar *
-camel_o365_settings_dup_oauth2_tenant (CamelO365Settings *settings)
+camel_m365_settings_dup_oauth2_tenant (CamelM365Settings *settings)
{
const gchar *protected;
gchar *duplicate;
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
g_mutex_lock (&settings->priv->property_lock);
- protected = camel_o365_settings_get_oauth2_tenant (settings);
+ protected = camel_m365_settings_get_oauth2_tenant (settings);
duplicate = g_strdup (protected);
g_mutex_unlock (&settings->priv->property_lock);
@@ -807,10 +796,10 @@ camel_o365_settings_dup_oauth2_tenant (CamelO365Settings *settings)
}
void
-camel_o365_settings_set_oauth2_tenant (CamelO365Settings *settings,
+camel_m365_settings_set_oauth2_tenant (CamelM365Settings *settings,
const gchar *tenant)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
g_mutex_lock (&settings->priv->property_lock);
@@ -828,24 +817,24 @@ camel_o365_settings_set_oauth2_tenant (CamelO365Settings *settings,
}
const gchar *
-camel_o365_settings_get_oauth2_client_id (CamelO365Settings *settings)
+camel_m365_settings_get_oauth2_client_id (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
return settings->priv->oauth2_client_id;
}
gchar *
-camel_o365_settings_dup_oauth2_client_id (CamelO365Settings *settings)
+camel_m365_settings_dup_oauth2_client_id (CamelM365Settings *settings)
{
const gchar *protected;
gchar *duplicate;
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
g_mutex_lock (&settings->priv->property_lock);
- protected = camel_o365_settings_get_oauth2_client_id (settings);
+ protected = camel_m365_settings_get_oauth2_client_id (settings);
duplicate = g_strdup (protected);
g_mutex_unlock (&settings->priv->property_lock);
@@ -854,10 +843,10 @@ camel_o365_settings_dup_oauth2_client_id (CamelO365Settings *settings)
}
void
-camel_o365_settings_set_oauth2_client_id (CamelO365Settings *settings,
+camel_m365_settings_set_oauth2_client_id (CamelM365Settings *settings,
const gchar *client_id)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
g_mutex_lock (&settings->priv->property_lock);
@@ -875,24 +864,24 @@ camel_o365_settings_set_oauth2_client_id (CamelO365Settings *settings,
}
const gchar *
-camel_o365_settings_get_oauth2_redirect_uri (CamelO365Settings *settings)
+camel_m365_settings_get_oauth2_redirect_uri (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
return settings->priv->oauth2_redirect_uri;
}
gchar *
-camel_o365_settings_dup_oauth2_redirect_uri (CamelO365Settings *settings)
+camel_m365_settings_dup_oauth2_redirect_uri (CamelM365Settings *settings)
{
const gchar *protected;
gchar *duplicate;
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
g_mutex_lock (&settings->priv->property_lock);
- protected = camel_o365_settings_get_oauth2_redirect_uri (settings);
+ protected = camel_m365_settings_get_oauth2_redirect_uri (settings);
duplicate = g_strdup (protected);
g_mutex_unlock (&settings->priv->property_lock);
@@ -901,10 +890,10 @@ camel_o365_settings_dup_oauth2_redirect_uri (CamelO365Settings *settings)
}
void
-camel_o365_settings_set_oauth2_redirect_uri (CamelO365Settings *settings,
+camel_m365_settings_set_oauth2_redirect_uri (CamelM365Settings *settings,
const gchar *redirect_uri)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
g_mutex_lock (&settings->priv->property_lock);
@@ -922,18 +911,18 @@ camel_o365_settings_set_oauth2_redirect_uri (CamelO365Settings *settings,
}
guint
-camel_o365_settings_get_concurrent_connections (CamelO365Settings *settings)
+camel_m365_settings_get_concurrent_connections (CamelM365Settings *settings)
{
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), 1);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), 1);
return settings->priv->concurrent_connections;
}
void
-camel_o365_settings_set_concurrent_connections (CamelO365Settings *settings,
+camel_m365_settings_set_concurrent_connections (CamelM365Settings *settings,
guint concurrent_connections)
{
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
concurrent_connections = CLAMP (
concurrent_connections,
diff --git a/src/Microsoft365/common/camel-m365-settings.h b/src/Microsoft365/common/camel-m365-settings.h
new file mode 100644
index 00000000..b2c6835f
--- /dev/null
+++ b/src/Microsoft365/common/camel-m365-settings.h
@@ -0,0 +1,126 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef CAMEL_M365_SETTINGS_H
+#define CAMEL_M365_SETTINGS_H
+
+#include <camel/camel.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_M365_SETTINGS \
+ (camel_m365_settings_get_type ())
+#define CAMEL_M365_SETTINGS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_M365_SETTINGS, CamelM365Settings))
+#define CAMEL_M365_SETTINGS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_M365_SETTINGS, CamelM365SettingsClass))
+#define CAMEL_IS_M365_SETTINGS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_M365_SETTINGS))
+#define CAMEL_IS_M365_SETTINGS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_M365_SETTINGS))
+#define CAMEL_M365_SETTINGS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_M365_SETTINGS))
+
+#define MIN_CONCURRENT_CONNECTIONS 1
+#define MAX_CONCURRENT_CONNECTIONS 7
+
+G_BEGIN_DECLS
+
+/* Forward declaration, to not include libedataserver.h/libebackend.h here */
+struct _EBackend;
+struct _ESourceRegistry;
+
+typedef struct _CamelM365Settings CamelM365Settings;
+typedef struct _CamelM365SettingsClass CamelM365SettingsClass;
+typedef struct _CamelM365SettingsPrivate CamelM365SettingsPrivate;
+
+struct _CamelM365Settings {
+ CamelOfflineSettings parent;
+ CamelM365SettingsPrivate *priv;
+};
+
+struct _CamelM365SettingsClass {
+ CamelOfflineSettingsClass parent_class;
+};
+
+GType camel_m365_settings_get_type (void) G_GNUC_CONST;
+CamelM365Settings *
+ camel_m365_settings_get_from_backend
+ (struct _EBackend *backend,
+ struct _ESourceRegistry *registry);
+gboolean camel_m365_settings_get_use_impersonation
+ (CamelM365Settings *settings);
+void camel_m365_settings_set_use_impersonation
+ (CamelM365Settings *settings,
+ gboolean use_impersonation);
+const gchar * camel_m365_settings_get_impersonate_user
+ (CamelM365Settings *settings);
+gchar * camel_m365_settings_dup_impersonate_user
+ (CamelM365Settings *settings);
+void camel_m365_settings_set_impersonate_user
+ (CamelM365Settings *settings,
+ const gchar *impersonate_user);
+gboolean camel_m365_settings_get_check_all
+ (CamelM365Settings *settings);
+void camel_m365_settings_set_check_all
+ (CamelM365Settings *settings,
+ gboolean check_all);
+const gchar * camel_m365_settings_get_email (CamelM365Settings *settings);
+gchar * camel_m365_settings_dup_email (CamelM365Settings *settings);
+void camel_m365_settings_set_email (CamelM365Settings *settings,
+ const gchar *email);
+gboolean camel_m365_settings_get_filter_junk
+ (CamelM365Settings *settings);
+void camel_m365_settings_set_filter_junk
+ (CamelM365Settings *settings,
+ gboolean filter_junk);
+gboolean camel_m365_settings_get_filter_junk_inbox
+ (CamelM365Settings *settings);
+void camel_m365_settings_set_filter_junk_inbox
+ (CamelM365Settings *settings,
+ gboolean filter_junk_inbox);
+guint camel_m365_settings_get_timeout (CamelM365Settings *settings);
+void camel_m365_settings_set_timeout (CamelM365Settings *settings,
+ guint timeout);
+gboolean camel_m365_settings_get_override_oauth2
+ (CamelM365Settings *settings);
+void camel_m365_settings_set_override_oauth2
+ (CamelM365Settings *settings,
+ gboolean override_oauth2);
+const gchar * camel_m365_settings_get_oauth2_tenant
+ (CamelM365Settings *settings);
+gchar * camel_m365_settings_dup_oauth2_tenant
+ (CamelM365Settings *settings);
+void camel_m365_settings_set_oauth2_tenant
+ (CamelM365Settings *settings,
+ const gchar *tenant);
+const gchar * camel_m365_settings_get_oauth2_client_id
+ (CamelM365Settings *settings);
+gchar * camel_m365_settings_dup_oauth2_client_id
+ (CamelM365Settings *settings);
+void camel_m365_settings_set_oauth2_client_id
+ (CamelM365Settings *settings,
+ const gchar *client_id);
+const gchar * camel_m365_settings_get_oauth2_redirect_uri
+ (CamelM365Settings *settings);
+gchar * camel_m365_settings_dup_oauth2_redirect_uri
+ (CamelM365Settings *settings);
+void camel_m365_settings_set_oauth2_redirect_uri
+ (CamelM365Settings *settings,
+ const gchar *redirect_uri);
+guint camel_m365_settings_get_concurrent_connections
+ (CamelM365Settings *settings);
+void camel_m365_settings_set_concurrent_connections
+ (CamelM365Settings *settings,
+ guint concurrent_connections);
+
+G_END_DECLS
+
+#endif /* CAMEL_M365_SETTINGS_H */
diff --git a/src/Microsoft365/common/camel-sasl-xoauth2-microsoft365.c
b/src/Microsoft365/common/camel-sasl-xoauth2-microsoft365.c
new file mode 100644
index 00000000..60c56dfa
--- /dev/null
+++ b/src/Microsoft365/common/camel-sasl-xoauth2-microsoft365.c
@@ -0,0 +1,45 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "evolution-ews-config.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "camel-sasl-xoauth2-microsoft365.h"
+
+static CamelServiceAuthType sasl_xoauth2_microsoft365_auth_type = {
+ N_("OAuth2 (Microsoft 365)"),
+ N_("This option will use an OAuth 2.0 access token to connect to the Microsoft 365 server"),
+ "Microsoft365",
+ FALSE
+};
+
+G_DEFINE_DYNAMIC_TYPE (CamelSaslXOAuth2Microsoft365, camel_sasl_xoauth2_microsoft365,
CAMEL_TYPE_SASL_XOAUTH2)
+
+static void
+camel_sasl_xoauth2_microsoft365_class_init (CamelSaslXOAuth2Microsoft365Class *klass)
+{
+ CamelSaslClass *sasl_class;
+
+ sasl_class = CAMEL_SASL_CLASS (klass);
+ sasl_class->auth_type = &sasl_xoauth2_microsoft365_auth_type;
+}
+
+static void
+camel_sasl_xoauth2_microsoft365_class_finalize (CamelSaslXOAuth2Microsoft365Class *klass)
+{
+}
+
+static void
+camel_sasl_xoauth2_microsoft365_init (CamelSaslXOAuth2Microsoft365 *sasl)
+{
+}
+
+void
+camel_sasl_xoauth2_microsoft365_type_register (GTypeModule *type_module)
+{
+ camel_sasl_xoauth2_microsoft365_register_type (type_module);
+}
diff --git a/src/Microsoft365/common/camel-sasl-xoauth2-microsoft365.h
b/src/Microsoft365/common/camel-sasl-xoauth2-microsoft365.h
new file mode 100644
index 00000000..b6380ed5
--- /dev/null
+++ b/src/Microsoft365/common/camel-sasl-xoauth2-microsoft365.h
@@ -0,0 +1,54 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef CAMEL_SASL_XOAUTH2_MICROSOFT365_H
+#define CAMEL_SASL_XOAUTH2_MICROSOFT365_H
+
+#include <gmodule.h>
+#include <camel/camel.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_SASL_XOAUTH2_MICROSOFT365 \
+ (camel_sasl_xoauth2_microsoft365_get_type ())
+#define CAMEL_SASL_XOAUTH2_MICROSOFT365(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_SASL_XOAUTH2_MICROSOFT365, CamelSaslXOAuth2Microsoft365))
+#define CAMEL_SASL_XOAUTH2_MICROSOFT365_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_SASL_XOAUTH2_MICROSOFT365, CamelSaslXOAuth2Microsoft365Class))
+#define CAMEL_IS_SASL_XOAUTH2_MICROSOFT365(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_SASL_XOAUTH2_MICROSOFT365))
+#define CAMEL_IS_SASL_XOAUTH2_MICROSOFT365_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_SASL_XOAUTH2_MICROSOFT365))
+#define CAMEL_SASL_XOAUTH2_MICROSOFT365_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_SASL_XOAUTH2_MICROSOFT365, CamelSaslXOAuth2Microsoft365Class))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelSaslXOAuth2Microsoft365 CamelSaslXOAuth2Microsoft365;
+typedef struct _CamelSaslXOAuth2Microsoft365Class CamelSaslXOAuth2Microsoft365Class;
+typedef struct _CamelSaslXOAuth2Microsoft365Private CamelSaslXOAuth2Microsoft365Private;
+
+struct _CamelSaslXOAuth2Microsoft365 {
+ CamelSaslXOAuth2 parent;
+ CamelSaslXOAuth2Microsoft365Private *priv;
+};
+
+struct _CamelSaslXOAuth2Microsoft365Class {
+ CamelSaslXOAuth2Class parent_class;
+};
+
+GType camel_sasl_xoauth2_microsoft365_get_type(void) G_GNUC_CONST;
+
+void camel_sasl_xoauth2_microsoft365_type_register
+ (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* CAMEL_SASL_XOAUTH2_MICROSOFT365_H */
diff --git a/src/Office365/common/e-o365-connection.c b/src/Microsoft365/common/e-m365-connection.c
similarity index 72%
rename from src/Office365/common/e-o365-connection.c
rename to src/Microsoft365/common/e-m365-connection.c
index e3b4b66c..74886871 100644
--- a/src/Office365/common/e-o365-connection.c
+++ b/src/Microsoft365/common/e-m365-connection.c
@@ -1,18 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
@@ -22,26 +11,26 @@
#include <glib/gi18n-lib.h>
#include <json-glib/json-glib.h>
-#include "camel-o365-settings.h"
-#include "e-o365-json-utils.h"
+#include "camel-m365-settings.h"
+#include "e-m365-json-utils.h"
-#include "e-o365-connection.h"
+#include "e-m365-connection.h"
#define LOCK(x) g_rec_mutex_lock (&(x->priv->property_lock))
#define UNLOCK(x) g_rec_mutex_unlock (&(x->priv->property_lock))
-#define X_EVO_O365_DATA "X-EVO-O365-DATA"
+#define X_EVO_M365_DATA "X-EVO-M365-DATA"
typedef enum _CSMFlags {
CSM_DEFAULT = 0,
CSM_DISABLE_RESPONSE = 1 << 0
} CSMFlags;
-struct _EO365ConnectionPrivate {
+struct _EM365ConnectionPrivate {
GRecMutex property_lock;
ESource *source;
- CamelO365Settings *settings;
+ CamelM365Settings *settings;
SoupSession *soup_session;
GProxyResolver *proxy_resolver;
ESoupAuthBearer *bearer_auth;
@@ -72,28 +61,28 @@ enum {
PROP_IMPERSONATE_USER /* This one is hidden, write only */
};
-G_DEFINE_TYPE_WITH_PRIVATE (EO365Connection, e_o365_connection, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (EM365Connection, e_m365_connection, G_TYPE_OBJECT)
static GHashTable *opened_connections = NULL;
G_LOCK_DEFINE_STATIC (opened_connections);
static gboolean
-o365_log_enabled (void)
+m365_log_enabled (void)
{
static gint log_enabled = -1;
if (log_enabled == -1)
- log_enabled = g_strcmp0 (g_getenv ("O365_DEBUG"), "1") == 0 ? 1 : 0;
+ log_enabled = g_strcmp0 (g_getenv ("M365_DEBUG"), "1") == 0 ? 1 : 0;
return log_enabled == 1;
}
static SoupSession *
-o365_connection_ref_soup_session (EO365Connection *cnc)
+m365_connection_ref_soup_session (EM365Connection *cnc)
{
SoupSession *soup_session = NULL;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), NULL);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), NULL);
LOCK (cnc);
@@ -106,7 +95,7 @@ o365_connection_ref_soup_session (EO365Connection *cnc)
}
static void
-o365_connection_utils_ensure_bearer_auth_usage (SoupSession *session,
+m365_connection_utils_ensure_bearer_auth_usage (SoupSession *session,
SoupMessage *message,
ESoupAuthBearer *bearer)
{
@@ -141,7 +130,7 @@ o365_connection_utils_ensure_bearer_auth_usage (SoupSession *session,
}
static gboolean
-o365_connection_utils_setup_bearer_auth (EO365Connection *cnc,
+m365_connection_utils_setup_bearer_auth (EM365Connection *cnc,
SoupSession *session,
SoupMessage *message,
gboolean is_in_authenticate_handler,
@@ -154,10 +143,10 @@ o365_connection_utils_setup_bearer_auth (EO365Connection *cnc,
gint expires_in_seconds = -1;
gboolean success = FALSE;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (E_IS_SOUP_AUTH_BEARER (bearer), FALSE);
- source = e_o365_connection_get_source (cnc);
+ source = e_m365_connection_get_source (cnc);
success = e_source_get_oauth2_access_token_sync (source, cancellable,
&access_token, &expires_in_seconds, error);
@@ -169,9 +158,9 @@ o365_connection_utils_setup_bearer_auth (EO365Connection *cnc,
if (session)
g_object_ref (session);
else
- session = o365_connection_ref_soup_session (cnc);
+ session = m365_connection_ref_soup_session (cnc);
- o365_connection_utils_ensure_bearer_auth_usage (session, message, bearer);
+ m365_connection_utils_ensure_bearer_auth_usage (session, message, bearer);
g_clear_object (&session);
}
@@ -183,7 +172,7 @@ o365_connection_utils_setup_bearer_auth (EO365Connection *cnc,
}
static gboolean
-o365_connection_utils_prepare_bearer_auth (EO365Connection *cnc,
+m365_connection_utils_prepare_bearer_auth (EM365Connection *cnc,
SoupSession *session,
SoupMessage *message,
GCancellable *cancellable)
@@ -193,15 +182,15 @@ o365_connection_utils_prepare_bearer_auth (EO365Connection *cnc,
gboolean success;
GError *local_error = NULL;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
- source = e_o365_connection_get_source (cnc);
+ source = e_m365_connection_get_source (cnc);
if (!source)
return TRUE;
- using_bearer_auth = e_o365_connection_ref_bearer_auth (cnc);
+ using_bearer_auth = e_m365_connection_ref_bearer_auth (cnc);
if (using_bearer_auth) {
- success = o365_connection_utils_setup_bearer_auth (cnc, session, message, FALSE,
using_bearer_auth, cancellable, &local_error);
+ success = m365_connection_utils_setup_bearer_auth (cnc, session, message, FALSE,
using_bearer_auth, cancellable, &local_error);
g_clear_object (&using_bearer_auth);
} else {
SoupAuth *soup_auth;
@@ -223,9 +212,9 @@ o365_connection_utils_prepare_bearer_auth (EO365Connection *cnc,
soup_auth = g_object_new (E_TYPE_SOUP_AUTH_BEARER, SOUP_AUTH_HOST, soup_uri->host, NULL);
- success = o365_connection_utils_setup_bearer_auth (cnc, session, message, FALSE,
E_SOUP_AUTH_BEARER (soup_auth), cancellable, &local_error);
+ success = m365_connection_utils_setup_bearer_auth (cnc, session, message, FALSE,
E_SOUP_AUTH_BEARER (soup_auth), cancellable, &local_error);
if (success)
- e_o365_connection_set_bearer_auth (cnc, E_SOUP_AUTH_BEARER (soup_auth));
+ e_m365_connection_set_bearer_auth (cnc, E_SOUP_AUTH_BEARER (soup_auth));
g_object_unref (soup_auth);
soup_uri_free (soup_uri);
@@ -247,19 +236,19 @@ o365_connection_utils_prepare_bearer_auth (EO365Connection *cnc,
}
static void
-o365_connection_authenticate (SoupSession *session,
+m365_connection_authenticate (SoupSession *session,
SoupMessage *msg,
SoupAuth *auth,
gboolean retrying,
gpointer user_data)
{
- EO365Connection *cnc = user_data;
+ EM365Connection *cnc = user_data;
ESoupAuthBearer *using_bearer_auth;
GError *local_error = NULL;
- g_return_if_fail (E_IS_O365_CONNECTION (cnc));
+ g_return_if_fail (E_IS_M365_CONNECTION (cnc));
- using_bearer_auth = e_o365_connection_ref_bearer_auth (cnc);
+ using_bearer_auth = e_m365_connection_ref_bearer_auth (cnc);
if (E_IS_SOUP_AUTH_BEARER (auth)) {
g_object_ref (auth);
@@ -268,7 +257,7 @@ o365_connection_authenticate (SoupSession *session,
g_clear_object (&using_bearer_auth);
using_bearer_auth = E_SOUP_AUTH_BEARER (auth);
- e_o365_connection_set_bearer_auth (cnc, using_bearer_auth);
+ e_m365_connection_set_bearer_auth (cnc, using_bearer_auth);
}
if (!using_bearer_auth) {
@@ -276,7 +265,7 @@ o365_connection_authenticate (SoupSession *session,
return;
}
- o365_connection_utils_setup_bearer_auth (cnc, session, msg, TRUE, E_SOUP_AUTH_BEARER (auth), NULL,
&local_error);
+ m365_connection_utils_setup_bearer_auth (cnc, session, msg, TRUE, E_SOUP_AUTH_BEARER (auth), NULL,
&local_error);
if (local_error)
soup_message_set_status_full (msg, SOUP_STATUS_IO_ERROR, local_error->message);
@@ -286,7 +275,7 @@ o365_connection_authenticate (SoupSession *session,
}
static gboolean
-o365_connection_utils_prepare_message (EO365Connection *cnc,
+m365_connection_utils_prepare_message (EM365Connection *cnc,
SoupSession *session,
SoupMessage *message,
GCancellable *cancellable)
@@ -295,18 +284,18 @@ o365_connection_utils_prepare_message (EO365Connection *cnc,
ESource *source;
GError *local_error = NULL;
- source = e_o365_connection_get_source (cnc);
+ source = e_m365_connection_get_source (cnc);
if (source)
e_soup_ssl_trust_connect (message, source);
- if (!o365_connection_utils_prepare_bearer_auth (cnc, session, message, cancellable))
+ if (!m365_connection_utils_prepare_bearer_auth (cnc, session, message, cancellable))
return FALSE;
- using_bearer_auth = e_o365_connection_ref_bearer_auth (cnc);
+ using_bearer_auth = e_m365_connection_ref_bearer_auth (cnc);
if (using_bearer_auth &&
e_soup_auth_bearer_is_expired (using_bearer_auth) &&
- !o365_connection_utils_setup_bearer_auth (cnc, session, message, FALSE, using_bearer_auth,
cancellable, &local_error)) {
+ !m365_connection_utils_setup_bearer_auth (cnc, session, message, FALSE, using_bearer_auth,
cancellable, &local_error)) {
if (local_error) {
soup_message_set_status_full (message, SOUP_STATUS_BAD_REQUEST, local_error->message);
g_clear_error (&local_error);
@@ -325,11 +314,11 @@ o365_connection_utils_prepare_message (EO365Connection *cnc,
}
static void
-o365_connection_set_settings (EO365Connection *cnc,
- CamelO365Settings *settings)
+m365_connection_set_settings (EM365Connection *cnc,
+ CamelM365Settings *settings)
{
- g_return_if_fail (E_IS_O365_CONNECTION (cnc));
- g_return_if_fail (CAMEL_IS_O365_SETTINGS (settings));
+ g_return_if_fail (E_IS_M365_CONNECTION (cnc));
+ g_return_if_fail (CAMEL_IS_M365_SETTINGS (settings));
g_return_if_fail (cnc->priv->settings == NULL);
cnc->priv->settings = g_object_ref (settings);
@@ -354,10 +343,10 @@ o365_connection_set_settings (EO365Connection *cnc,
}
static void
-o365_connection_set_source (EO365Connection *cnc,
+m365_connection_set_source (EM365Connection *cnc,
ESource *source)
{
- g_return_if_fail (E_IS_O365_CONNECTION (cnc));
+ g_return_if_fail (E_IS_M365_CONNECTION (cnc));
g_return_if_fail (E_IS_SOURCE (source));
g_return_if_fail (cnc->priv->source == NULL);
@@ -365,10 +354,10 @@ o365_connection_set_source (EO365Connection *cnc,
}
static void
-o365_connection_take_user (EO365Connection *cnc,
+m365_connection_take_user (EM365Connection *cnc,
gchar *user)
{
- g_return_if_fail (E_IS_O365_CONNECTION (cnc));
+ g_return_if_fail (E_IS_M365_CONNECTION (cnc));
LOCK (cnc);
@@ -382,15 +371,15 @@ o365_connection_take_user (EO365Connection *cnc,
}
static void
-o365_connection_take_impersonate_user (EO365Connection *cnc,
+m365_connection_take_impersonate_user (EM365Connection *cnc,
gchar *impersonate_user)
{
- g_return_if_fail (E_IS_O365_CONNECTION (cnc));
+ g_return_if_fail (E_IS_M365_CONNECTION (cnc));
LOCK (cnc);
if (!impersonate_user || !*impersonate_user ||
- !camel_o365_settings_get_use_impersonation (cnc->priv->settings)) {
+ !camel_m365_settings_get_use_impersonation (cnc->priv->settings)) {
g_clear_pointer (&impersonate_user, g_free);
}
@@ -405,67 +394,67 @@ o365_connection_take_impersonate_user (EO365Connection *cnc,
}
static void
-o365_connection_set_use_impersonation (EO365Connection *cnc,
+m365_connection_set_use_impersonation (EM365Connection *cnc,
gboolean use_impersonation)
{
- g_return_if_fail (E_IS_O365_CONNECTION (cnc));
+ g_return_if_fail (E_IS_M365_CONNECTION (cnc));
LOCK (cnc);
if (!use_impersonation)
- o365_connection_take_impersonate_user (cnc, NULL);
+ m365_connection_take_impersonate_user (cnc, NULL);
else
- o365_connection_take_impersonate_user (cnc, camel_o365_settings_dup_impersonate_user
(cnc->priv->settings));
+ m365_connection_take_impersonate_user (cnc, camel_m365_settings_dup_impersonate_user
(cnc->priv->settings));
UNLOCK (cnc);
}
static void
-o365_connection_set_property (GObject *object,
+m365_connection_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
case PROP_PROXY_RESOLVER:
- e_o365_connection_set_proxy_resolver (
- E_O365_CONNECTION (object),
+ e_m365_connection_set_proxy_resolver (
+ E_M365_CONNECTION (object),
g_value_get_object (value));
return;
case PROP_SETTINGS:
- o365_connection_set_settings (
- E_O365_CONNECTION (object),
+ m365_connection_set_settings (
+ E_M365_CONNECTION (object),
g_value_get_object (value));
return;
case PROP_SOURCE:
- o365_connection_set_source (
- E_O365_CONNECTION (object),
+ m365_connection_set_source (
+ E_M365_CONNECTION (object),
g_value_get_object (value));
return;
case PROP_CONCURRENT_CONNECTIONS:
- e_o365_connection_set_concurrent_connections (
- E_O365_CONNECTION (object),
+ e_m365_connection_set_concurrent_connections (
+ E_M365_CONNECTION (object),
g_value_get_uint (value));
return;
case PROP_USER:
- o365_connection_take_user (
- E_O365_CONNECTION (object),
+ m365_connection_take_user (
+ E_M365_CONNECTION (object),
g_value_dup_string (value));
return;
case PROP_USE_IMPERSONATION:
- o365_connection_set_use_impersonation (
- E_O365_CONNECTION (object),
+ m365_connection_set_use_impersonation (
+ E_M365_CONNECTION (object),
g_value_get_boolean (value));
return;
case PROP_IMPERSONATE_USER:
- o365_connection_take_impersonate_user (
- E_O365_CONNECTION (object),
+ m365_connection_take_impersonate_user (
+ E_M365_CONNECTION (object),
g_value_dup_string (value));
return;
}
@@ -474,7 +463,7 @@ o365_connection_set_property (GObject *object,
}
static void
-o365_connection_get_property (GObject *object,
+m365_connection_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
@@ -483,29 +472,29 @@ o365_connection_get_property (GObject *object,
case PROP_PROXY_RESOLVER:
g_value_take_object (
value,
- e_o365_connection_ref_proxy_resolver (
- E_O365_CONNECTION (object)));
+ e_m365_connection_ref_proxy_resolver (
+ E_M365_CONNECTION (object)));
return;
case PROP_SETTINGS:
g_value_set_object (
value,
- e_o365_connection_get_settings (
- E_O365_CONNECTION (object)));
+ e_m365_connection_get_settings (
+ E_M365_CONNECTION (object)));
return;
case PROP_SOURCE:
g_value_set_object (
value,
- e_o365_connection_get_source (
- E_O365_CONNECTION (object)));
+ e_m365_connection_get_source (
+ E_M365_CONNECTION (object)));
return;
case PROP_CONCURRENT_CONNECTIONS:
g_value_set_uint (
value,
- e_o365_connection_get_concurrent_connections (
- E_O365_CONNECTION (object)));
+ e_m365_connection_get_concurrent_connections (
+ E_M365_CONNECTION (object)));
return;
}
@@ -513,14 +502,14 @@ o365_connection_get_property (GObject *object,
}
static void
-o365_connection_constructed (GObject *object)
+m365_connection_constructed (GObject *object)
{
- EO365Connection *cnc = E_O365_CONNECTION (object);
+ EM365Connection *cnc = E_M365_CONNECTION (object);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_o365_connection_parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_m365_connection_parent_class)->constructed (object);
- if (o365_log_enabled ()) {
+ if (m365_log_enabled ()) {
SoupLogger *logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, -1);
soup_session_add_feature (cnc->priv->soup_session, SOUP_SESSION_FEATURE (logger));
@@ -534,7 +523,7 @@ o365_connection_constructed (GObject *object)
g_signal_connect (
cnc->priv->soup_session, "authenticate",
- G_CALLBACK (o365_connection_authenticate), cnc);
+ G_CALLBACK (m365_connection_authenticate), cnc);
cnc->priv->hash_key = camel_network_settings_dup_user (CAMEL_NETWORK_SETTINGS (cnc->priv->settings));
@@ -548,9 +537,9 @@ o365_connection_constructed (GObject *object)
}
static void
-o365_connection_dispose (GObject *object)
+m365_connection_dispose (GObject *object)
{
- EO365Connection *cnc = E_O365_CONNECTION (object);
+ EM365Connection *cnc = E_M365_CONNECTION (object);
G_LOCK (opened_connections);
@@ -571,7 +560,7 @@ o365_connection_dispose (GObject *object)
if (cnc->priv->soup_session) {
g_signal_handlers_disconnect_by_func (
cnc->priv->soup_session,
- o365_connection_authenticate, object);
+ m365_connection_authenticate, object);
}
g_clear_object (&cnc->priv->source);
@@ -583,13 +572,13 @@ o365_connection_dispose (GObject *object)
UNLOCK (cnc);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_o365_connection_parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_m365_connection_parent_class)->dispose (object);
}
static void
-o365_connection_finalize (GObject *object)
+m365_connection_finalize (GObject *object)
{
- EO365Connection *cnc = E_O365_CONNECTION (object);
+ EM365Connection *cnc = E_M365_CONNECTION (object);
g_rec_mutex_clear (&cnc->priv->property_lock);
g_clear_pointer (&cnc->priv->ssl_certificate_pem, g_free);
@@ -598,20 +587,20 @@ o365_connection_finalize (GObject *object)
g_free (cnc->priv->hash_key);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_o365_connection_parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_m365_connection_parent_class)->finalize (object);
}
static void
-e_o365_connection_class_init (EO365ConnectionClass *class)
+e_m365_connection_class_init (EM365ConnectionClass *class)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (class);
- object_class->set_property = o365_connection_set_property;
- object_class->get_property = o365_connection_get_property;
- object_class->constructed = o365_connection_constructed;
- object_class->dispose = o365_connection_dispose;
- object_class->finalize = o365_connection_finalize;
+ object_class->set_property = m365_connection_set_property;
+ object_class->get_property = m365_connection_get_property;
+ object_class->constructed = m365_connection_constructed;
+ object_class->dispose = m365_connection_dispose;
+ object_class->finalize = m365_connection_finalize;
g_object_class_install_property (
object_class,
@@ -631,7 +620,7 @@ e_o365_connection_class_init (EO365ConnectionClass *class)
"settings",
"Settings",
"Connection settings",
- CAMEL_TYPE_O365_SETTINGS,
+ CAMEL_TYPE_M365_SETTINGS,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -658,7 +647,7 @@ e_o365_connection_class_init (EO365ConnectionClass *class)
MIN_CONCURRENT_CONNECTIONS,
MAX_CONCURRENT_CONNECTIONS,
1,
- /* Do not construct it, otherwise it overrides the value derived from
CamelO365Settings */
+ /* Do not construct it, otherwise it overrides the value derived from
CamelM365Settings */
G_PARAM_READWRITE |
G_PARAM_EXPLICIT_NOTIFY |
G_PARAM_STATIC_STRINGS));
@@ -698,9 +687,9 @@ e_o365_connection_class_init (EO365ConnectionClass *class)
}
static void
-e_o365_connection_init (EO365Connection *cnc)
+e_m365_connection_init (EM365Connection *cnc)
{
- cnc->priv = e_o365_connection_get_instance_private (cnc);
+ cnc->priv = e_m365_connection_get_instance_private (cnc);
g_rec_mutex_init (&cnc->priv->property_lock);
@@ -719,61 +708,61 @@ e_o365_connection_init (EO365Connection *cnc)
}
gboolean
-e_o365_connection_util_delta_token_failed (const GError *error)
+e_m365_connection_util_delta_token_failed (const GError *error)
{
return g_error_matches (error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED) ||
g_error_matches (error, SOUP_HTTP_ERROR, SOUP_STATUS_BAD_REQUEST);
}
-EO365Connection *
-e_o365_connection_new (ESource *source,
- CamelO365Settings *settings)
+EM365Connection *
+e_m365_connection_new (ESource *source,
+ CamelM365Settings *settings)
{
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
- return e_o365_connection_new_full (source, settings, TRUE);
+ return e_m365_connection_new_full (source, settings, TRUE);
}
-EO365Connection *
-e_o365_connection_new_for_backend (EBackend *backend,
+EM365Connection *
+e_m365_connection_new_for_backend (EBackend *backend,
ESourceRegistry *registry,
ESource *source,
- CamelO365Settings *settings)
+ CamelM365Settings *settings)
{
ESource *backend_source, *parent_source;
g_return_val_if_fail (E_IS_BACKEND (backend), NULL);
g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- g_return_val_if_fail (CAMEL_IS_O365_SETTINGS (settings), NULL);
+ g_return_val_if_fail (CAMEL_IS_M365_SETTINGS (settings), NULL);
backend_source = e_backend_get_source (backend);
if (!backend_source)
- return e_o365_connection_new (source, settings);
+ return e_m365_connection_new (source, settings);
parent_source = e_source_registry_find_extension (registry, source, E_SOURCE_EXTENSION_COLLECTION);
if (parent_source) {
- EO365Connection *cnc;
+ EM365Connection *cnc;
- cnc = e_o365_connection_new (parent_source, settings);
+ cnc = e_m365_connection_new (parent_source, settings);
g_object_unref (parent_source);
return cnc;
}
- return e_o365_connection_new (source, settings);
+ return e_m365_connection_new (source, settings);
}
-EO365Connection *
-e_o365_connection_new_full (ESource *source,
- CamelO365Settings *settings,
+EM365Connection *
+e_m365_connection_new_full (ESource *source,
+ CamelM365Settings *settings,
gboolean allow_reuse)
{
- EO365Connection *cnc;
+ EM365Connection *cnc;
if (allow_reuse) {
gchar *hash_key = camel_network_settings_dup_user (CAMEL_NETWORK_SETTINGS (settings));
@@ -800,7 +789,7 @@ e_o365_connection_new_full (ESource *source,
g_free (hash_key);
}
- cnc = g_object_new (E_TYPE_O365_CONNECTION,
+ cnc = g_object_new (E_TYPE_M365_CONNECTION,
"source", source,
"settings", settings,
NULL);
@@ -820,27 +809,27 @@ e_o365_connection_new_full (ESource *source,
}
ESource *
-e_o365_connection_get_source (EO365Connection *cnc)
+e_m365_connection_get_source (EM365Connection *cnc)
{
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), NULL);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), NULL);
return cnc->priv->source;
}
-CamelO365Settings *
-e_o365_connection_get_settings (EO365Connection *cnc)
+CamelM365Settings *
+e_m365_connection_get_settings (EM365Connection *cnc)
{
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), NULL);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), NULL);
return cnc->priv->settings;
}
guint
-e_o365_connection_get_concurrent_connections (EO365Connection *cnc)
+e_m365_connection_get_concurrent_connections (EM365Connection *cnc)
{
guint current_cc = 0;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), 1);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), 1);
LOCK (cnc);
@@ -852,16 +841,16 @@ e_o365_connection_get_concurrent_connections (EO365Connection *cnc)
}
void
-e_o365_connection_set_concurrent_connections (EO365Connection *cnc,
+e_m365_connection_set_concurrent_connections (EM365Connection *cnc,
guint concurrent_connections)
{
guint current_cc;
- g_return_if_fail (E_IS_O365_CONNECTION (cnc));
+ g_return_if_fail (E_IS_M365_CONNECTION (cnc));
concurrent_connections = CLAMP (concurrent_connections, MIN_CONCURRENT_CONNECTIONS,
MAX_CONCURRENT_CONNECTIONS);
- current_cc = e_o365_connection_get_concurrent_connections (cnc);
+ current_cc = e_m365_connection_get_concurrent_connections (cnc);
if (current_cc == concurrent_connections)
return;
@@ -879,11 +868,11 @@ e_o365_connection_set_concurrent_connections (EO365Connection *cnc,
}
GProxyResolver *
-e_o365_connection_ref_proxy_resolver (EO365Connection *cnc)
+e_m365_connection_ref_proxy_resolver (EM365Connection *cnc)
{
GProxyResolver *proxy_resolver = NULL;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), NULL);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), NULL);
LOCK (cnc);
@@ -896,12 +885,12 @@ e_o365_connection_ref_proxy_resolver (EO365Connection *cnc)
}
void
-e_o365_connection_set_proxy_resolver (EO365Connection *cnc,
+e_m365_connection_set_proxy_resolver (EM365Connection *cnc,
GProxyResolver *proxy_resolver)
{
gboolean notify = FALSE;
- g_return_if_fail (E_IS_O365_CONNECTION (cnc));
+ g_return_if_fail (E_IS_M365_CONNECTION (cnc));
LOCK (cnc);
@@ -926,11 +915,11 @@ e_o365_connection_set_proxy_resolver (EO365Connection *cnc,
}
ESoupAuthBearer *
-e_o365_connection_ref_bearer_auth (EO365Connection *cnc)
+e_m365_connection_ref_bearer_auth (EM365Connection *cnc)
{
ESoupAuthBearer *res = NULL;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), NULL);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), NULL);
LOCK (cnc);
@@ -943,10 +932,10 @@ e_o365_connection_ref_bearer_auth (EO365Connection *cnc)
}
void
-e_o365_connection_set_bearer_auth (EO365Connection *cnc,
+e_m365_connection_set_bearer_auth (EM365Connection *cnc,
ESoupAuthBearer *bearer_auth)
{
- g_return_if_fail (E_IS_O365_CONNECTION (cnc));
+ g_return_if_fail (E_IS_M365_CONNECTION (cnc));
LOCK (cnc);
@@ -963,7 +952,7 @@ e_o365_connection_set_bearer_auth (EO365Connection *cnc,
}
static void
-o365_connection_request_cancelled_cb (GCancellable *cancellable,
+m365_connection_request_cancelled_cb (GCancellable *cancellable,
gpointer user_data)
{
EFlag *flag = user_data;
@@ -974,12 +963,12 @@ o365_connection_request_cancelled_cb (GCancellable *cancellable,
}
static void
-o365_connection_extract_ssl_data (EO365Connection *cnc,
+m365_connection_extract_ssl_data (EM365Connection *cnc,
SoupMessage *message)
{
GTlsCertificate *certificate = NULL;
- g_return_if_fail (E_IS_O365_CONNECTION (cnc));
+ g_return_if_fail (E_IS_M365_CONNECTION (cnc));
g_return_if_fail (SOUP_IS_MESSAGE (message));
LOCK (cnc);
@@ -1017,7 +1006,7 @@ o365_connection_extract_ssl_data (EO365Connection *cnc,
*/
static gboolean
-o365_connection_extract_error (JsonNode *node,
+m365_connection_extract_error (JsonNode *node,
guint status_code,
GError **error)
{
@@ -1027,13 +1016,13 @@ o365_connection_extract_error (JsonNode *node,
if (!node || !JSON_NODE_HOLDS_OBJECT (node))
return FALSE;
- object = e_o365_json_get_object_member (json_node_get_object (node), "error");
+ object = e_m365_json_get_object_member (json_node_get_object (node), "error");
if (!object)
return FALSE;
- code = e_o365_json_get_string_member (object, "code", NULL);
- message = e_o365_json_get_string_member (object, "message", NULL);
+ code = e_m365_json_get_string_member (object, "code", NULL);
+ message = e_m365_json_get_string_member (object, "message", NULL);
if (!code && !message)
return FALSE;
@@ -1051,7 +1040,7 @@ o365_connection_extract_error (JsonNode *node,
return TRUE;
}
-typedef gboolean (* EO365ResponseFunc) (EO365Connection *cnc,
+typedef gboolean (* EM365ResponseFunc) (EM365Connection *cnc,
SoupMessage *message,
GInputStream *input_stream,
JsonNode *node,
@@ -1063,7 +1052,7 @@ typedef gboolean (* EO365ResponseFunc) (EO365Connection *cnc,
/* (transfer full) (nullable): Free the *out_node with json_node_unref(), if not NULL;
It can return 'success', even when the *out_node is NULL. */
gboolean
-e_o365_connection_json_node_from_message (SoupMessage *message,
+e_m365_connection_json_node_from_message (SoupMessage *message,
GInputStream *input_stream,
JsonNode **out_node,
GCancellable *cancellable,
@@ -1078,12 +1067,12 @@ e_o365_connection_json_node_from_message (SoupMessage *message,
*out_node = NULL;
- message_json_object = g_object_get_data (G_OBJECT (message), X_EVO_O365_DATA);
+ message_json_object = g_object_get_data (G_OBJECT (message), X_EVO_M365_DATA);
if (message_json_object) {
*out_node = json_node_init_object (json_node_new (JSON_NODE_OBJECT), message_json_object);
- success = !o365_connection_extract_error (*out_node, message->status_code, &local_error);
+ success = !m365_connection_extract_error (*out_node, message->status_code, &local_error);
} else {
const gchar *content_type;
@@ -1114,7 +1103,7 @@ e_o365_connection_json_node_from_message (SoupMessage *message,
if (success) {
*out_node = json_parser_steal_root (json_parser);
- success = !o365_connection_extract_error (*out_node, message->status_code,
&local_error);
+ success = !m365_connection_extract_error (*out_node, message->status_code,
&local_error);
}
g_object_unref (json_parser);
@@ -1133,10 +1122,10 @@ e_o365_connection_json_node_from_message (SoupMessage *message,
}
static gboolean
-o365_connection_send_request_sync (EO365Connection *cnc,
+m365_connection_send_request_sync (EM365Connection *cnc,
SoupMessage *message,
- EO365ResponseFunc response_func,
- EO365ConnectionRawDataFunc raw_data_func,
+ EM365ResponseFunc response_func,
+ EM365ConnectionRawDataFunc raw_data_func,
gpointer func_user_data,
GCancellable *cancellable,
GError **error)
@@ -1145,7 +1134,7 @@ o365_connection_send_request_sync (EO365Connection *cnc,
gint need_retry_seconds = 5;
gboolean success = FALSE, need_retry = TRUE;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (SOUP_IS_MESSAGE (message), FALSE);
g_return_val_if_fail (response_func != NULL || raw_data_func != NULL, FALSE);
g_return_val_if_fail (response_func == NULL || raw_data_func == NULL, FALSE);
@@ -1167,7 +1156,7 @@ o365_connection_send_request_sync (EO365Connection *cnc,
flag = e_flag_new ();
if (cancellable) {
- handler_id = g_cancellable_connect (cancellable, G_CALLBACK
(o365_connection_request_cancelled_cb),
+ handler_id = g_cancellable_connect (cancellable, G_CALLBACK
(m365_connection_request_cancelled_cb),
flag, NULL);
}
@@ -1232,14 +1221,14 @@ o365_connection_send_request_sync (EO365Connection *cnc,
UNLOCK (cnc);
if (soup_session &&
- o365_connection_utils_prepare_message (cnc, soup_session, message, cancellable)) {
+ m365_connection_utils_prepare_message (cnc, soup_session, message, cancellable)) {
GInputStream *input_stream;
input_stream = soup_session_send (soup_session, message, cancellable, error);
success = input_stream != NULL;
- if (success && o365_log_enabled ())
+ if (success && m365_log_enabled ())
input_stream = e_soup_logger_attach (message, input_stream);
/* Throttling - https://docs.microsoft.com/en-us/graph/throttling */
@@ -1248,7 +1237,7 @@ o365_connection_send_request_sync (EO365Connection *cnc,
message->status_code == SOUP_STATUS_SERVICE_UNAVAILABLE) {
need_retry = TRUE;
} else if (message->status_code == SOUP_STATUS_SSL_FAILED) {
- o365_connection_extract_ssl_data (cnc, message);
+ m365_connection_extract_ssl_data (cnc, message);
}
if (need_retry) {
@@ -1283,7 +1272,7 @@ o365_connection_send_request_sync (EO365Connection *cnc,
} else if (success) {
JsonNode *node = NULL;
- success = e_o365_connection_json_node_from_message (message, input_stream,
&node, cancellable, error);
+ success = e_m365_connection_json_node_from_message (message, input_stream,
&node, cancellable, error);
if (success) {
gchar *next_link = NULL;
@@ -1347,7 +1336,7 @@ o365_connection_send_request_sync (EO365Connection *cnc,
}
static gboolean
-e_o365_read_no_response_cb (EO365Connection *cnc,
+e_m365_read_no_response_cb (EM365Connection *cnc,
SoupMessage *message,
GInputStream *raw_data_stream,
gpointer user_data,
@@ -1358,7 +1347,7 @@ e_o365_read_no_response_cb (EO365Connection *cnc,
Read the data stream only if debugging is on, in case
the server returns anything interesting. */
- if (o365_log_enabled ()) {
+ if (m365_log_enabled ()) {
gchar buffer[4096];
while (g_input_stream_read (raw_data_stream, buffer, sizeof (buffer), cancellable, error) >
0) {
@@ -1370,7 +1359,7 @@ e_o365_read_no_response_cb (EO365Connection *cnc,
}
static gboolean
-e_o365_read_to_byte_array_cb (EO365Connection *cnc,
+e_m365_read_to_byte_array_cb (EM365Connection *cnc,
SoupMessage *message,
GInputStream *raw_data_stream,
gpointer user_data,
@@ -1402,17 +1391,17 @@ e_o365_read_to_byte_array_cb (EO365Connection *cnc,
return !n_read;
}
-typedef struct _EO365ResponseData {
- EO365ConnectionJsonFunc json_func;
+typedef struct _EM365ResponseData {
+ EM365ConnectionJsonFunc json_func;
gpointer func_user_data;
gboolean read_only_once; /* To be able to just try authentication */
GSList **out_items; /* JsonObject * */
gchar **out_delta_link; /* set only if available and not NULL */
GPtrArray *inout_requests; /* SoupMessage *, for the batch request */
-} EO365ResponseData;
+} EM365ResponseData;
static gboolean
-e_o365_read_valued_response_cb (EO365Connection *cnc,
+e_m365_read_valued_response_cb (EM365Connection *cnc,
SoupMessage *message,
GInputStream *input_stream,
JsonNode *node,
@@ -1421,7 +1410,7 @@ e_o365_read_valued_response_cb (EO365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
- EO365ResponseData *response_data = user_data;
+ EM365ResponseData *response_data = user_data;
JsonObject *object;
JsonArray *value;
const gchar *delta_link;
@@ -1437,14 +1426,14 @@ e_o365_read_valued_response_cb (EO365Connection *cnc,
g_return_val_if_fail (object != NULL, FALSE);
if (!response_data->read_only_once)
- *out_next_link = g_strdup (e_o365_json_get_string_member (object, "@odata.nextLink", NULL));
+ *out_next_link = g_strdup (e_m365_json_get_string_member (object, "@odata.nextLink", NULL));
- delta_link = e_o365_json_get_string_member (object, "@odata.deltaLink", NULL);
+ delta_link = e_m365_json_get_string_member (object, "@odata.deltaLink", NULL);
if (delta_link && response_data->out_delta_link)
*response_data->out_delta_link = g_strdup (delta_link);
- value = e_o365_json_get_array_member (object, "value");
+ value = e_m365_json_get_array_member (object, "value");
g_return_val_if_fail (value != NULL, FALSE);
len = json_array_get_length (value);
@@ -1475,7 +1464,7 @@ e_o365_read_valued_response_cb (EO365Connection *cnc,
}
static gboolean
-e_o365_read_json_object_response_cb (EO365Connection *cnc,
+e_m365_read_json_object_response_cb (EM365Connection *cnc,
SoupMessage *message,
GInputStream *input_stream,
JsonNode *node,
@@ -1500,7 +1489,7 @@ e_o365_read_json_object_response_cb (EO365Connection *cnc,
}
static SoupMessage *
-o365_connection_new_soup_message (const gchar *method,
+m365_connection_new_soup_message (const gchar *method,
const gchar *uri,
CSMFlags csm_flags,
GError **error)
@@ -1514,7 +1503,7 @@ o365_connection_new_soup_message (const gchar *method,
if (message) {
soup_message_headers_append (message->request_headers, "Connection", "Close");
- soup_message_headers_append (message->request_headers, "User-Agent", "Evolution-O365/"
VERSION);
+ soup_message_headers_append (message->request_headers, "User-Agent", "Evolution-M365/"
VERSION);
/* Disable caching for proxies (RFC 4918, section 10.4.5) */
soup_message_headers_append (message->request_headers, "Cache-Control", "no-cache");
@@ -1530,11 +1519,11 @@ o365_connection_new_soup_message (const gchar *method,
}
gboolean
-e_o365_connection_get_ssl_error_details (EO365Connection *cnc,
+e_m365_connection_get_ssl_error_details (EM365Connection *cnc,
gchar **out_certificate_pem,
GTlsCertificateFlags *out_certificate_errors)
{
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (out_certificate_pem != NULL, FALSE);
g_return_val_if_fail (out_certificate_errors != NULL, FALSE);
@@ -1554,9 +1543,9 @@ e_o365_connection_get_ssl_error_details (EO365Connection *cnc,
}
ESourceAuthenticationResult
-e_o365_connection_authenticate_sync (EO365Connection *cnc,
+e_m365_connection_authenticate_sync (EM365Connection *cnc,
const gchar *user_override,
- EO365FolderKind kind,
+ EM365FolderKind kind,
const gchar *group_id,
const gchar *folder_id,
gchar **out_certificate_pem,
@@ -1569,30 +1558,30 @@ e_o365_connection_authenticate_sync (EO365Connection *cnc,
gboolean success = FALSE;
GError *local_error = NULL;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), result);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), result);
switch (kind) {
default:
g_warn_if_reached ();
/* Falls through */
- case E_O365_FOLDER_KIND_UNKNOWN:
- case E_O365_FOLDER_KIND_MAIL:
+ case E_M365_FOLDER_KIND_UNKNOWN:
+ case E_M365_FOLDER_KIND_MAIL:
if (!folder_id || !*folder_id)
folder_id = "inbox";
- success = e_o365_connection_get_mail_folder_sync (cnc, user_override, folder_id,
"displayName", &object, cancellable, &local_error);
+ success = e_m365_connection_get_mail_folder_sync (cnc, user_override, folder_id,
"displayName", &object, cancellable, &local_error);
break;
- case E_O365_FOLDER_KIND_CONTACTS:
+ case E_M365_FOLDER_KIND_CONTACTS:
if (!folder_id || !*folder_id)
folder_id = "contacts";
- success = e_o365_connection_get_contacts_folder_sync (cnc, user_override, folder_id,
"displayName", &object, cancellable, &local_error);
+ success = e_m365_connection_get_contacts_folder_sync (cnc, user_override, folder_id,
"displayName", &object, cancellable, &local_error);
break;
- case E_O365_FOLDER_KIND_CALENDAR:
+ case E_M365_FOLDER_KIND_CALENDAR:
if (folder_id && !*folder_id)
folder_id = NULL;
- success = e_o365_connection_get_calendar_folder_sync (cnc, user_override, group_id,
folder_id, "name", &object, cancellable, error);
+ success = e_m365_connection_get_calendar_folder_sync (cnc, user_override, group_id,
folder_id, "name", &object, cancellable, error);
break;
}
@@ -1606,11 +1595,11 @@ e_o365_connection_authenticate_sync (EO365Connection *cnc,
result = E_SOURCE_AUTHENTICATION_ERROR_SSL_FAILED;
if (out_certificate_pem || out_certificate_errors)
- e_o365_connection_get_ssl_error_details (cnc, out_certificate_pem,
out_certificate_errors);
+ e_m365_connection_get_ssl_error_details (cnc, out_certificate_pem,
out_certificate_errors);
} else if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED)) {
ESoupAuthBearer *bearer;
- bearer = e_o365_connection_ref_bearer_auth (cnc);
+ bearer = e_m365_connection_ref_bearer_auth (cnc);
if (bearer) {
LOCK (cnc);
@@ -1646,11 +1635,11 @@ e_o365_connection_authenticate_sync (EO365Connection *cnc,
}
gboolean
-e_o365_connection_disconnect_sync (EO365Connection *cnc,
+e_m365_connection_disconnect_sync (EM365Connection *cnc,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
LOCK (cnc);
@@ -1664,10 +1653,10 @@ e_o365_connection_disconnect_sync (EO365Connection *cnc,
/* Expects NULL-terminated pair of parameters 'name', 'value'; if 'value' is NULL, the parameter is skipped.
An empty 'name' can add the 'value' into the path. These can be only before query parameters. */
gchar *
-e_o365_connection_construct_uri (EO365Connection *cnc,
+e_m365_connection_construct_uri (EM365Connection *cnc,
gboolean include_user,
const gchar *user_override,
- EO365ApiVersion api_version,
+ EM365ApiVersion api_version,
const gchar *api_part,
const gchar *resource,
const gchar *id,
@@ -1679,7 +1668,7 @@ e_o365_connection_construct_uri (EO365Connection *cnc,
gboolean first_param = TRUE;
GString *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), NULL);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), NULL);
if (!api_part)
api_part = "users";
@@ -1691,11 +1680,11 @@ e_o365_connection_construct_uri (EO365Connection *cnc,
g_string_append (uri, "https://graph.microsoft.com");
switch (api_version) {
- case E_O365_API_V1_0:
+ case E_M365_API_V1_0:
g_string_append_c (uri, '/');
g_string_append (uri, "v1.0");
break;
- case E_O365_API_BETA:
+ case E_M365_API_BETA:
g_string_append_c (uri, '/');
g_string_append (uri, "beta");
break;
@@ -1788,7 +1777,7 @@ e_o365_connection_construct_uri (EO365Connection *cnc,
}
static void
-e_o365_connection_set_json_body (SoupMessage *message,
+e_m365_connection_set_json_body (SoupMessage *message,
JsonBuilder *builder)
{
JsonGenerator *generator;
@@ -1816,7 +1805,7 @@ e_o365_connection_set_json_body (SoupMessage *message,
}
static void
-e_o365_fill_message_headers_cb (JsonObject *object,
+e_m365_fill_message_headers_cb (JsonObject *object,
const gchar *member_name,
JsonNode *member_node,
gpointer user_data)
@@ -1838,7 +1827,7 @@ e_o365_fill_message_headers_cb (JsonObject *object,
}
static void
-e_o365_connection_fill_batch_response (SoupMessage *message,
+e_m365_connection_fill_batch_response (SoupMessage *message,
JsonObject *object)
{
JsonObject *subobject;
@@ -1846,21 +1835,21 @@ e_o365_connection_fill_batch_response (SoupMessage *message,
g_return_if_fail (SOUP_IS_MESSAGE (message));
g_return_if_fail (object != NULL);
- message->status_code = e_o365_json_get_int_member (object, "status", SOUP_STATUS_MALFORMED);
+ message->status_code = e_m365_json_get_int_member (object, "status", SOUP_STATUS_MALFORMED);
- subobject = e_o365_json_get_object_member (object, "headers");
+ subobject = e_m365_json_get_object_member (object, "headers");
if (subobject)
- json_object_foreach_member (subobject, e_o365_fill_message_headers_cb, message);
+ json_object_foreach_member (subobject, e_m365_fill_message_headers_cb, message);
- subobject = e_o365_json_get_object_member (object, "body");
+ subobject = e_m365_json_get_object_member (object, "body");
if (subobject)
- g_object_set_data_full (G_OBJECT (message), X_EVO_O365_DATA, json_object_ref (subobject),
(GDestroyNotify) json_object_unref);
+ g_object_set_data_full (G_OBJECT (message), X_EVO_M365_DATA, json_object_ref (subobject),
(GDestroyNotify) json_object_unref);
}
static gboolean
-e_o365_read_batch_response_cb (EO365Connection *cnc,
+e_m365_read_batch_response_cb (EM365Connection *cnc,
SoupMessage *message,
GInputStream *input_stream,
JsonNode *node,
@@ -1881,9 +1870,9 @@ e_o365_read_batch_response_cb (EO365Connection *cnc,
object = json_node_get_object (node);
g_return_val_if_fail (object != NULL, FALSE);
- *out_next_link = g_strdup (e_o365_json_get_string_member (object, "@odata.nextLink", NULL));
+ *out_next_link = g_strdup (e_m365_json_get_string_member (object, "@odata.nextLink", NULL));
- responses = e_o365_json_get_array_member (object, "responses");
+ responses = e_m365_json_get_array_member (object, "responses");
g_return_val_if_fail (responses != NULL, FALSE);
len = json_array_get_length (responses);
@@ -1899,7 +1888,7 @@ e_o365_read_batch_response_cb (EO365Connection *cnc,
if (elem_object) {
const gchar *id_str;
- id_str = e_o365_json_get_string_member (elem_object, "id", NULL);
+ id_str = e_m365_json_get_string_member (elem_object, "id", NULL);
if (id_str) {
guint id;
@@ -1907,7 +1896,7 @@ e_o365_read_batch_response_cb (EO365Connection *cnc,
id = (guint) g_ascii_strtoull (id_str, NULL, 10);
if (id < requests->len)
- e_o365_connection_fill_batch_response (g_ptr_array_index
(requests, id), elem_object);
+ e_m365_connection_fill_batch_response (g_ptr_array_index
(requests, id), elem_object);
}
}
}
@@ -1919,8 +1908,8 @@ e_o365_read_batch_response_cb (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/json-batching */
static gboolean
-e_o365_connection_batch_request_internal_sync (EO365Connection *cnc,
- EO365ApiVersion api_version,
+e_m365_connection_batch_request_internal_sync (EM365Connection *cnc,
+ EM365ApiVersion api_version,
GPtrArray *requests, /* SoupMessage * */
GCancellable *cancellable,
GError **error)
@@ -1931,15 +1920,15 @@ e_o365_connection_batch_request_internal_sync (EO365Connection *cnc,
gchar *uri, buff[128];
guint ii;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (requests != NULL, FALSE);
g_return_val_if_fail (requests->len > 0, FALSE);
- g_return_val_if_fail (requests->len <= E_O365_BATCH_MAX_REQUESTS, FALSE);
+ g_return_val_if_fail (requests->len <= E_M365_BATCH_MAX_REQUESTS, FALSE);
- uri = e_o365_connection_construct_uri (cnc, FALSE, NULL, api_version, "",
+ uri = e_m365_connection_construct_uri (cnc, FALSE, NULL, api_version, "",
"$batch", NULL, NULL, NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -1951,8 +1940,8 @@ e_o365_connection_batch_request_internal_sync (EO365Connection *cnc,
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
- e_o365_json_begin_array_member (builder, "requests");
+ e_m365_json_begin_object_member (builder, NULL);
+ e_m365_json_begin_array_member (builder, "requests");
for (ii = 0; success && ii < requests->len; ii++) {
SoupMessageHeadersIter iter;
@@ -1986,11 +1975,11 @@ e_o365_connection_batch_request_internal_sync (EO365Connection *cnc,
g_snprintf (buff, sizeof (buff), "%d", ii);
- e_o365_json_begin_object_member (builder, NULL);
+ e_m365_json_begin_object_member (builder, NULL);
- e_o365_json_add_string_member (builder, "id", buff);
- e_o365_json_add_string_member (builder, "method", submessage->method);
- e_o365_json_add_string_member (builder, "url", use_uri);
+ e_m365_json_add_string_member (builder, "id", buff);
+ e_m365_json_add_string_member (builder, "method", submessage->method);
+ e_m365_json_add_string_member (builder, "url", use_uri);
g_free (uri);
@@ -2007,15 +1996,15 @@ e_o365_connection_batch_request_internal_sync (EO365Connection *cnc,
if (!has_headers) {
has_headers = TRUE;
- e_o365_json_begin_object_member (builder, "headers");
+ e_m365_json_begin_object_member (builder, "headers");
}
- e_o365_json_add_string_member (builder, hdr_name, hdr_value);
+ e_m365_json_add_string_member (builder, hdr_name, hdr_value);
}
}
if (has_headers)
- e_o365_json_end_object_member (builder); /* headers */
+ e_m365_json_end_object_member (builder); /* headers */
if (submessage->request_body) {
SoupBuffer *sbuffer;
@@ -2044,7 +2033,7 @@ e_o365_connection_batch_request_internal_sync (EO365Connection *cnc,
g_clear_object (&parser);
} else {
- e_o365_json_add_string_member (builder, "body", sbuffer->data);
+ e_m365_json_add_string_member (builder, "body", sbuffer->data);
}
}
@@ -2052,19 +2041,19 @@ e_o365_connection_batch_request_internal_sync (EO365Connection *cnc,
soup_buffer_free (sbuffer);
}
- e_o365_json_end_object_member (builder); /* unnamed object */
+ e_m365_json_end_object_member (builder); /* unnamed object */
}
- e_o365_json_end_array_member (builder);
- e_o365_json_end_object_member (builder);
+ e_m365_json_end_array_member (builder);
+ e_m365_json_end_object_member (builder);
- e_o365_connection_set_json_body (message, builder);
+ e_m365_connection_set_json_body (message, builder);
soup_message_headers_append (message->request_headers, "Accept", "application/json");
g_object_unref (builder);
- success = success && o365_connection_send_request_sync (cnc, message, e_o365_read_batch_response_cb,
NULL, requests, cancellable, error);
+ success = success && m365_connection_send_request_sync (cnc, message, e_m365_read_batch_response_cb,
NULL, requests, cancellable, error);
g_clear_object (&message);
@@ -2076,8 +2065,8 @@ e_o365_connection_batch_request_internal_sync (EO365Connection *cnc,
are filled accordingly.
*/
gboolean
-e_o365_connection_batch_request_sync (EO365Connection *cnc,
- EO365ApiVersion api_version,
+e_m365_connection_batch_request_sync (EM365Connection *cnc,
+ EM365ApiVersion api_version,
GPtrArray *requests, /* SoupMessage * */
GCancellable *cancellable,
GError **error)
@@ -2086,17 +2075,17 @@ e_o365_connection_batch_request_sync (EO365Connection *cnc,
gint need_retry_seconds = 5;
gboolean success, need_retry = TRUE;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (requests != NULL, FALSE);
g_return_val_if_fail (requests->len > 0, FALSE);
- g_return_val_if_fail (requests->len <= E_O365_BATCH_MAX_REQUESTS, FALSE);
+ g_return_val_if_fail (requests->len <= E_M365_BATCH_MAX_REQUESTS, FALSE);
use_requests = requests;
while (need_retry) {
need_retry = FALSE;
- success = e_o365_connection_batch_request_internal_sync (cnc, api_version, use_requests,
cancellable, error);
+ success = e_m365_connection_batch_request_internal_sync (cnc, api_version, use_requests,
cancellable, error);
if (success) {
GPtrArray *new_requests = NULL;
@@ -2164,11 +2153,11 @@ e_o365_connection_batch_request_sync (EO365Connection *cnc,
return success;
}
-/* This can be used as a EO365ConnectionJsonFunc function, it only
+/* This can be used as a EM365ConnectionJsonFunc function, it only
copies items of 'results' into 'user_data', which is supposed
to be a pointer to a GSList *. */
gboolean
-e_o365_connection_call_gather_into_slist (EO365Connection *cnc,
+e_m365_connection_call_gather_into_slist (EM365Connection *cnc,
const GSList *results, /* JsonObject * - the returned objects from
the server */
gpointer user_data, /* expects GSList **, aka pointer to a GSList
*, where it copies the 'results' */
GCancellable *cancellable,
@@ -2191,27 +2180,27 @@ e_o365_connection_call_gather_into_slist (EO365Connection *cnc,
/*
https://docs.microsoft.com/en-us/graph/api/outlookuser-list-mastercategories?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_get_categories_sync (EO365Connection *cnc,
+e_m365_connection_get_categories_sync (EM365Connection *cnc,
const gchar *user_override,
- GSList **out_categories, /* EO365Category * */
+ GSList **out_categories, /* EM365Category * */
GCancellable *cancellable,
GError **error)
{
- EO365ResponseData rd;
+ EM365ResponseData rd;
SoupMessage *message;
gchar *uri;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (out_categories != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"outlook",
"masterCategories",
NULL,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2221,11 +2210,11 @@ e_o365_connection_get_categories_sync (EO365Connection *cnc,
g_free (uri);
- memset (&rd, 0, sizeof (EO365ResponseData));
+ memset (&rd, 0, sizeof (EM365ResponseData));
rd.out_items = out_categories;
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_valued_response_cb, NULL, &rd,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_valued_response_cb, NULL, &rd,
cancellable, error);
g_clear_object (&message);
@@ -2235,30 +2224,30 @@ e_o365_connection_get_categories_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/user-list-mailfolders?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_list_mail_folders_sync (EO365Connection *cnc,
+e_m365_connection_list_mail_folders_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *from_path, /* path for the folder to read, NULL for
top user folder */
const gchar *select, /* properties to select, nullable */
- GSList **out_folders, /* EO365MailFolder * - the returned
mailFolder objects */
+ GSList **out_folders, /* EM365MailFolder * - the returned
mailFolder objects */
GCancellable *cancellable,
GError **error)
{
- EO365ResponseData rd;
+ EM365ResponseData rd;
SoupMessage *message;
gchar *uri;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (out_folders != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"mailFolders",
NULL,
from_path,
"$select", select,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2268,11 +2257,11 @@ e_o365_connection_list_mail_folders_sync (EO365Connection *cnc,
g_free (uri);
- memset (&rd, 0, sizeof (EO365ResponseData));
+ memset (&rd, 0, sizeof (EM365ResponseData));
rd.out_items = out_folders;
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_valued_response_cb, NULL, &rd,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_valued_response_cb, NULL, &rd,
cancellable, error);
g_clear_object (&message);
@@ -2280,38 +2269,38 @@ e_o365_connection_list_mail_folders_sync (EO365Connection *cnc,
}
gboolean
-e_o365_connection_get_folders_delta_sync (EO365Connection *cnc,
+e_m365_connection_get_folders_delta_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
- EO365FolderKind kind,
+ EM365FolderKind kind,
const gchar *select, /* properties to select, nullable */
const gchar *delta_link, /* previous delta link */
guint max_page_size, /* 0 for default by the server */
- EO365ConnectionJsonFunc func, /* function to call with each result
set */
+ EM365ConnectionJsonFunc func, /* function to call with each result
set */
gpointer func_user_data, /* user data passed into the 'func' */
gchar **out_delta_link,
GCancellable *cancellable,
GError **error)
{
- EO365ResponseData rd;
+ EM365ResponseData rd;
SoupMessage *message = NULL;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (out_delta_link != NULL, FALSE);
g_return_val_if_fail (func != NULL, FALSE);
if (delta_link)
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, delta_link, CSM_DEFAULT, NULL);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, delta_link, CSM_DEFAULT, NULL);
if (!message) {
const gchar *kind_str = NULL;
gchar *uri;
switch (kind) {
- case E_O365_FOLDER_KIND_CONTACTS:
+ case E_M365_FOLDER_KIND_CONTACTS:
kind_str = "contactFolders";
break;
- case E_O365_FOLDER_KIND_MAIL:
+ case E_M365_FOLDER_KIND_MAIL:
kind_str = "mailFolders";
break;
default:
@@ -2321,14 +2310,14 @@ e_o365_connection_get_folders_delta_sync (EO365Connection *cnc,
g_return_val_if_fail (kind_str != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
kind_str,
NULL,
"delta",
"$select", select,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2349,13 +2338,13 @@ e_o365_connection_get_folders_delta_sync (EO365Connection *cnc,
g_free (prefer_value);
}
- memset (&rd, 0, sizeof (EO365ResponseData));
+ memset (&rd, 0, sizeof (EM365ResponseData));
rd.json_func = func;
rd.func_user_data = func_user_data;
rd.out_delta_link = out_delta_link;
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_valued_response_cb, NULL, &rd,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_valued_response_cb, NULL, &rd,
cancellable, error);
g_clear_object (&message);
@@ -2365,11 +2354,11 @@ e_o365_connection_get_folders_delta_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/mailfolder-get?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_get_mail_folder_sync (EO365Connection *cnc,
+e_m365_connection_get_mail_folder_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *folder_id, /* nullable - then the 'inbox' is used */
const gchar *select, /* nullable - properties to select */
- EO365MailFolder **out_folder,
+ EM365MailFolder **out_folder,
GCancellable *cancellable,
GError **error)
{
@@ -2377,17 +2366,17 @@ e_o365_connection_get_mail_folder_sync (EO365Connection *cnc,
gchar *uri;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (out_folder != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"mailFolders",
folder_id ? folder_id : "inbox",
NULL,
"$select", select,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2397,7 +2386,7 @@ e_o365_connection_get_mail_folder_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_folder, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_folder, cancellable, error);
g_clear_object (&message);
@@ -2408,11 +2397,11 @@ e_o365_connection_get_mail_folder_sync (EO365Connection *cnc,
https://docs.microsoft.com/en-us/graph/api/mailfolder-post-childfolders?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_create_mail_folder_sync (EO365Connection *cnc,
+e_m365_connection_create_mail_folder_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *parent_folder_id, /* NULL for the folder root */
const gchar *display_name,
- EO365MailFolder **out_mail_folder,
+ EM365MailFolder **out_mail_folder,
GCancellable *cancellable,
GError **error)
{
@@ -2421,17 +2410,17 @@ e_o365_connection_create_mail_folder_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (display_name != NULL, FALSE);
g_return_val_if_fail (out_mail_folder != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"mailFolders",
parent_folder_id,
parent_folder_id ? "childFolders" : NULL,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2443,15 +2432,15 @@ e_o365_connection_create_mail_folder_sync (EO365Connection *cnc,
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
- e_o365_json_add_string_member (builder, "displayName", display_name);
- e_o365_json_end_object_member (builder);
+ e_m365_json_begin_object_member (builder, NULL);
+ e_m365_json_add_string_member (builder, "displayName", display_name);
+ e_m365_json_end_object_member (builder);
- e_o365_connection_set_json_body (message, builder);
+ e_m365_connection_set_json_body (message, builder);
g_object_unref (builder);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_mail_folder, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_mail_folder, cancellable, error);
g_clear_object (&message);
@@ -2461,7 +2450,7 @@ e_o365_connection_create_mail_folder_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/mailfolder-delete?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_delete_mail_folder_sync (EO365Connection *cnc,
+e_m365_connection_delete_mail_folder_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *folder_id,
GCancellable *cancellable,
@@ -2471,13 +2460,13 @@ e_o365_connection_delete_mail_folder_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (folder_id != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"mailFolders", folder_id, NULL, NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2487,7 +2476,7 @@ e_o365_connection_delete_mail_folder_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -2498,12 +2487,12 @@ e_o365_connection_delete_mail_folder_sync (EO365Connection *cnc,
https://docs.microsoft.com/en-us/graph/api/mailfolder-move?view=graph-rest-1.0&tabs=http
*/
gboolean
-e_o365_connection_copy_move_mail_folder_sync (EO365Connection *cnc,
+e_m365_connection_copy_move_mail_folder_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *src_folder_id,
const gchar *des_folder_id,
gboolean do_copy,
- EO365MailFolder **out_mail_folder,
+ EM365MailFolder **out_mail_folder,
GCancellable *cancellable,
GError **error)
{
@@ -2512,17 +2501,17 @@ e_o365_connection_copy_move_mail_folder_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (src_folder_id != NULL, FALSE);
g_return_val_if_fail (des_folder_id != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"mailFolders",
src_folder_id,
do_copy ? "copy" : "move",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2534,15 +2523,15 @@ e_o365_connection_copy_move_mail_folder_sync (EO365Connection *cnc,
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
- e_o365_json_add_string_member (builder, "destinationId", des_folder_id);
- e_o365_json_end_object_member (builder);
+ e_m365_json_begin_object_member (builder, NULL);
+ e_m365_json_add_string_member (builder, "destinationId", des_folder_id);
+ e_m365_json_end_object_member (builder);
- e_o365_connection_set_json_body (message, builder);
+ e_m365_connection_set_json_body (message, builder);
g_object_unref (builder);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_mail_folder, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_mail_folder, cancellable, error);
g_clear_object (&message);
@@ -2552,11 +2541,11 @@ e_o365_connection_copy_move_mail_folder_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/mailfolder-update?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_rename_mail_folder_sync (EO365Connection *cnc,
+e_m365_connection_rename_mail_folder_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *folder_id,
const gchar *display_name,
- EO365MailFolder **out_mail_folder,
+ EM365MailFolder **out_mail_folder,
GCancellable *cancellable,
GError **error)
{
@@ -2565,17 +2554,17 @@ e_o365_connection_rename_mail_folder_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (folder_id != NULL, FALSE);
g_return_val_if_fail (display_name != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"mailFolders",
folder_id,
NULL,
NULL);
- message = o365_connection_new_soup_message ("PATCH", uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message ("PATCH", uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2587,15 +2576,15 @@ e_o365_connection_rename_mail_folder_sync (EO365Connection *cnc,
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
- e_o365_json_add_string_member (builder, "displayName", display_name);
- e_o365_json_end_object_member (builder);
+ e_m365_json_begin_object_member (builder, NULL);
+ e_m365_json_add_string_member (builder, "displayName", display_name);
+ e_m365_json_end_object_member (builder);
- e_o365_connection_set_json_body (message, builder);
+ e_m365_connection_set_json_body (message, builder);
g_object_unref (builder);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_mail_folder, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_mail_folder, cancellable, error);
g_clear_object (&message);
@@ -2606,41 +2595,41 @@ e_o365_connection_rename_mail_folder_sync (EO365Connection *cnc,
https://docs.microsoft.com/en-us/graph/api/contact-delta?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_get_objects_delta_sync (EO365Connection *cnc,
+e_m365_connection_get_objects_delta_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
- EO365FolderKind kind,
+ EM365FolderKind kind,
const gchar *folder_id, /* folder ID to get delta messages in */
const gchar *select, /* properties to select, nullable */
const gchar *delta_link, /* previous delta link */
guint max_page_size, /* 0 for default by the server */
- EO365ConnectionJsonFunc func, /* function to call with each result
set */
+ EM365ConnectionJsonFunc func, /* function to call with each result
set */
gpointer func_user_data, /* user data passed into the 'func' */
gchar **out_delta_link,
GCancellable *cancellable,
GError **error)
{
- EO365ResponseData rd;
+ EM365ResponseData rd;
SoupMessage *message = NULL;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (folder_id != NULL, FALSE);
g_return_val_if_fail (out_delta_link != NULL, FALSE);
g_return_val_if_fail (func != NULL, FALSE);
if (delta_link)
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, delta_link, CSM_DEFAULT, NULL);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, delta_link, CSM_DEFAULT, NULL);
if (!message) {
const gchar *kind_str = NULL, *kind_path_str = NULL;
gchar *uri;
switch (kind) {
- case E_O365_FOLDER_KIND_CONTACTS:
+ case E_M365_FOLDER_KIND_CONTACTS:
kind_str = "contactFolders";
kind_path_str = "contacts";
break;
- case E_O365_FOLDER_KIND_MAIL:
+ case E_M365_FOLDER_KIND_MAIL:
kind_str = "mailFolders";
kind_path_str = "messages";
break;
@@ -2651,7 +2640,7 @@ e_o365_connection_get_objects_delta_sync (EO365Connection *cnc,
g_return_val_if_fail (kind_str != NULL && kind_path_str != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
kind_str,
folder_id,
kind_path_str,
@@ -2659,7 +2648,7 @@ e_o365_connection_get_objects_delta_sync (EO365Connection *cnc,
"$select", select,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2680,13 +2669,13 @@ e_o365_connection_get_objects_delta_sync (EO365Connection *cnc,
g_free (prefer_value);
}
- memset (&rd, 0, sizeof (EO365ResponseData));
+ memset (&rd, 0, sizeof (EM365ResponseData));
rd.json_func = func;
rd.func_user_data = func_user_data;
rd.out_delta_link = out_delta_link;
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_valued_response_cb, NULL, &rd,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_valued_response_cb, NULL, &rd,
cancellable, error);
g_clear_object (&message);
@@ -2696,11 +2685,11 @@ e_o365_connection_get_objects_delta_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/message-get?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_get_mail_message_sync (EO365Connection *cnc,
+e_m365_connection_get_mail_message_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *folder_id,
const gchar *message_id,
- EO365ConnectionRawDataFunc func,
+ EM365ConnectionRawDataFunc func,
gpointer func_user_data,
GCancellable *cancellable,
GError **error)
@@ -2709,18 +2698,18 @@ e_o365_connection_get_mail_message_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (folder_id != NULL, FALSE);
g_return_val_if_fail (message_id != NULL, FALSE);
g_return_val_if_fail (func != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"messages",
message_id,
"$value",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2730,7 +2719,7 @@ e_o365_connection_get_mail_message_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, NULL, func, func_user_data, cancellable,
error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, func, func_user_data, cancellable,
error);
g_clear_object (&message);
@@ -2740,11 +2729,11 @@ e_o365_connection_get_mail_message_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/user-post-messages?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_create_mail_message_sync (EO365Connection *cnc,
+e_m365_connection_create_mail_message_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *folder_id, /* if NULL, then goes to the Drafts
folder */
JsonBuilder *mail_message, /* filled mailMessage object */
- EO365MailMessage **out_created_message, /* free with
json_object_unref() */
+ EM365MailMessage **out_created_message, /* free with
json_object_unref() */
GCancellable *cancellable,
GError **error)
{
@@ -2752,17 +2741,17 @@ e_o365_connection_create_mail_message_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (mail_message != NULL, FALSE);
g_return_val_if_fail (out_created_message != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
folder_id ? "mailFolders" : "messages",
folder_id,
folder_id ? "messages" : NULL,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2772,9 +2761,9 @@ e_o365_connection_create_mail_message_sync (EO365Connection *cnc,
g_free (uri);
- e_o365_connection_set_json_body (message, mail_message);
+ e_m365_connection_set_json_body (message, mail_message);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_created_message, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_created_message, cancellable, error);
g_clear_object (&message);
@@ -2784,7 +2773,7 @@ e_o365_connection_create_mail_message_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/message-post-attachments?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_add_mail_message_attachment_sync (EO365Connection *cnc,
+e_m365_connection_add_mail_message_attachment_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to
use the account user */
const gchar *message_id, /* the message to add it to */
JsonBuilder *attachment, /* filled attachment object */
@@ -2797,16 +2786,16 @@ e_o365_connection_add_mail_message_attachment_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (attachment != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"messages",
message_id,
"attachments",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2816,12 +2805,12 @@ e_o365_connection_add_mail_message_attachment_sync (EO365Connection *cnc,
g_free (uri);
- e_o365_connection_set_json_body (message, attachment);
+ e_m365_connection_set_json_body (message, attachment);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
&added_attachment, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
&added_attachment, cancellable, error);
if (success && added_attachment && out_attachment_id)
- *out_attachment_id = g_strdup (e_o365_attachment_get_id (added_attachment));
+ *out_attachment_id = g_strdup (e_m365_attachment_get_id (added_attachment));
if (added_attachment)
json_object_unref (added_attachment);
@@ -2834,7 +2823,7 @@ e_o365_connection_add_mail_message_attachment_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/message-update?view=graph-rest-1.0&tabs=http */
SoupMessage *
-e_o365_connection_prepare_update_mail_message (EO365Connection *cnc,
+e_m365_connection_prepare_update_mail_message (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *message_id,
JsonBuilder *mail_message, /* values to update, as a
mailMessage object */
@@ -2843,18 +2832,18 @@ e_o365_connection_prepare_update_mail_message (EO365Connection *cnc,
SoupMessage *message;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), NULL);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), NULL);
g_return_val_if_fail (message_id != NULL, NULL);
g_return_val_if_fail (mail_message != NULL, NULL);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"messages",
message_id,
NULL,
NULL);
/* The server returns the mailMessage object back, but it can be ignored here */
- message = o365_connection_new_soup_message ("PATCH", uri, CSM_DISABLE_RESPONSE, error);
+ message = m365_connection_new_soup_message ("PATCH", uri, CSM_DISABLE_RESPONSE, error);
if (!message) {
g_free (uri);
@@ -2864,13 +2853,13 @@ e_o365_connection_prepare_update_mail_message (EO365Connection *cnc,
g_free (uri);
- e_o365_connection_set_json_body (message, mail_message);
+ e_m365_connection_set_json_body (message, mail_message);
return message;
}
gboolean
-e_o365_connection_update_mail_message_sync (EO365Connection *cnc,
+e_m365_connection_update_mail_message_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *message_id,
JsonBuilder *mail_message, /* values to update, as a mailMessage
object */
@@ -2880,16 +2869,16 @@ e_o365_connection_update_mail_message_sync (EO365Connection *cnc,
SoupMessage *message;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (message_id != NULL, FALSE);
g_return_val_if_fail (mail_message != NULL, FALSE);
- message = e_o365_connection_prepare_update_mail_message (cnc, user_override, message_id,
mail_message, error);
+ message = e_m365_connection_prepare_update_mail_message (cnc, user_override, message_id,
mail_message, error);
if (!message)
return FALSE;
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -2900,7 +2889,7 @@ e_o365_connection_update_mail_message_sync (EO365Connection *cnc,
https://docs.microsoft.com/en-us/graph/api/message-move?view=graph-rest-1.0&tabs=http
*/
static SoupMessage *
-e_o365_connection_prepare_copy_move_mail_message (EO365Connection *cnc,
+e_m365_connection_prepare_copy_move_mail_message (EM365Connection *cnc,
const gchar *user_override,
const gchar *message_id,
const gchar *des_folder_id,
@@ -2911,16 +2900,16 @@ e_o365_connection_prepare_copy_move_mail_message (EO365Connection *cnc,
JsonBuilder *builder;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), NULL);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), NULL);
g_return_val_if_fail (message_id != NULL, NULL);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"messages",
message_id,
do_copy ? "copy" : "move",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -2932,11 +2921,11 @@ e_o365_connection_prepare_copy_move_mail_message (EO365Connection *cnc,
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
- e_o365_json_add_string_member (builder, "destinationId", des_folder_id);
- e_o365_json_end_object_member (builder);
+ e_m365_json_begin_object_member (builder, NULL);
+ e_m365_json_add_string_member (builder, "destinationId", des_folder_id);
+ e_m365_json_end_object_member (builder);
- e_o365_connection_set_json_body (message, builder);
+ e_m365_connection_set_json_body (message, builder);
g_object_unref (builder);
@@ -2945,7 +2934,7 @@ e_o365_connection_prepare_copy_move_mail_message (EO365Connection *cnc,
/* out_des_message_ids: Camel-pooled gchar *, new ids, in the same order as in message_ids; can be partial */
gboolean
-e_o365_connection_copy_move_mail_messages_sync (EO365Connection *cnc,
+e_m365_connection_copy_move_mail_messages_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const GSList *message_ids, /* const gchar * */
const gchar *des_folder_id,
@@ -2956,7 +2945,7 @@ e_o365_connection_copy_move_mail_messages_sync (EO365Connection *cnc,
{
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (message_ids != NULL, FALSE);
g_return_val_if_fail (des_folder_id != NULL, FALSE);
g_return_val_if_fail (out_des_message_ids != NULL, FALSE);
@@ -2969,13 +2958,13 @@ e_o365_connection_copy_move_mail_messages_sync (EO365Connection *cnc,
guint total, done = 0;
total = g_slist_length ((GSList *) message_ids);
- requests = g_ptr_array_new_full (MIN (E_O365_BATCH_MAX_REQUESTS, MIN (total, 50)),
g_object_unref);
+ requests = g_ptr_array_new_full (MIN (E_M365_BATCH_MAX_REQUESTS, MIN (total, 50)),
g_object_unref);
for (link = (GSList *) message_ids; link && success; link = g_slist_next (link)) {
const gchar *id = link->data;
SoupMessage *message;
- message = e_o365_connection_prepare_copy_move_mail_message (cnc, user_override, id,
des_folder_id, do_copy, error);
+ message = e_m365_connection_prepare_copy_move_mail_message (cnc, user_override, id,
des_folder_id, do_copy, error);
if (!message) {
success = FALSE;
@@ -2984,21 +2973,21 @@ e_o365_connection_copy_move_mail_messages_sync (EO365Connection *cnc,
g_ptr_array_add (requests, message);
- if (requests->len == E_O365_BATCH_MAX_REQUESTS || !link->next) {
+ if (requests->len == E_M365_BATCH_MAX_REQUESTS || !link->next) {
if (requests->len == 1) {
JsonObject *response = NULL;
- success = o365_connection_send_request_sync (cnc, message,
e_o365_read_json_object_response_cb, NULL, &response, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message,
e_m365_read_json_object_response_cb, NULL, &response, cancellable, error);
if (response) {
*out_des_message_ids = g_slist_prepend (*out_des_message_ids,
- (gpointer) camel_pstring_strdup
(e_o365_mail_message_get_id (response)));
+ (gpointer) camel_pstring_strdup
(e_m365_mail_message_get_id (response)));
json_object_unref (response);
} else {
success = FALSE;
}
} else {
- success = e_o365_connection_batch_request_sync (cnc, E_O365_API_V1_0,
requests, cancellable, error);
+ success = e_m365_connection_batch_request_sync (cnc, E_M365_API_V1_0,
requests, cancellable, error);
if (success) {
guint ii;
@@ -3008,7 +2997,7 @@ e_o365_connection_copy_move_mail_messages_sync (EO365Connection *cnc,
message = g_ptr_array_index (requests, ii);
- success = e_o365_connection_json_node_from_message
(message, NULL, &node, cancellable, error);
+ success = e_m365_connection_json_node_from_message
(message, NULL, &node, cancellable, error);
if (success && node && JSON_NODE_HOLDS_OBJECT (node))
{
JsonObject *response;
@@ -3017,7 +3006,7 @@ e_o365_connection_copy_move_mail_messages_sync (EO365Connection *cnc,
if (response) {
*out_des_message_ids =
g_slist_prepend (*out_des_message_ids,
- (gpointer)
camel_pstring_strdup (e_o365_mail_message_get_id (response)));
+ (gpointer)
camel_pstring_strdup (e_m365_mail_message_get_id (response)));
} else {
success = FALSE;
}
@@ -3043,16 +3032,16 @@ e_o365_connection_copy_move_mail_messages_sync (EO365Connection *cnc,
} else {
SoupMessage *message;
- message = e_o365_connection_prepare_copy_move_mail_message (cnc, user_override,
message_ids->data, des_folder_id, do_copy, error);
+ message = e_m365_connection_prepare_copy_move_mail_message (cnc, user_override,
message_ids->data, des_folder_id, do_copy, error);
if (message) {
JsonObject *response = NULL;
- success = o365_connection_send_request_sync (cnc, message,
e_o365_read_json_object_response_cb, NULL, &response, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message,
e_m365_read_json_object_response_cb, NULL, &response, cancellable, error);
if (response) {
*out_des_message_ids = g_slist_prepend (*out_des_message_ids,
- (gpointer) camel_pstring_strdup (e_o365_mail_message_get_id
(response)));
+ (gpointer) camel_pstring_strdup (e_m365_mail_message_get_id
(response)));
json_object_unref (response);
} else {
success = FALSE;
@@ -3072,7 +3061,7 @@ e_o365_connection_copy_move_mail_messages_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/message-delete?view=graph-rest-1.0&tabs=http */
static SoupMessage *
-e_o365_connection_prepare_delete_mail_message (EO365Connection *cnc,
+e_m365_connection_prepare_delete_mail_message (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *message_id,
GError **error)
@@ -3080,16 +3069,16 @@ e_o365_connection_prepare_delete_mail_message (EO365Connection *cnc,
SoupMessage *message;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), NULL);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), NULL);
g_return_val_if_fail (message_id != NULL, NULL);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"messages",
message_id,
NULL,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3103,7 +3092,7 @@ e_o365_connection_prepare_delete_mail_message (EO365Connection *cnc,
}
gboolean
-e_o365_connection_delete_mail_messages_sync (EO365Connection *cnc,
+e_m365_connection_delete_mail_messages_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const GSList *message_ids, /* const gchar * */
GSList **out_deleted_ids, /* (transfer container): const gchar
*, borrowed from message_ids */
@@ -3112,7 +3101,7 @@ e_o365_connection_delete_mail_messages_sync (EO365Connection *cnc,
{
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (message_ids != NULL, FALSE);
if (g_slist_next (message_ids)) {
@@ -3121,13 +3110,13 @@ e_o365_connection_delete_mail_messages_sync (EO365Connection *cnc,
guint total, done = 0;
total = g_slist_length ((GSList *) message_ids);
- requests = g_ptr_array_new_full (MIN (E_O365_BATCH_MAX_REQUESTS, MIN (total, 50)),
g_object_unref);
+ requests = g_ptr_array_new_full (MIN (E_M365_BATCH_MAX_REQUESTS, MIN (total, 50)),
g_object_unref);
for (link = (GSList *) message_ids; link && success; link = g_slist_next (link)) {
const gchar *id = link->data;
SoupMessage *message;
- message = e_o365_connection_prepare_delete_mail_message (cnc, user_override, id,
error);
+ message = e_m365_connection_prepare_delete_mail_message (cnc, user_override, id,
error);
if (!message) {
success = FALSE;
@@ -3136,11 +3125,11 @@ e_o365_connection_delete_mail_messages_sync (EO365Connection *cnc,
g_ptr_array_add (requests, message);
- if (requests->len == E_O365_BATCH_MAX_REQUESTS || !link->next) {
+ if (requests->len == E_M365_BATCH_MAX_REQUESTS || !link->next) {
if (requests->len == 1) {
- success = o365_connection_send_request_sync (cnc, message, NULL,
e_o365_read_no_response_cb, NULL, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL,
e_m365_read_no_response_cb, NULL, cancellable, error);
} else {
- success = e_o365_connection_batch_request_sync (cnc, E_O365_API_V1_0,
requests, cancellable, error);
+ success = e_m365_connection_batch_request_sync (cnc, E_M365_API_V1_0,
requests, cancellable, error);
}
if (success && out_deleted_ids) {
@@ -3167,10 +3156,10 @@ e_o365_connection_delete_mail_messages_sync (EO365Connection *cnc,
} else {
SoupMessage *message;
- message = e_o365_connection_prepare_delete_mail_message (cnc, user_override,
message_ids->data, error);
+ message = e_m365_connection_prepare_delete_mail_message (cnc, user_override,
message_ids->data, error);
if (message) {
- success = o365_connection_send_request_sync (cnc, message, NULL,
e_o365_read_no_response_cb, NULL, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL,
e_m365_read_no_response_cb, NULL, cancellable, error);
if (success && out_deleted_ids)
*out_deleted_ids = g_slist_prepend (*out_deleted_ids, message_ids->data);
@@ -3190,7 +3179,7 @@ e_o365_connection_delete_mail_messages_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/message-send?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_send_mail_message_sync (EO365Connection *cnc,
+e_m365_connection_send_mail_message_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *message_id,
GCancellable *cancellable,
@@ -3200,16 +3189,16 @@ e_o365_connection_send_mail_message_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (message_id != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"messages",
message_id,
"send",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3221,7 +3210,7 @@ e_o365_connection_send_mail_message_sync (EO365Connection *cnc,
soup_message_headers_append (message->request_headers, "Content-Length", "0");
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -3231,7 +3220,7 @@ e_o365_connection_send_mail_message_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_send_mail_sync (EO365Connection *cnc,
+e_m365_connection_send_mail_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account user
*/
JsonBuilder *request, /* filled sendMail object */
GCancellable *cancellable,
@@ -3241,13 +3230,13 @@ e_o365_connection_send_mail_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (request != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"sendMail", NULL, NULL, NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3257,9 +3246,9 @@ e_o365_connection_send_mail_sync (EO365Connection *cnc,
g_free (uri);
- e_o365_connection_set_json_body (message, request);
+ e_m365_connection_set_json_body (message, request);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -3269,11 +3258,11 @@ e_o365_connection_send_mail_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/contactfolder-get?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_get_contacts_folder_sync (EO365Connection *cnc,
+e_m365_connection_get_contacts_folder_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *folder_id, /* nullable - then the default 'contacts'
folder is returned */
const gchar *select, /* nullable - properties to select */
- EO365Folder **out_folder,
+ EM365Folder **out_folder,
GCancellable *cancellable,
GError **error)
{
@@ -3281,16 +3270,16 @@ e_o365_connection_get_contacts_folder_sync (EO365Connection *cnc,
gchar *uri;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (out_folder != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"contactFolders",
folder_id ? folder_id : "contacts",
NULL,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3300,7 +3289,7 @@ e_o365_connection_get_contacts_folder_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_folder, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_folder, cancellable, error);
g_clear_object (&message);
@@ -3310,7 +3299,7 @@ e_o365_connection_get_contacts_folder_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0 */
gboolean
-e_o365_connection_get_contact_photo_sync (EO365Connection *cnc,
+e_m365_connection_get_contact_photo_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *folder_id,
const gchar *contact_id,
@@ -3322,12 +3311,12 @@ e_o365_connection_get_contact_photo_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (folder_id != NULL, FALSE);
g_return_val_if_fail (contact_id != NULL, FALSE);
g_return_val_if_fail (out_photo != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"contactFolders",
folder_id,
"contacts",
@@ -3336,7 +3325,7 @@ e_o365_connection_get_contact_photo_sync (EO365Connection *cnc,
"", "$value",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3346,7 +3335,7 @@ e_o365_connection_get_contact_photo_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_to_byte_array_cb,
out_photo, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_to_byte_array_cb,
out_photo, cancellable, error);
g_clear_object (&message);
@@ -3356,7 +3345,7 @@ e_o365_connection_get_contact_photo_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/profilephoto-update?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_update_contact_photo_sync (EO365Connection *cnc,
+e_m365_connection_update_contact_photo_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *folder_id,
const gchar *contact_id,
@@ -3368,9 +3357,9 @@ e_o365_connection_update_contact_photo_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"contactFolders",
folder_id,
"contacts",
@@ -3379,7 +3368,7 @@ e_o365_connection_update_contact_photo_sync (EO365Connection *cnc,
"", "$value",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_PUT, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_PUT, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3395,7 +3384,7 @@ e_o365_connection_update_contact_photo_sync (EO365Connection *cnc,
if (jpeg_photo)
soup_message_body_append (message->request_body, SOUP_MEMORY_STATIC, jpeg_photo->data,
jpeg_photo->len);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -3405,11 +3394,11 @@ e_o365_connection_update_contact_photo_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/contact-get?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_get_contact_sync (EO365Connection *cnc,
+e_m365_connection_get_contact_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *folder_id,
const gchar *contact_id,
- EO365Contact **out_contact,
+ EM365Contact **out_contact,
GCancellable *cancellable,
GError **error)
{
@@ -3417,19 +3406,19 @@ e_o365_connection_get_contact_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (folder_id != NULL, FALSE);
g_return_val_if_fail (contact_id != NULL, FALSE);
g_return_val_if_fail (out_contact != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"contactFolders",
folder_id,
"contacts",
"", contact_id,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3439,7 +3428,7 @@ e_o365_connection_get_contact_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_contact, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_contact, cancellable, error);
g_clear_object (&message);
@@ -3449,11 +3438,11 @@ e_o365_connection_get_contact_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/user-post-contacts?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_create_contact_sync (EO365Connection *cnc,
+e_m365_connection_create_contact_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *folder_id, /* if NULL, then goes to the Drafts folder */
JsonBuilder *contact, /* filled contact object */
- EO365Contact **out_created_contact, /* free with json_object_unref() */
+ EM365Contact **out_created_contact, /* free with json_object_unref() */
GCancellable *cancellable,
GError **error)
{
@@ -3461,17 +3450,17 @@ e_o365_connection_create_contact_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (contact != NULL, FALSE);
g_return_val_if_fail (out_created_contact != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
folder_id ? "contactFolders" : "contacts",
folder_id,
folder_id ? "contacts" : NULL,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3481,9 +3470,9 @@ e_o365_connection_create_contact_sync (EO365Connection *cnc,
g_free (uri);
- e_o365_connection_set_json_body (message, contact);
+ e_m365_connection_set_json_body (message, contact);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_created_contact, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_created_contact, cancellable, error);
g_clear_object (&message);
@@ -3493,7 +3482,7 @@ e_o365_connection_create_contact_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/contact-update?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_update_contact_sync (EO365Connection *cnc,
+e_m365_connection_update_contact_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *folder_id,
const gchar *contact_id,
@@ -3505,11 +3494,11 @@ e_o365_connection_update_contact_sync (EO365Connection *cnc,
gchar *uri;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (contact_id != NULL, FALSE);
g_return_val_if_fail (contact != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
folder_id ? "contactFolders" : "contacts",
folder_id,
folder_id ? "contacts" : contact_id,
@@ -3517,7 +3506,7 @@ e_o365_connection_update_contact_sync (EO365Connection *cnc,
NULL);
/* The server returns the contact object back, but it can be ignored here */
- message = o365_connection_new_soup_message ("PATCH", uri, CSM_DISABLE_RESPONSE, error);
+ message = m365_connection_new_soup_message ("PATCH", uri, CSM_DISABLE_RESPONSE, error);
if (!message) {
g_free (uri);
@@ -3527,9 +3516,9 @@ e_o365_connection_update_contact_sync (EO365Connection *cnc,
g_free (uri);
- e_o365_connection_set_json_body (message, contact);
+ e_m365_connection_set_json_body (message, contact);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -3539,7 +3528,7 @@ e_o365_connection_update_contact_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/contact-delete?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_delete_contact_sync (EO365Connection *cnc,
+e_m365_connection_delete_contact_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *folder_id,
const gchar *contact_id,
@@ -3550,17 +3539,17 @@ e_o365_connection_delete_contact_sync (EO365Connection *cnc,
gchar *uri;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (contact_id != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
folder_id ? "contactFolders" : "contacts",
folder_id,
folder_id ? "contacts" : contact_id,
"", folder_id ? contact_id : NULL,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3570,7 +3559,7 @@ e_o365_connection_delete_contact_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -3580,24 +3569,24 @@ e_o365_connection_delete_contact_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/user-list-calendargroups?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_list_calendar_groups_sync (EO365Connection *cnc,
+e_m365_connection_list_calendar_groups_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
- GSList **out_groups, /* EO365CalendarGroup * - the returned
calendarGroup objects */
+ GSList **out_groups, /* EM365CalendarGroup * - the returned
calendarGroup objects */
GCancellable *cancellable,
GError **error)
{
- EO365ResponseData rd;
+ EM365ResponseData rd;
SoupMessage *message;
gchar *uri;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (out_groups != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendarGroups", NULL, NULL, NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3607,11 +3596,11 @@ e_o365_connection_list_calendar_groups_sync (EO365Connection *cnc,
g_free (uri);
- memset (&rd, 0, sizeof (EO365ResponseData));
+ memset (&rd, 0, sizeof (EM365ResponseData));
rd.out_items = out_groups;
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_valued_response_cb, NULL, &rd,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_valued_response_cb, NULL, &rd,
cancellable, error);
g_clear_object (&message);
@@ -3621,10 +3610,10 @@ e_o365_connection_list_calendar_groups_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/user-post-calendargroups?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_create_calendar_group_sync (EO365Connection *cnc,
+e_m365_connection_create_calendar_group_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *name,
- EO365CalendarGroup **out_created_group,
+ EM365CalendarGroup **out_created_group,
GCancellable *cancellable,
GError **error)
{
@@ -3633,14 +3622,14 @@ e_o365_connection_create_calendar_group_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
g_return_val_if_fail (out_created_group != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendarGroups", NULL, NULL, NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3652,15 +3641,15 @@ e_o365_connection_create_calendar_group_sync (EO365Connection *cnc,
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
- e_o365_json_add_string_member (builder, "name", name);
- e_o365_json_end_object_member (builder);
+ e_m365_json_begin_object_member (builder, NULL);
+ e_m365_json_add_string_member (builder, "name", name);
+ e_m365_json_end_object_member (builder);
- e_o365_connection_set_json_body (message, builder);
+ e_m365_connection_set_json_body (message, builder);
g_object_unref (builder);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_created_group, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_created_group, cancellable, error);
g_clear_object (&message);
@@ -3670,10 +3659,10 @@ e_o365_connection_create_calendar_group_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/calendargroup-get?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_get_calendar_group_sync (EO365Connection *cnc,
+e_m365_connection_get_calendar_group_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *group_id,
- EO365CalendarGroup **out_group,
+ EM365CalendarGroup **out_group,
GCancellable *cancellable,
GError **error)
{
@@ -3681,17 +3670,17 @@ e_o365_connection_get_calendar_group_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (group_id != NULL, FALSE);
g_return_val_if_fail (out_group != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendarGroups",
group_id,
NULL,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3701,7 +3690,7 @@ e_o365_connection_get_calendar_group_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_group, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_group, cancellable, error);
g_clear_object (&message);
@@ -3711,7 +3700,7 @@ e_o365_connection_get_calendar_group_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/calendargroup-update?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_update_calendar_group_sync (EO365Connection *cnc,
+e_m365_connection_update_calendar_group_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *group_id,
const gchar *name,
@@ -3723,17 +3712,17 @@ e_o365_connection_update_calendar_group_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (group_id != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendarGroups",
group_id,
NULL,
NULL);
- message = o365_connection_new_soup_message ("PATCH", uri, CSM_DISABLE_RESPONSE, error);
+ message = m365_connection_new_soup_message ("PATCH", uri, CSM_DISABLE_RESPONSE, error);
if (!message) {
g_free (uri);
@@ -3745,15 +3734,15 @@ e_o365_connection_update_calendar_group_sync (EO365Connection *cnc,
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
- e_o365_json_add_string_member (builder, "name", name);
- e_o365_json_end_object_member (builder);
+ e_m365_json_begin_object_member (builder, NULL);
+ e_m365_json_add_string_member (builder, "name", name);
+ e_m365_json_end_object_member (builder);
- e_o365_connection_set_json_body (message, builder);
+ e_m365_connection_set_json_body (message, builder);
g_object_unref (builder);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -3763,7 +3752,7 @@ e_o365_connection_update_calendar_group_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/calendargroup-delete?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_delete_calendar_group_sync (EO365Connection *cnc,
+e_m365_connection_delete_calendar_group_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *group_id,
GCancellable *cancellable,
@@ -3773,13 +3762,13 @@ e_o365_connection_delete_calendar_group_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (group_id != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendarGroups", group_id, NULL, NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3789,7 +3778,7 @@ e_o365_connection_delete_calendar_group_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -3799,30 +3788,30 @@ e_o365_connection_delete_calendar_group_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/resources/calendar?view=graph-rest-1.0 */
gboolean
-e_o365_connection_list_calendars_sync (EO365Connection *cnc,
+e_m365_connection_list_calendars_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *group_id, /* nullable, calendar group id for group
calendars */
const gchar *select, /* properties to select, nullable */
- GSList **out_calendars, /* EO365Calendar * - the returned calendar
objects */
+ GSList **out_calendars, /* EM365Calendar * - the returned calendar
objects */
GCancellable *cancellable,
GError **error)
{
- EO365ResponseData rd;
+ EM365ResponseData rd;
SoupMessage *message;
gchar *uri;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (out_calendars != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
"$select", select,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3832,11 +3821,11 @@ e_o365_connection_list_calendars_sync (EO365Connection *cnc,
g_free (uri);
- memset (&rd, 0, sizeof (EO365ResponseData));
+ memset (&rd, 0, sizeof (EM365ResponseData));
rd.out_items = out_calendars;
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_valued_response_cb, NULL, &rd,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_valued_response_cb, NULL, &rd,
cancellable, error);
g_clear_object (&message);
@@ -3846,11 +3835,11 @@ e_o365_connection_list_calendars_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/calendargroup-post-calendars?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_create_calendar_sync (EO365Connection *cnc,
+e_m365_connection_create_calendar_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *group_id, /* nullable, then the default group is used */
JsonBuilder *calendar,
- EO365Calendar **out_created_calendar,
+ EM365Calendar **out_created_calendar,
GCancellable *cancellable,
GError **error)
{
@@ -3858,17 +3847,17 @@ e_o365_connection_create_calendar_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar != NULL, FALSE);
g_return_val_if_fail (out_created_calendar != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendarGroup",
group_id,
"calendars",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3878,9 +3867,9 @@ e_o365_connection_create_calendar_sync (EO365Connection *cnc,
g_free (uri);
- e_o365_connection_set_json_body (message, calendar);
+ e_m365_connection_set_json_body (message, calendar);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_created_calendar, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_created_calendar, cancellable, error);
g_clear_object (&message);
@@ -3890,12 +3879,12 @@ e_o365_connection_create_calendar_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/calendar-get?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_get_calendar_folder_sync (EO365Connection *cnc,
+e_m365_connection_get_calendar_folder_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *group_id, /* nullable - then the default group is
used */
const gchar *calendar_id, /* nullable - then the default calendar
is used */
const gchar *select, /* nullable - properties to select */
- EO365Calendar **out_calendar,
+ EM365Calendar **out_calendar,
GCancellable *cancellable,
GError **error)
{
@@ -3903,11 +3892,11 @@ e_o365_connection_get_calendar_folder_sync (EO365Connection *cnc,
gchar *uri;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (out_calendar != NULL, FALSE);
if (group_id && calendar_id) {
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendarGroups",
group_id,
"calendars",
@@ -3915,21 +3904,21 @@ e_o365_connection_get_calendar_folder_sync (EO365Connection *cnc,
"$select", select,
NULL);
} else if (group_id) {
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, "groups",
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, "groups",
group_id,
"calendar",
NULL,
"$select", select,
NULL);
} else if (calendar_id) {
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendars",
calendar_id,
NULL,
"$select", select,
NULL);
} else {
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendar",
NULL,
NULL,
@@ -3937,7 +3926,7 @@ e_o365_connection_get_calendar_folder_sync (EO365Connection *cnc,
NULL);
}
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -3947,7 +3936,7 @@ e_o365_connection_get_calendar_folder_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_calendar, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_calendar, cancellable, error);
g_clear_object (&message);
@@ -3957,12 +3946,12 @@ e_o365_connection_get_calendar_folder_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/calendar-update?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_update_calendar_sync (EO365Connection *cnc,
+e_m365_connection_update_calendar_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *group_id, /* nullable - then the default group is used */
const gchar *calendar_id,
const gchar *name, /* nullable - to keep the existing name */
- EO365CalendarColorType color,
+ EM365CalendarColorType color,
GCancellable *cancellable,
GError **error)
{
@@ -3971,29 +3960,29 @@ e_o365_connection_update_calendar_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
/* Nothing to change */
- if (!name && (color == E_O365_CALENDAR_COLOR_NOT_SET || color == E_O365_CALENDAR_COLOR_UNKNOWN))
+ if (!name && (color == E_M365_CALENDAR_COLOR_NOT_SET || color == E_M365_CALENDAR_COLOR_UNKNOWN))
return TRUE;
if (group_id) {
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendarGroups",
group_id,
"calendars",
"", calendar_id,
NULL);
} else {
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendars",
calendar_id,
NULL,
NULL);
}
- message = o365_connection_new_soup_message ("PATCH", uri, CSM_DISABLE_RESPONSE, error);
+ message = m365_connection_new_soup_message ("PATCH", uri, CSM_DISABLE_RESPONSE, error);
if (!message) {
g_free (uri);
@@ -4005,16 +3994,16 @@ e_o365_connection_update_calendar_sync (EO365Connection *cnc,
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
- e_o365_calendar_add_name (builder, name);
- e_o365_calendar_add_color (builder, color);
- e_o365_json_end_object_member (builder);
+ e_m365_json_begin_object_member (builder, NULL);
+ e_m365_calendar_add_name (builder, name);
+ e_m365_calendar_add_color (builder, color);
+ e_m365_json_end_object_member (builder);
- e_o365_connection_set_json_body (message, builder);
+ e_m365_connection_set_json_body (message, builder);
g_object_unref (builder);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -4024,7 +4013,7 @@ e_o365_connection_update_calendar_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/calendar-delete?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_delete_calendar_sync (EO365Connection *cnc,
+e_m365_connection_delete_calendar_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *group_id, /* nullable - then the default group is used */
const gchar *calendar_id,
@@ -4035,25 +4024,25 @@ e_o365_connection_delete_calendar_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
if (group_id) {
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendarGroups",
group_id,
"calendars",
"", calendar_id,
NULL);
} else {
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
"calendars",
calendar_id,
NULL,
NULL);
}
- message = o365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -4063,7 +4052,7 @@ e_o365_connection_delete_calendar_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -4073,26 +4062,26 @@ e_o365_connection_delete_calendar_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/user-list-events?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_list_events_sync (EO365Connection *cnc,
+e_m365_connection_list_events_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *group_id, /* nullable, calendar group id for group calendars
*/
const gchar *calendar_id,
const gchar *prefer_outlook_timezone, /* nullable - then UTC, otherwise
that zone for the returned times */
const gchar *select, /* nullable - properties to select */
- GSList **out_events, /* EO365Event * - the returned event objects */
+ GSList **out_events, /* EM365Event * - the returned event objects */
GCancellable *cancellable,
GError **error)
{
- EO365ResponseData rd;
+ EM365ResponseData rd;
SoupMessage *message;
gchar *uri;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (out_events != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
@@ -4101,7 +4090,7 @@ e_o365_connection_list_events_sync (EO365Connection *cnc,
"$select", select,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -4123,11 +4112,11 @@ e_o365_connection_list_events_sync (EO365Connection *cnc,
soup_message_headers_append (message->request_headers, "Prefer",
"outlook.body-content-type=\"text\"");
- memset (&rd, 0, sizeof (EO365ResponseData));
+ memset (&rd, 0, sizeof (EM365ResponseData));
rd.out_items = out_events;
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_valued_response_cb, NULL, &rd,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_valued_response_cb, NULL, &rd,
cancellable, error);
g_clear_object (&message);
@@ -4138,12 +4127,12 @@ e_o365_connection_list_events_sync (EO365Connection *cnc,
https://docs.microsoft.com/en-us/graph/api/group-post-events?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_create_event_sync (EO365Connection *cnc,
+e_m365_connection_create_event_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *group_id, /* nullable, then the default group is used */
const gchar *calendar_id,
JsonBuilder *event,
- EO365Calendar **out_created_event,
+ EM365Calendar **out_created_event,
GCancellable *cancellable,
GError **error)
{
@@ -4151,12 +4140,12 @@ e_o365_connection_create_event_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (out_created_event != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
@@ -4164,7 +4153,7 @@ e_o365_connection_create_event_sync (EO365Connection *cnc,
"", "events",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -4174,9 +4163,9 @@ e_o365_connection_create_event_sync (EO365Connection *cnc,
g_free (uri);
- e_o365_connection_set_json_body (message, event);
+ e_m365_connection_set_json_body (message, event);
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_created_event, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_created_event, cancellable, error);
g_clear_object (&message);
@@ -4186,7 +4175,7 @@ e_o365_connection_create_event_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/event-get?view=graph-rest-1.0&tabs=http */
SoupMessage *
-e_o365_connection_prepare_get_event (EO365Connection *cnc,
+e_m365_connection_prepare_get_event (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *group_id, /* nullable, then the default group is used */
const gchar *calendar_id,
@@ -4198,11 +4187,11 @@ e_o365_connection_prepare_get_event (EO365Connection *cnc,
SoupMessage *message;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), NULL);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), NULL);
g_return_val_if_fail (calendar_id != NULL, NULL);
g_return_val_if_fail (event_id != NULL, NULL);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
@@ -4212,7 +4201,7 @@ e_o365_connection_prepare_get_event (EO365Connection *cnc,
"$select", select,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -4238,31 +4227,31 @@ e_o365_connection_prepare_get_event (EO365Connection *cnc,
}
gboolean
-e_o365_connection_get_event_sync (EO365Connection *cnc,
+e_m365_connection_get_event_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account user
*/
const gchar *group_id, /* nullable, then the default group is used */
const gchar *calendar_id,
const gchar *event_id,
const gchar *prefer_outlook_timezone, /* nullable - then UTC, otherwise
that zone for the returned times */
const gchar *select, /* nullable - properties to select */
- EO365Event **out_event,
+ EM365Event **out_event,
GCancellable *cancellable,
GError **error)
{
SoupMessage *message;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (event_id != NULL, FALSE);
g_return_val_if_fail (out_event != NULL, FALSE);
- message = e_o365_connection_prepare_get_event (cnc, user_override, group_id, calendar_id, event_id,
prefer_outlook_timezone, select, error);
+ message = e_m365_connection_prepare_get_event (cnc, user_override, group_id, calendar_id, event_id,
prefer_outlook_timezone, select, error);
if (!message)
return FALSE;
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_json_object_response_cb, NULL,
out_event, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_json_object_response_cb, NULL,
out_event, cancellable, error);
g_clear_object (&message);
@@ -4270,20 +4259,20 @@ e_o365_connection_get_event_sync (EO365Connection *cnc,
}
gboolean
-e_o365_connection_get_events_sync (EO365Connection *cnc,
+e_m365_connection_get_events_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *group_id, /* nullable, then the default group is used */
const gchar *calendar_id,
const GSList *event_ids, /* const gchar * */
const gchar *prefer_outlook_timezone, /* nullable - then UTC, otherwise
that zone for the returned times */
const gchar *select, /* nullable - properties to select */
- GSList **out_events, /* EO365Event *, in the same order as event_ids; can
return partial list */
+ GSList **out_events, /* EM365Event *, in the same order as event_ids; can
return partial list */
GCancellable *cancellable,
GError **error)
{
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (event_ids != NULL, FALSE);
g_return_val_if_fail (out_events != NULL, FALSE);
@@ -4294,13 +4283,13 @@ e_o365_connection_get_events_sync (EO365Connection *cnc,
guint total, done = 0;
total = g_slist_length ((GSList *) event_ids);
- requests = g_ptr_array_new_full (MIN (E_O365_BATCH_MAX_REQUESTS, MIN (total, 50)),
g_object_unref);
+ requests = g_ptr_array_new_full (MIN (E_M365_BATCH_MAX_REQUESTS, MIN (total, 50)),
g_object_unref);
for (link = (GSList *) event_ids; link && success; link = g_slist_next (link)) {
const gchar *id = link->data;
SoupMessage *message;
- message = e_o365_connection_prepare_get_event (cnc, user_override, group_id,
calendar_id, id, prefer_outlook_timezone, select, error);
+ message = e_m365_connection_prepare_get_event (cnc, user_override, group_id,
calendar_id, id, prefer_outlook_timezone, select, error);
if (!message) {
success = FALSE;
@@ -4309,16 +4298,16 @@ e_o365_connection_get_events_sync (EO365Connection *cnc,
g_ptr_array_add (requests, message);
- if (requests->len == E_O365_BATCH_MAX_REQUESTS || !link->next) {
+ if (requests->len == E_M365_BATCH_MAX_REQUESTS || !link->next) {
if (requests->len == 1) {
- EO365Event *event = NULL;
+ EM365Event *event = NULL;
- success = o365_connection_send_request_sync (cnc, message,
e_o365_read_json_object_response_cb, NULL, &event, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message,
e_m365_read_json_object_response_cb, NULL, &event, cancellable, error);
if (success)
*out_events = g_slist_prepend (*out_events, event);
} else {
- success = e_o365_connection_batch_request_sync (cnc, E_O365_API_V1_0,
requests, cancellable, error);
+ success = e_m365_connection_batch_request_sync (cnc, E_M365_API_V1_0,
requests, cancellable, error);
if (success) {
guint ii;
@@ -4327,7 +4316,7 @@ e_o365_connection_get_events_sync (EO365Connection *cnc,
JsonNode *node = NULL;
message = requests->pdata[ii];
- success = e_o365_connection_json_node_from_message
(message, NULL, &node, cancellable, error);
+ success = e_m365_connection_json_node_from_message
(message, NULL, &node, cancellable, error);
if (success && node && JSON_NODE_HOLDS_OBJECT (node))
{
JsonObject *response;
@@ -4361,12 +4350,12 @@ e_o365_connection_get_events_sync (EO365Connection *cnc,
} else {
SoupMessage *message;
- message = e_o365_connection_prepare_get_event (cnc, user_override, group_id, calendar_id,
event_ids->data, prefer_outlook_timezone, select, error);
+ message = e_m365_connection_prepare_get_event (cnc, user_override, group_id, calendar_id,
event_ids->data, prefer_outlook_timezone, select, error);
if (message) {
- EO365Event *event = NULL;
+ EM365Event *event = NULL;
- success = o365_connection_send_request_sync (cnc, message,
e_o365_read_json_object_response_cb, NULL, &event, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message,
e_m365_read_json_object_response_cb, NULL, &event, cancellable, error);
if (success)
*out_events = g_slist_prepend (*out_events, event);
@@ -4385,7 +4374,7 @@ e_o365_connection_get_events_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/event-update?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_update_event_sync (EO365Connection *cnc,
+e_m365_connection_update_event_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *group_id, /* nullable - then the default group is used */
const gchar *calendar_id,
@@ -4398,12 +4387,12 @@ e_o365_connection_update_event_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (event_id != NULL, FALSE);
g_return_val_if_fail (event != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
@@ -4412,7 +4401,7 @@ e_o365_connection_update_event_sync (EO365Connection *cnc,
"", event_id,
NULL);
- message = o365_connection_new_soup_message ("PATCH", uri, CSM_DISABLE_RESPONSE, error);
+ message = m365_connection_new_soup_message ("PATCH", uri, CSM_DISABLE_RESPONSE, error);
if (!message) {
g_free (uri);
@@ -4422,9 +4411,9 @@ e_o365_connection_update_event_sync (EO365Connection *cnc,
g_free (uri);
- e_o365_connection_set_json_body (message, event);
+ e_m365_connection_set_json_body (message, event);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -4434,7 +4423,7 @@ e_o365_connection_update_event_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/event-delete?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_delete_event_sync (EO365Connection *cnc,
+e_m365_connection_delete_event_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *group_id, /* nullable - then the default group is used */
const gchar *calendar_id,
@@ -4446,11 +4435,11 @@ e_o365_connection_delete_event_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (event_id != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
@@ -4459,7 +4448,7 @@ e_o365_connection_delete_event_sync (EO365Connection *cnc,
"", event_id,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -4469,7 +4458,7 @@ e_o365_connection_delete_event_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -4481,12 +4470,12 @@ e_o365_connection_delete_event_sync (EO365Connection *cnc,
https://docs.microsoft.com/en-us/graph/api/event-decline?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_response_event_sync (EO365Connection *cnc,
+e_m365_connection_response_event_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the account
user */
const gchar *group_id, /* nullable - then the default group is used */
const gchar *calendar_id,
const gchar *event_id,
- EO365ResponseType response, /* uses only accepted/tentatively
accepted/declined values */
+ EM365ResponseType response, /* uses only accepted/tentatively
accepted/declined values */
const gchar *comment, /* nullable */
gboolean send_response,
GCancellable *cancellable,
@@ -4497,23 +4486,23 @@ e_o365_connection_response_event_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (event_id != NULL, FALSE);
- g_return_val_if_fail (response == E_O365_RESPONSE_ACCEPTED || response ==
E_O365_RESPONSE_TENTATIVELY_ACCEPTED || response == E_O365_RESPONSE_DECLINED, FALSE);
+ g_return_val_if_fail (response == E_M365_RESPONSE_ACCEPTED || response ==
E_M365_RESPONSE_TENTATIVELY_ACCEPTED || response == E_M365_RESPONSE_DECLINED, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
"", calendar_id,
"", "events",
"", event_id,
- "", response == E_O365_RESPONSE_TENTATIVELY_ACCEPTED ? "tentativelyAccept" :
- response == E_O365_RESPONSE_DECLINED ? "decline" : "accept",
+ "", response == E_M365_RESPONSE_TENTATIVELY_ACCEPTED ? "tentativelyAccept" :
+ response == E_M365_RESPONSE_DECLINED ? "decline" : "accept",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DISABLE_RESPONSE, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DISABLE_RESPONSE, error);
if (!message) {
g_free (uri);
@@ -4525,16 +4514,16 @@ e_o365_connection_response_event_sync (EO365Connection *cnc,
builder = json_builder_new_immutable ();
- e_o365_json_begin_object_member (builder, NULL);
- e_o365_json_add_nonempty_string_member (builder, "comment", comment);
- e_o365_json_add_boolean_member (builder, "sendResponse", send_response);
- e_o365_json_end_object_member (builder);
+ e_m365_json_begin_object_member (builder, NULL);
+ e_m365_json_add_nonempty_string_member (builder, "comment", comment);
+ e_m365_json_add_boolean_member (builder, "sendResponse", send_response);
+ e_m365_json_end_object_member (builder);
- e_o365_connection_set_json_body (message, builder);
+ e_m365_connection_set_json_body (message, builder);
g_object_unref (builder);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -4544,7 +4533,7 @@ e_o365_connection_response_event_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/event-dismissreminder?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_dismiss_reminder_sync (EO365Connection *cnc,
+e_m365_connection_dismiss_reminder_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *group_id, /* nullable - then the default group is used
*/
const gchar *calendar_id,
@@ -4556,11 +4545,11 @@ e_o365_connection_dismiss_reminder_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (event_id != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
@@ -4570,7 +4559,7 @@ e_o365_connection_dismiss_reminder_sync (EO365Connection *cnc,
"", "dismissReminder",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -4580,7 +4569,7 @@ e_o365_connection_dismiss_reminder_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
@@ -4590,27 +4579,27 @@ e_o365_connection_dismiss_reminder_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/event-list-attachments?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_list_event_attachments_sync (EO365Connection *cnc,
+e_m365_connection_list_event_attachments_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *group_id, /* nullable, then the default group is
used */
const gchar *calendar_id,
const gchar *event_id,
const gchar *select, /* nullable - properties to select */
- GSList **out_attachments, /* EO365Attachment * */
+ GSList **out_attachments, /* EM365Attachment * */
GCancellable *cancellable,
GError **error)
{
- EO365ResponseData rd;
+ EM365ResponseData rd;
SoupMessage *message;
gchar *uri;
gboolean success;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (event_id != NULL, FALSE);
g_return_val_if_fail (out_attachments != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
@@ -4621,7 +4610,7 @@ e_o365_connection_list_event_attachments_sync (EO365Connection *cnc,
"$select", select,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -4631,11 +4620,11 @@ e_o365_connection_list_event_attachments_sync (EO365Connection *cnc,
g_free (uri);
- memset (&rd, 0, sizeof (EO365ResponseData));
+ memset (&rd, 0, sizeof (EM365ResponseData));
rd.out_items = out_attachments;
- success = o365_connection_send_request_sync (cnc, message, e_o365_read_valued_response_cb, NULL, &rd,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, e_m365_read_valued_response_cb, NULL, &rd,
cancellable, error);
g_clear_object (&message);
@@ -4645,13 +4634,13 @@ e_o365_connection_list_event_attachments_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_get_event_attachment_sync (EO365Connection *cnc,
+e_m365_connection_get_event_attachment_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *group_id, /* nullable, then the default group is
used */
const gchar *calendar_id,
const gchar *event_id,
const gchar *attachment_id,
- EO365ConnectionRawDataFunc func,
+ EM365ConnectionRawDataFunc func,
gpointer func_user_data,
GCancellable *cancellable,
GError **error)
@@ -4660,13 +4649,13 @@ e_o365_connection_get_event_attachment_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (event_id != NULL, FALSE);
g_return_val_if_fail (attachment_id != NULL, FALSE);
g_return_val_if_fail (func != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
@@ -4678,7 +4667,7 @@ e_o365_connection_get_event_attachment_sync (EO365Connection *cnc,
"", "$value",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_GET, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -4688,7 +4677,7 @@ e_o365_connection_get_event_attachment_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, NULL, func, func_user_data, cancellable,
error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, func, func_user_data, cancellable,
error);
g_clear_object (&message);
@@ -4698,13 +4687,13 @@ e_o365_connection_get_event_attachment_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/event-post-attachments?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_add_event_attachment_sync (EO365Connection *cnc,
+e_m365_connection_add_event_attachment_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use the
account user */
const gchar *group_id, /* nullable, then the default group is
used */
const gchar *calendar_id,
const gchar *event_id,
JsonBuilder *in_attachment,
- EO365Attachment **out_attachment, /* nullable */
+ EM365Attachment **out_attachment, /* nullable */
GCancellable *cancellable,
GError **error)
{
@@ -4712,12 +4701,12 @@ e_o365_connection_add_event_attachment_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (event_id != NULL, FALSE);
g_return_val_if_fail (in_attachment != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
@@ -4727,7 +4716,7 @@ e_o365_connection_add_event_attachment_sync (EO365Connection *cnc,
"", "attachments",
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_POST, uri, out_attachment ? CSM_DEFAULT :
CSM_DISABLE_RESPONSE, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_POST, uri, out_attachment ? CSM_DEFAULT :
CSM_DISABLE_RESPONSE, error);
if (!message) {
g_free (uri);
@@ -4737,10 +4726,10 @@ e_o365_connection_add_event_attachment_sync (EO365Connection *cnc,
g_free (uri);
- e_o365_connection_set_json_body (message, in_attachment);
+ e_m365_connection_set_json_body (message, in_attachment);
- success = o365_connection_send_request_sync (cnc, message, out_attachment ?
e_o365_read_json_object_response_cb : NULL,
- out_attachment ? NULL : e_o365_read_no_response_cb, out_attachment, cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, out_attachment ?
e_m365_read_json_object_response_cb : NULL,
+ out_attachment ? NULL : e_m365_read_no_response_cb, out_attachment, cancellable, error);
g_clear_object (&message);
@@ -4750,7 +4739,7 @@ e_o365_connection_add_event_attachment_sync (EO365Connection *cnc,
/* https://docs.microsoft.com/en-us/graph/api/attachment-delete?view=graph-rest-1.0&tabs=http */
gboolean
-e_o365_connection_delete_event_attachment_sync (EO365Connection *cnc,
+e_m365_connection_delete_event_attachment_sync (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable, then the default group is
used */
const gchar *calendar_id,
@@ -4763,12 +4752,12 @@ e_o365_connection_delete_event_attachment_sync (EO365Connection *cnc,
gboolean success;
gchar *uri;
- g_return_val_if_fail (E_IS_O365_CONNECTION (cnc), FALSE);
+ g_return_val_if_fail (E_IS_M365_CONNECTION (cnc), FALSE);
g_return_val_if_fail (calendar_id != NULL, FALSE);
g_return_val_if_fail (event_id != NULL, FALSE);
g_return_val_if_fail (attachment_id != NULL, FALSE);
- uri = e_o365_connection_construct_uri (cnc, TRUE, user_override, E_O365_API_V1_0, NULL,
+ uri = e_m365_connection_construct_uri (cnc, TRUE, user_override, E_M365_API_V1_0, NULL,
group_id ? "calendarGroups" : "calendars",
group_id,
group_id ? "calendars" : NULL,
@@ -4779,7 +4768,7 @@ e_o365_connection_delete_event_attachment_sync (EO365Connection *cnc,
"", attachment_id,
NULL);
- message = o365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
+ message = m365_connection_new_soup_message (SOUP_METHOD_DELETE, uri, CSM_DEFAULT, error);
if (!message) {
g_free (uri);
@@ -4789,7 +4778,7 @@ e_o365_connection_delete_event_attachment_sync (EO365Connection *cnc,
g_free (uri);
- success = o365_connection_send_request_sync (cnc, message, NULL, e_o365_read_no_response_cb, NULL,
cancellable, error);
+ success = m365_connection_send_request_sync (cnc, message, NULL, e_m365_read_no_response_cb, NULL,
cancellable, error);
g_clear_object (&message);
diff --git a/src/Office365/common/e-o365-connection.h b/src/Microsoft365/common/e-m365-connection.h
similarity index 65%
rename from src/Office365/common/e-o365-connection.h
rename to src/Microsoft365/common/e-m365-connection.h
index f5b7803c..ca839b35 100644
--- a/src/Office365/common/e-o365-connection.h
+++ b/src/Microsoft365/common/e-m365-connection.h
@@ -1,22 +1,11 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
-#ifndef E_O365_CONNECTION_H
-#define E_O365_CONNECTION_H
+#ifndef E_M365_CONNECTION_H
+#define E_M365_CONNECTION_H
#include <glib-object.h>
@@ -24,268 +13,268 @@
#include <json-glib/json-glib.h>
#include <libsoup/soup.h>
-#include "camel-o365-settings.h"
-#include "e-o365-enums.h"
-#include "e-o365-json-utils.h"
+#include "camel-m365-settings.h"
+#include "e-m365-enums.h"
+#include "e-m365-json-utils.h"
/* Currently, as of 2020-06-17, there is a limitation to 20 requests:
https://docs.microsoft.com/en-us/graph/known-issues#json-batching */
-#define E_O365_BATCH_MAX_REQUESTS 20
+#define E_M365_BATCH_MAX_REQUESTS 20
/* Standard GObject macros */
-#define E_TYPE_O365_CONNECTION \
- (e_o365_connection_get_type ())
-#define E_O365_CONNECTION(obj) \
+#define E_TYPE_M365_CONNECTION \
+ (e_m365_connection_get_type ())
+#define E_M365_CONNECTION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST \
- ((obj), E_TYPE_O365_CONNECTION, EO365Connection))
-#define E_O365_CONNECTION_CLASS(cls) \
+ ((obj), E_TYPE_M365_CONNECTION, EM365Connection))
+#define E_M365_CONNECTION_CLASS(cls) \
(G_TYPE_CHECK_CLASS_CAST \
- ((cls), E_TYPE_O365_CONNECTION, EO365ConnectionClass))
-#define E_IS_O365_CONNECTION(obj) \
+ ((cls), E_TYPE_M365_CONNECTION, EM365ConnectionClass))
+#define E_IS_M365_CONNECTION(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
- ((obj), E_TYPE_O365_CONNECTION))
-#define E_IS_O365_CONNECTION_CLASS(cls) \
+ ((obj), E_TYPE_M365_CONNECTION))
+#define E_IS_M365_CONNECTION_CLASS(cls) \
(G_TYPE_CHECK_CLASS_TYPE \
- ((cls), E_TYPE_O365_CONNECTION))
-#define E_O365_CONNECTION_GET_CLASS(obj) \
+ ((cls), E_TYPE_M365_CONNECTION))
+#define E_M365_CONNECTION_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS \
- ((obj), E_TYPE_O365_CONNECTION))
+ ((obj), E_TYPE_M365_CONNECTION))
G_BEGIN_DECLS
-typedef enum _EO365ApiVersion {
- E_O365_API_V1_0,
- E_O365_API_BETA
-} EO365ApiVersion;
+typedef enum _EM365ApiVersion {
+ E_M365_API_V1_0,
+ E_M365_API_BETA
+} EM365ApiVersion;
-typedef struct _EO365Connection EO365Connection;
-typedef struct _EO365ConnectionClass EO365ConnectionClass;
-typedef struct _EO365ConnectionPrivate EO365ConnectionPrivate;
+typedef struct _EM365Connection EM365Connection;
+typedef struct _EM365ConnectionClass EM365ConnectionClass;
+typedef struct _EM365ConnectionPrivate EM365ConnectionPrivate;
/* Returns whether can continue */
-typedef gboolean (* EO365ConnectionJsonFunc) (EO365Connection *cnc,
+typedef gboolean (* EM365ConnectionJsonFunc) (EM365Connection *cnc,
const GSList *results, /* JsonObject * - the returned
objects from the server */
gpointer user_data,
GCancellable *cancellable,
GError **error);
-typedef gboolean (* EO365ConnectionRawDataFunc) (EO365Connection *cnc,
+typedef gboolean (* EM365ConnectionRawDataFunc) (EM365Connection *cnc,
SoupMessage *message,
GInputStream *raw_data_stream,
gpointer user_data,
GCancellable *cancellable,
GError **error);
-struct _EO365Connection {
+struct _EM365Connection {
GObject parent;
- EO365ConnectionPrivate *priv;
+ EM365ConnectionPrivate *priv;
};
-struct _EO365ConnectionClass {
+struct _EM365ConnectionClass {
GObjectClass parent_class;
};
-gboolean e_o365_connection_util_delta_token_failed
+gboolean e_m365_connection_util_delta_token_failed
(const GError *error);
-GType e_o365_connection_get_type (void) G_GNUC_CONST;
+GType e_m365_connection_get_type (void) G_GNUC_CONST;
-EO365Connection *
- e_o365_connection_new (ESource *source,
- CamelO365Settings *settings);
-EO365Connection *
- e_o365_connection_new_for_backend
+EM365Connection *
+ e_m365_connection_new (ESource *source,
+ CamelM365Settings *settings);
+EM365Connection *
+ e_m365_connection_new_for_backend
(EBackend *backend,
ESourceRegistry *registry,
ESource *source,
- CamelO365Settings *settings);
-EO365Connection *
- e_o365_connection_new_full (ESource *source,
- CamelO365Settings *settings,
+ CamelM365Settings *settings);
+EM365Connection *
+ e_m365_connection_new_full (ESource *source,
+ CamelM365Settings *settings,
gboolean allow_reuse);
-ESource * e_o365_connection_get_source (EO365Connection *cnc);
-CamelO365Settings *
- e_o365_connection_get_settings (EO365Connection *cnc);
-guint e_o365_connection_get_concurrent_connections
- (EO365Connection *cnc);
-void e_o365_connection_set_concurrent_connections
- (EO365Connection *cnc,
+ESource * e_m365_connection_get_source (EM365Connection *cnc);
+CamelM365Settings *
+ e_m365_connection_get_settings (EM365Connection *cnc);
+guint e_m365_connection_get_concurrent_connections
+ (EM365Connection *cnc);
+void e_m365_connection_set_concurrent_connections
+ (EM365Connection *cnc,
guint concurrent_connections);
-GProxyResolver *e_o365_connection_ref_proxy_resolver
- (EO365Connection *cnc);
-void e_o365_connection_set_proxy_resolver
- (EO365Connection *cnc,
+GProxyResolver *e_m365_connection_ref_proxy_resolver
+ (EM365Connection *cnc);
+void e_m365_connection_set_proxy_resolver
+ (EM365Connection *cnc,
GProxyResolver *proxy_resolver);
ESoupAuthBearer *
- e_o365_connection_ref_bearer_auth
- (EO365Connection *cnc);
-void e_o365_connection_set_bearer_auth
- (EO365Connection *cnc,
+ e_m365_connection_ref_bearer_auth
+ (EM365Connection *cnc);
+void e_m365_connection_set_bearer_auth
+ (EM365Connection *cnc,
ESoupAuthBearer *bearer_auth);
-gboolean e_o365_connection_get_ssl_error_details
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_ssl_error_details
+ (EM365Connection *cnc,
gchar **out_certificate_pem,
GTlsCertificateFlags *out_certificate_errors);
ESourceAuthenticationResult
- e_o365_connection_authenticate_sync
- (EO365Connection *cnc,
+ e_m365_connection_authenticate_sync
+ (EM365Connection *cnc,
const gchar *user_override,
- EO365FolderKind kind,
+ EM365FolderKind kind,
const gchar *group_id,
const gchar *folder_id,
gchar **out_certificate_pem,
GTlsCertificateFlags *out_certificate_errors,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_disconnect_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_disconnect_sync
+ (EM365Connection *cnc,
GCancellable *cancellable,
GError **error);
-gchar * e_o365_connection_construct_uri (EO365Connection *cnc,
+gchar * e_m365_connection_construct_uri (EM365Connection *cnc,
gboolean include_user,
const gchar *user_override,
- EO365ApiVersion api_version,
+ EM365ApiVersion api_version,
const gchar *api_part, /* NULL for 'users', empty string to
skip */
const gchar *resource,
const gchar *id, /* NULL to skip */
const gchar *path,
...) G_GNUC_NULL_TERMINATED;
-gboolean e_o365_connection_json_node_from_message
+gboolean e_m365_connection_json_node_from_message
(SoupMessage *message,
GInputStream *input_stream,
JsonNode **out_node,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_batch_request_sync
- (EO365Connection *cnc,
- EO365ApiVersion api_version,
+gboolean e_m365_connection_batch_request_sync
+ (EM365Connection *cnc,
+ EM365ApiVersion api_version,
GPtrArray *requests, /* SoupMessage * */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_call_gather_into_slist
- (EO365Connection *cnc,
+gboolean e_m365_connection_call_gather_into_slist
+ (EM365Connection *cnc,
const GSList *results, /* JsonObject * - the returned
objects from the server */
gpointer user_data, /* expects GSList **, aka pointer to a
GSList *, where it copies the 'results' */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_categories_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_categories_sync
+ (EM365Connection *cnc,
const gchar *user_override,
- GSList **out_categories, /* EO365Category * */
+ GSList **out_categories, /* EM365Category * */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_list_mail_folders_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_list_mail_folders_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *from_path, /* path for the folder to read, NULL
for top user folder */
const gchar *select, /* nullable - properties to select */
- GSList **out_folders, /* EO365MailFolder * - the returned
mailFolder objects */
+ GSList **out_folders, /* EM365MailFolder * - the returned
mailFolder objects */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_folders_delta_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_folders_delta_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
- EO365FolderKind kind,
+ EM365FolderKind kind,
const gchar *select, /* nullable - properties to select */
const gchar *delta_link, /* previous delta link */
guint max_page_size, /* 0 for default by the server */
- EO365ConnectionJsonFunc func, /* function to call with each
result set */
+ EM365ConnectionJsonFunc func, /* function to call with each
result set */
gpointer func_user_data, /* user data passed into the 'func'
*/
gchar **out_delta_link,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_mail_folder_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_mail_folder_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id, /* nullable - then the 'inbox' is
used */
const gchar *select, /* nullable - properties to select */
- EO365MailFolder **out_folder,
+ EM365MailFolder **out_folder,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_create_mail_folder_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_create_mail_folder_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *parent_folder_id, /* NULL for the folder root */
const gchar *display_name,
- EO365MailFolder **out_mail_folder,
+ EM365MailFolder **out_mail_folder,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_delete_mail_folder_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_delete_mail_folder_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_copy_move_mail_folder_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_copy_move_mail_folder_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *src_folder_id,
const gchar *des_folder_id,
gboolean do_copy,
- EO365MailFolder **out_mail_folder,
+ EM365MailFolder **out_mail_folder,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_rename_mail_folder_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_rename_mail_folder_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id,
const gchar *display_name,
- EO365MailFolder **out_mail_folder,
+ EM365MailFolder **out_mail_folder,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_objects_delta_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_objects_delta_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
- EO365FolderKind kind,
+ EM365FolderKind kind,
const gchar *folder_id, /* folder ID to get delta messages
in */
const gchar *select, /* nullable - properties to select */
const gchar *delta_link, /* previous delta link */
guint max_page_size, /* 0 for default by the server */
- EO365ConnectionJsonFunc func, /* function to call with each
result set */
+ EM365ConnectionJsonFunc func, /* function to call with each
result set */
gpointer func_user_data, /* user data passed into the 'func'
*/
gchar **out_delta_link,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_mail_message_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_mail_message_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id,
const gchar *message_id,
- EO365ConnectionRawDataFunc func,
+ EM365ConnectionRawDataFunc func,
gpointer func_user_data,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_create_mail_message_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_create_mail_message_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id, /* if NULL, then goes to the Drafts
folder */
JsonBuilder *mail_message, /* filled mailMessage object */
- EO365MailMessage **out_created_message, /* free with
json_object_unref() */
+ EM365MailMessage **out_created_message, /* free with
json_object_unref() */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_add_mail_message_attachment_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_add_mail_message_attachment_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *message_id, /* the message to add it to */
JsonBuilder *attachment, /* filled attachment object */
gchar **out_attachment_id,
GCancellable *cancellable,
GError **error);
-SoupMessage * e_o365_connection_prepare_update_mail_message
- (EO365Connection *cnc,
+SoupMessage * e_m365_connection_prepare_update_mail_message
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *message_id,
JsonBuilder *mail_message, /* values to update, as a
mailMessage object */
GError **error);
-gboolean e_o365_connection_update_mail_message_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_update_mail_message_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *message_id,
JsonBuilder *mail_message, /* values to update, as a
mailMessage object */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_copy_move_mail_messages_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_copy_move_mail_messages_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const GSList *message_ids, /* const gchar * */
const gchar *des_folder_id,
@@ -293,175 +282,175 @@ gboolean e_o365_connection_copy_move_mail_messages_sync
GSList **out_des_message_ids, /* Camel-pooled gchar *, can
be partial */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_delete_mail_messages_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_delete_mail_messages_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const GSList *message_ids, /* const gchar * */
GSList **out_deleted_ids, /* (transfer container): const
gchar *, borrowed from message_ids */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_send_mail_message_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_send_mail_message_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *message_id,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_send_mail_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_send_mail_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
JsonBuilder *request, /* filled sendMail object */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_contacts_folder_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_contacts_folder_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id, /* nullable - then the default
'contacts' folder is returned */
const gchar *select, /* nullable - properties to select */
- EO365Folder **out_folder,
+ EM365Folder **out_folder,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_contact_photo_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_contact_photo_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id,
const gchar *contact_id,
GByteArray **out_photo,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_update_contact_photo_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_update_contact_photo_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id,
const gchar *contact_id,
const GByteArray *jpeg_photo, /* nullable - to remove the
photo */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_contact_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_contact_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id,
const gchar *contact_id,
- EO365Contact **out_contact,
+ EM365Contact **out_contact,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_create_contact_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_create_contact_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id, /* if NULL, then goes to the Drafts
folder */
JsonBuilder *contact, /* filled contact object */
- EO365Contact **out_created_contact, /* free with
json_object_unref() */
+ EM365Contact **out_created_contact, /* free with
json_object_unref() */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_update_contact_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_update_contact_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id,
const gchar *contact_id,
JsonBuilder *contact, /* values to update, as a contact
object */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_delete_contact_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_delete_contact_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *folder_id,
const gchar *contact_id,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_list_calendar_groups_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_list_calendar_groups_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
- GSList **out_groups, /* EO365CalendarGroup * - the returned
calendarGroup objects */
+ GSList **out_groups, /* EM365CalendarGroup * - the returned
calendarGroup objects */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_create_calendar_group_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_create_calendar_group_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *name,
- EO365CalendarGroup **out_created_group,
+ EM365CalendarGroup **out_created_group,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_calendar_group_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_calendar_group_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id,
- EO365CalendarGroup **out_group,
+ EM365CalendarGroup **out_group,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_update_calendar_group_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_update_calendar_group_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id,
const gchar *name,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_delete_calendar_group_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_delete_calendar_group_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_list_calendars_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_list_calendars_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable - calendar group for
group calendars */
const gchar *select, /* nullable - properties to select */
- GSList **out_calendars, /* EO365Calendar * - the returned
calendar objects */
+ GSList **out_calendars, /* EM365Calendar * - the returned
calendar objects */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_create_calendar_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_create_calendar_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable - then the default group
is used */
JsonBuilder *calendar,
- EO365Calendar **out_created_calendar,
+ EM365Calendar **out_created_calendar,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_calendar_folder_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_calendar_folder_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable - then the default group
is used */
const gchar *calendar_id, /* nullable - then the default
calendar is used */
const gchar *select, /* nullable - properties to select */
- EO365Calendar **out_calendar,
+ EM365Calendar **out_calendar,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_update_calendar_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_update_calendar_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable - then the default group
is used */
const gchar *calendar_id,
const gchar *name, /* nullable - to keep the existing name */
- EO365CalendarColorType color,
+ EM365CalendarColorType color,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_delete_calendar_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_delete_calendar_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable - then the default group
is used */
const gchar *calendar_id,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_list_events_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_list_events_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable - calendar group for
group calendars */
const gchar *calendar_id,
const gchar *prefer_outlook_timezone, /* nullable - then
UTC, otherwise that zone for the returned times */
const gchar *select, /* nullable - properties to select */
- GSList **out_events, /* EO365Event * - the returned event
objects */
+ GSList **out_events, /* EM365Event * - the returned event
objects */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_create_event_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_create_event_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable, then the default group
is used */
const gchar *calendar_id,
JsonBuilder *event,
- EO365Calendar **out_created_event,
+ EM365Calendar **out_created_event,
GCancellable *cancellable,
GError **error);
-SoupMessage * e_o365_connection_prepare_get_event
- (EO365Connection *cnc,
+SoupMessage * e_m365_connection_prepare_get_event
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable, then the default group
is used */
const gchar *calendar_id,
@@ -469,30 +458,30 @@ SoupMessage * e_o365_connection_prepare_get_event
const gchar *prefer_outlook_timezone, /* nullable - then
UTC, otherwise that zone for the returned times */
const gchar *select, /* nullable - properties to select */
GError **error);
-gboolean e_o365_connection_get_event_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_event_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable, then the default group
is used */
const gchar *calendar_id,
const gchar *event_id,
const gchar *prefer_outlook_timezone, /* nullable - then
UTC, otherwise that zone for the returned times */
const gchar *select, /* nullable - properties to select */
- EO365Event **out_event,
+ EM365Event **out_event,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_events_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_events_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable, then the default group
is used */
const gchar *calendar_id,
const GSList *event_ids, /* const gchar * */
const gchar *prefer_outlook_timezone, /* nullable - then
UTC, otherwise that zone for the returned times */
const gchar *select, /* nullable - properties to select */
- GSList **out_events, /* EO365Event *, in the same order as
event_ids; can return partial list */
+ GSList **out_events, /* EM365Event *, in the same order as
event_ids; can return partial list */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_update_event_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_update_event_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable - then the default group
is used */
const gchar *calendar_id,
@@ -500,66 +489,66 @@ gboolean e_o365_connection_update_event_sync
JsonBuilder *event,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_delete_event_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_delete_event_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable - then the default group
is used */
const gchar *calendar_id,
const gchar *event_id,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_response_event_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_response_event_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable - then the default group
is used */
const gchar *calendar_id,
const gchar *event_id,
- EO365ResponseType response, /* uses only
accepted/tentatively accepted/declined values */
+ EM365ResponseType response, /* uses only
accepted/tentatively accepted/declined values */
const gchar *comment, /* nullable */
gboolean send_response,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_dismiss_reminder_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_dismiss_reminder_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable - then the default group
is used */
const gchar *calendar_id,
const gchar *event_id,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_list_event_attachments_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_list_event_attachments_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable, then the default group
is used */
const gchar *calendar_id,
const gchar *event_id,
const gchar *select, /* nullable - properties to select */
- GSList **out_attachments, /* EO365Attachment * */
+ GSList **out_attachments, /* EM365Attachment * */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_get_event_attachment_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_get_event_attachment_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable, then the default group
is used */
const gchar *calendar_id,
const gchar *event_id,
const gchar *attachment_id,
- EO365ConnectionRawDataFunc func,
+ EM365ConnectionRawDataFunc func,
gpointer func_user_data,
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_add_event_attachment_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_add_event_attachment_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable, then the default group
is used */
const gchar *calendar_id,
const gchar *event_id,
JsonBuilder *in_attachment,
- EO365Attachment **out_attachment, /* nullable */
+ EM365Attachment **out_attachment, /* nullable */
GCancellable *cancellable,
GError **error);
-gboolean e_o365_connection_delete_event_attachment_sync
- (EO365Connection *cnc,
+gboolean e_m365_connection_delete_event_attachment_sync
+ (EM365Connection *cnc,
const gchar *user_override, /* for which user, NULL to use
the account user */
const gchar *group_id, /* nullable, then the default group
is used */
const gchar *calendar_id,
@@ -570,4 +559,4 @@ gboolean e_o365_connection_delete_event_attachment_sync
G_END_DECLS
-#endif /* E_O365_CONNECTION_H */
+#endif /* E_M365_CONNECTION_H */
diff --git a/src/Microsoft365/common/e-m365-enums.h b/src/Microsoft365/common/e-m365-enums.h
new file mode 100644
index 00000000..ea5919b6
--- /dev/null
+++ b/src/Microsoft365/common/e-m365-enums.h
@@ -0,0 +1,26 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_M365_ENUMS_H
+#define E_M365_ENUMS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ E_M365_FOLDER_KIND_UNKNOWN,
+ E_M365_FOLDER_KIND_MAIL,
+ E_M365_FOLDER_KIND_CALENDAR,
+ E_M365_FOLDER_KIND_CONTACTS,
+ E_M365_FOLDER_KIND_SEARCH,
+ E_M365_FOLDER_KIND_TASKS,
+ E_M365_FOLDER_KIND_MEMOS
+} EM365FolderKind;
+
+G_END_DECLS
+
+#endif /* E_M365_ENUMS_H */
diff --git a/src/Microsoft365/common/e-m365-json-utils.c b/src/Microsoft365/common/e-m365-json-utils.c
new file mode 100644
index 00000000..b9f7fb85
--- /dev/null
+++ b/src/Microsoft365/common/e-m365-json-utils.c
@@ -0,0 +1,3343 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "evolution-ews-config.h"
+
+#include <stdio.h>
+#include <json-glib/json-glib.h>
+
+#include "e-m365-json-utils.h"
+
+typedef struct _MapData {
+ const gchar *json_value;
+ gint enum_value;
+} MapData;
+
+static gint
+m365_json_utils_json_value_as_enum (const gchar *json_value,
+ const MapData *items,
+ guint n_items,
+ gint not_set_value,
+ gint unknown_value)
+{
+ guint ii;
+
+ if (!json_value)
+ return not_set_value;
+
+ for (ii = 0; ii < n_items; ii++) {
+ if (items[ii].json_value && g_ascii_strcasecmp (items[ii].json_value, json_value) == 0)
+ return items[ii].enum_value;
+ }
+
+ return unknown_value;
+}
+
+static gint
+m365_json_utils_get_json_as_enum (JsonObject *object,
+ const gchar *string_member_name,
+ const MapData *items,
+ guint n_items,
+ gint not_set_value,
+ gint unknown_value)
+{
+ return m365_json_utils_json_value_as_enum (e_m365_json_get_string_member (object, string_member_name,
NULL),
+ items, n_items, not_set_value, unknown_value);
+}
+
+static void
+m365_json_utils_add_enum_as_json (JsonBuilder *builder,
+ const gchar *string_member_name,
+ gint enum_value,
+ const MapData *items,
+ guint n_items,
+ gint not_set_value,
+ gint default_value)
+{
+ const gchar *json_value = NULL, *default_value_str = NULL;
+ guint ii;
+
+ if (enum_value == not_set_value) {
+ if (string_member_name)
+ e_m365_json_add_null_member (builder, string_member_name);
+ return;
+ }
+
+ for (ii = 0; ii < n_items; ii++) {
+ if (items[ii].enum_value == default_value) {
+ default_value_str = items[ii].json_value;
+
+ if (json_value)
+ break;
+ }
+
+ if (items[ii].enum_value == enum_value) {
+ json_value = items[ii].json_value;
+
+ if (default_value_str)
+ break;
+ }
+ }
+
+ if (!json_value) {
+ g_warning ("%s: Failed to find enum value %d for member '%s'", G_STRFUNC, enum_value,
string_member_name);
+ json_value = default_value_str;
+ }
+
+ if (json_value) {
+ if (string_member_name)
+ e_m365_json_add_string_member (builder, string_member_name, json_value);
+ else
+ json_builder_add_string_value (builder, json_value ? json_value : "");
+ }
+}
+
+static MapData attachment_data_type_map[] = {
+ { "#microsoft.graph.fileAttachment", E_M365_ATTACHMENT_DATA_TYPE_FILE },
+ { "#microsoft.graph.itemAttachment", E_M365_ATTACHMENT_DATA_TYPE_ITEM },
+ { "#microsoft.graph.referenceAttachment", E_M365_ATTACHMENT_DATA_TYPE_REFERENCE }
+};
+
+static MapData attendee_map[] = {
+ { "required", E_M365_ATTENDEE_REQUIRED },
+ { "optional", E_M365_ATTENDEE_OPTIONAL },
+ { "resource", E_M365_ATTENDEE_RESOURCE }
+};
+
+static struct _color_map {
+ const gchar *name;
+ const gchar *rgb;
+ EM365CalendarColorType value;
+} color_map[] = {
+ { "auto", NULL, E_M365_CALENDAR_COLOR_AUTO },
+ { "lightBlue", "#0078d4", E_M365_CALENDAR_COLOR_LIGHT_BLUE },
+ { "lightGreen", "#b67dfa", E_M365_CALENDAR_COLOR_LIGHT_GREEN },
+ { "lightOrange","#25c4fe", E_M365_CALENDAR_COLOR_LIGHT_ORANGE },
+ { "lightGray", "#968681", E_M365_CALENDAR_COLOR_LIGHT_GRAY },
+ { "lightYellow","#ffc699", E_M365_CALENDAR_COLOR_LIGHT_YELLOW }, /* Navy in web UI */
+ { "lightTeal", "#fc7c78", E_M365_CALENDAR_COLOR_LIGHT_TEAL },
+ { "lightPink", "#1cff73", E_M365_CALENDAR_COLOR_LIGHT_PINK },
+ { "lightBrown", "#8bb256", E_M365_CALENDAR_COLOR_LIGHT_BROWN }, /* Purple in web UI */
+ { "lightRed", "#3af0e0", E_M365_CALENDAR_COLOR_LIGHT_RED },
+ { "maxColor", NULL, E_M365_CALENDAR_COLOR_MAX_COLOR }
+};
+
+static MapData content_type_map[] = {
+ { "text", E_M365_ITEM_BODY_CONTENT_TYPE_TEXT },
+ { "html", E_M365_ITEM_BODY_CONTENT_TYPE_HTML }
+};
+
+static MapData day_of_week_map[] = {
+ { "sunday", E_M365_DAY_OF_WEEK_SUNDAY },
+ { "monday", E_M365_DAY_OF_WEEK_MONDAY },
+ { "tuesday", E_M365_DAY_OF_WEEK_TUESDAY },
+ { "wednesday", E_M365_DAY_OF_WEEK_WEDNESDAY },
+ { "thursday", E_M365_DAY_OF_WEEK_THURSDAY },
+ { "friday", E_M365_DAY_OF_WEEK_FRIDAY },
+ { "saturday", E_M365_DAY_OF_WEEK_SATURDAY }
+};
+
+static MapData event_type_map[] = {
+ { "singleInstance", E_M365_EVENT_TYPE_SINGLE_INSTANCE },
+ { "occurrence", E_M365_EVENT_TYPE_OCCURRENCE },
+ { "exception", E_M365_EVENT_TYPE_EXCEPTION },
+ { "seriesMaster", E_M365_EVENT_TYPE_SERIES_MASTER }
+};
+
+static MapData flag_status_map[] = {
+ { "notFlagged", E_M365_FOLLOWUP_FLAG_STATUS_NOT_FLAGGED },
+ { "complete", E_M365_FOLLOWUP_FLAG_STATUS_COMPLETE },
+ { "flagged", E_M365_FOLLOWUP_FLAG_STATUS_FLAGGED }
+};
+
+static MapData free_busy_status_map[] = {
+ { "unknown", E_M365_FREE_BUSY_STATUS_UNKNOWN },
+ { "free", E_M365_FREE_BUSY_STATUS_FREE },
+ { "tentative", E_M365_FREE_BUSY_STATUS_TENTATIVE },
+ { "busy", E_M365_FREE_BUSY_STATUS_BUSY },
+ { "oof", E_M365_FREE_BUSY_STATUS_OOF },
+ { "workingElsewhere", E_M365_FREE_BUSY_STATUS_WORKING_ELSEWHERE }
+};
+
+static MapData importance_map[] = {
+ { "low", E_M365_IMPORTANCE_LOW },
+ { "normal", E_M365_IMPORTANCE_NORMAL },
+ { "high", E_M365_IMPORTANCE_HIGH }
+};
+
+static MapData inference_classification_map[] = {
+ { "focused", E_M365_INFERENCE_CLASSIFICATION_FOCUSED },
+ { "other", E_M365_INFERENCE_CLASSIFICATION_OTHER }
+};
+
+static MapData location_type_map[] = {
+ { "default", E_M365_LOCATION_DEFAULT },
+ { "conferenceRoom", E_M365_LOCATION_CONFERENCE_ROOM },
+ { "homeAddress", E_M365_LOCATION_HOME_ADDRESS },
+ { "businessAddress", E_M365_LOCATION_BUSINESS_ADDRESS },
+ { "geoCoordinates", E_M365_LOCATION_GEO_COORDINATES },
+ { "streetAddress", E_M365_LOCATION_STREET_ADDRESS },
+ { "hotel", E_M365_LOCATION_HOTEL },
+ { "restaurant", E_M365_LOCATION_RESTAURANT },
+ { "localBusiness", E_M365_LOCATION_LOCAL_BUSINESS },
+ { "postalAddress", E_M365_LOCATION_POSTAL_ADDRESS }
+};
+
+static MapData meeting_provider_map[] = {
+ { "unknown", E_M365_ONLINE_MEETING_PROVIDER_UNKNOWN },
+ { "skypeForBusiness", E_M365_ONLINE_MEETING_PROVIDER_SKYPE_FOR_BUSINESS },
+ { "skypeForConsumer", E_M365_ONLINE_MEETING_PROVIDER_SKYPE_FOR_CONSUMER },
+ { "teamsForBusiness", E_M365_ONLINE_MEETING_PROVIDER_TEAMS_FOR_BUSINESS }
+};
+
+static MapData phone_map[] = {
+ { "home", E_M365_PHONE_HOME },
+ { "business", E_M365_PHONE_BUSINESS },
+ { "mobile", E_M365_PHONE_MOBILE },
+ { "other", E_M365_PHONE_OTHER },
+ { "assistant", E_M365_PHONE_ASSISTANT },
+ { "homeFax", E_M365_PHONE_HOMEFAX },
+ { "businessFax",E_M365_PHONE_BUSINESSFAX },
+ { "otherFax", E_M365_PHONE_OTHERFAX },
+ { "pager", E_M365_PHONE_PAGER },
+ { "radio", E_M365_PHONE_RADIO }
+};
+
+static MapData recurrence_pattern_map[] = {
+ { "daily", E_M365_RECURRENCE_PATTERN_DAILY },
+ { "weekly", E_M365_RECURRENCE_PATTERN_WEEKLY },
+ { "absoluteMonthly", E_M365_RECURRENCE_PATTERN_ABSOLUTE_MONTHLY },
+ { "relativeMonthly", E_M365_RECURRENCE_PATTERN_RELATIVE_MONTHLY },
+ { "absoluteYearly", E_M365_RECURRENCE_PATTERN_ABSOLUTE_YEARLY },
+ { "relativeYearly", E_M365_RECURRENCE_PATTERN_RELATIVE_YEARLY }
+};
+
+static MapData recurrence_range_map[] = {
+ { "endDate", E_M365_RECURRENCE_RANGE_ENDDATE },
+ { "noEnd", E_M365_RECURRENCE_RANGE_NOEND },
+ { "numbered", E_M365_RECURRENCE_RANGE_NUMBERED }
+};
+
+static MapData response_map[] = {
+ { "None", E_M365_RESPONSE_NONE },
+ { "Organizer", E_M365_RESPONSE_ORGANIZER },
+ { "TentativelyAccepted",E_M365_RESPONSE_TENTATIVELY_ACCEPTED },
+ { "Accepted", E_M365_RESPONSE_ACCEPTED },
+ { "Declined", E_M365_RESPONSE_DECLINED },
+ { "NotResponded", E_M365_RESPONSE_NOT_RESPONDED }
+};
+
+static MapData sensitivity_map[] = {
+ { "normal", E_M365_SENSITIVITY_NORMAL },
+ { "personal", E_M365_SENSITIVITY_PERSONAL },
+ { "private", E_M365_SENSITIVITY_PRIVATE },
+ { "confidential", E_M365_SENSITIVITY_CONFIDENTIAL }
+
+};
+
+static MapData week_index_map[] = {
+ { "first", E_M365_WEEK_INDEX_FIRST },
+ { "second", E_M365_WEEK_INDEX_SECOND },
+ { "third", E_M365_WEEK_INDEX_THIRD },
+ { "fourth", E_M365_WEEK_INDEX_FOURTH },
+ { "last", E_M365_WEEK_INDEX_LAST }
+};
+
+const gchar *
+e_m365_calendar_color_to_rgb (EM365CalendarColorType color)
+{
+ gint ii;
+
+ for (ii = 0; ii < G_N_ELEMENTS (color_map); ii++) {
+ if (color == color_map[ii].value)
+ return color_map[ii].rgb;
+ }
+
+ return NULL;
+}
+
+EM365CalendarColorType
+e_m365_rgb_to_calendar_color (const gchar *rgb)
+{
+ EM365CalendarColorType res;
+ gint ii, rr, gg, bb;
+ gdouble distance, res_distance = -1.0;
+
+ if (!rgb || !*rgb)
+ return E_M365_CALENDAR_COLOR_NOT_SET;
+
+ for (ii = 0; ii < G_N_ELEMENTS (color_map); ii++) {
+ if (color_map[ii].rgb && g_ascii_strcasecmp (color_map[ii].rgb, rgb) == 0)
+ return color_map[ii].value;
+ }
+
+ /* When exact match did not work, approximate to the closest */
+
+ if (sscanf (rgb, "#%02x%02x%02x", &rr, &gg, &bb) != 3)
+ return E_M365_CALENDAR_COLOR_UNKNOWN;
+
+ distance = (rr * rr) + (gg * gg) + (bb * bb);
+ res = E_M365_CALENDAR_COLOR_UNKNOWN;
+
+ for (ii = 0; ii < G_N_ELEMENTS (color_map); ii++) {
+ if (color_map[ii].rgb && sscanf (color_map[ii].rgb, "#%02x%02x%02x", &rr, &gg, &bb) == 3) {
+ gdouble candidate_distance;
+
+ candidate_distance = (rr * rr) + (gg * gg) + (bb * bb) - distance;
+
+ if (candidate_distance < 0.0)
+ candidate_distance *= -1.0;
+
+ if (!ii || candidate_distance < res_distance) {
+ res_distance = candidate_distance;
+ res = color_map[ii].value;
+ }
+ }
+ }
+
+ return res;
+}
+
+JsonArray *
+e_m365_json_get_array_member (JsonObject *object,
+ const gchar *member_name)
+{
+ JsonNode *node;
+
+ g_return_val_if_fail (object != NULL, NULL);
+ g_return_val_if_fail (member_name != NULL, NULL);
+
+ node = json_object_get_member (object, member_name);
+
+ if (!node || JSON_NODE_HOLDS_NULL (node))
+ return NULL;
+
+ g_return_val_if_fail (JSON_NODE_HOLDS_ARRAY (node), NULL);
+
+ return json_node_get_array (node);
+}
+
+void
+e_m365_json_begin_array_member (JsonBuilder *builder,
+ const gchar *member_name)
+{
+ if (member_name && *member_name)
+ json_builder_set_member_name (builder, member_name);
+
+ json_builder_begin_array (builder);
+}
+
+void
+e_m365_json_end_array_member (JsonBuilder *builder)
+{
+ json_builder_end_array (builder);
+}
+
+gboolean
+e_m365_json_get_boolean_member (JsonObject *object,
+ const gchar *member_name,
+ gboolean default_value)
+{
+ JsonNode *node;
+
+ g_return_val_if_fail (object != NULL, default_value);
+ g_return_val_if_fail (member_name != NULL, default_value);
+
+ node = json_object_get_member (object, member_name);
+
+ if (!node || JSON_NODE_HOLDS_NULL (node))
+ return default_value;
+
+ g_return_val_if_fail (JSON_NODE_HOLDS_VALUE (node), default_value);
+
+ return json_node_get_boolean (node);
+}
+
+void
+e_m365_json_add_boolean_member (JsonBuilder *builder,
+ const gchar *member_name,
+ gboolean value)
+{
+ g_return_if_fail (member_name && *member_name);
+
+ json_builder_set_member_name (builder, member_name);
+ json_builder_add_boolean_value (builder, value);
+}
+
+gdouble
+e_m365_json_get_double_member (JsonObject *object,
+ const gchar *member_name,
+ gdouble default_value)
+{
+ JsonNode *node;
+
+ g_return_val_if_fail (object != NULL, default_value);
+ g_return_val_if_fail (member_name != NULL, default_value);
+
+ node = json_object_get_member (object, member_name);
+
+ if (!node || JSON_NODE_HOLDS_NULL (node))
+ return default_value;
+
+ g_return_val_if_fail (JSON_NODE_HOLDS_VALUE (node), default_value);
+
+ return json_node_get_double (node);
+}
+
+void
+e_m365_json_add_double_member (JsonBuilder *builder,
+ const gchar *member_name,
+ gdouble value)
+{
+ g_return_if_fail (member_name && *member_name);
+
+ json_builder_set_member_name (builder, member_name);
+ json_builder_add_double_value (builder, value);
+}
+
+gint64
+e_m365_json_get_int_member (JsonObject *object,
+ const gchar *member_name,
+ gint64 default_value)
+{
+ JsonNode *node;
+
+ g_return_val_if_fail (object != NULL, default_value);
+ g_return_val_if_fail (member_name != NULL, default_value);
+
+ node = json_object_get_member (object, member_name);
+
+ if (!node || JSON_NODE_HOLDS_NULL (node))
+ return default_value;
+
+ g_return_val_if_fail (JSON_NODE_HOLDS_VALUE (node), default_value);
+
+ return json_node_get_int (node);
+}
+
+void
+e_m365_json_add_int_member (JsonBuilder *builder,
+ const gchar *member_name,
+ gint64 value)
+{
+ g_return_if_fail (member_name && *member_name);
+
+ json_builder_set_member_name (builder, member_name);
+ json_builder_add_int_value (builder, value);
+}
+
+gboolean
+e_m365_json_get_null_member (JsonObject *object,
+ const gchar *member_name,
+ gboolean default_value)
+{
+ JsonNode *node;
+
+ g_return_val_if_fail (object != NULL, default_value);
+ g_return_val_if_fail (member_name != NULL, default_value);
+
+ node = json_object_get_member (object, member_name);
+
+ if (!node)
+ return default_value;
+
+ g_return_val_if_fail (JSON_NODE_HOLDS_NULL (node), default_value);
+
+ return json_node_is_null (node);
+}
+
+void
+e_m365_json_add_null_member (JsonBuilder *builder,
+ const gchar *member_name)
+{
+ g_return_if_fail (member_name && *member_name);
+
+ json_builder_set_member_name (builder, member_name);
+ json_builder_add_null_value (builder);
+}
+
+JsonObject *
+e_m365_json_get_object_member (JsonObject *object,
+ const gchar *member_name)
+{
+ JsonNode *node;
+
+ g_return_val_if_fail (object != NULL, NULL);
+ g_return_val_if_fail (member_name != NULL, NULL);
+
+ node = json_object_get_member (object, member_name);
+
+ if (!node || JSON_NODE_HOLDS_NULL (node))
+ return NULL;
+
+ g_return_val_if_fail (JSON_NODE_HOLDS_OBJECT (node), NULL);
+
+ return json_node_get_object (node);
+}
+
+void
+e_m365_json_begin_object_member (JsonBuilder *builder,
+ const gchar *member_name)
+{
+ if (member_name && *member_name)
+ json_builder_set_member_name (builder, member_name);
+
+ json_builder_begin_object (builder);
+}
+
+void
+e_m365_json_end_object_member (JsonBuilder *builder)
+{
+ json_builder_end_object (builder);
+}
+
+const gchar *
+e_m365_json_get_string_member (JsonObject *object,
+ const gchar *member_name,
+ const gchar *default_value)
+{
+ JsonNode *node;
+
+ g_return_val_if_fail (object != NULL, default_value);
+ g_return_val_if_fail (member_name != NULL, default_value);
+
+ node = json_object_get_member (object, member_name);
+
+ if (!node || JSON_NODE_HOLDS_NULL (node))
+ return default_value;
+
+ g_return_val_if_fail (JSON_NODE_HOLDS_VALUE (node), default_value);
+
+ return json_node_get_string (node);
+}
+
+void
+e_m365_json_add_string_member (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *value)
+{
+ g_return_if_fail (member_name && *member_name);
+
+ json_builder_set_member_name (builder, member_name);
+ json_builder_add_string_value (builder, value ? value : "");
+}
+
+void
+e_m365_json_add_nonempty_string_member (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *value)
+{
+ g_return_if_fail (member_name && *member_name);
+
+ if (value && *value)
+ e_m365_json_add_string_member (builder, member_name, value);
+}
+
+void
+e_m365_json_add_nonempty_or_null_string_member (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *value)
+{
+ g_return_if_fail (member_name && *member_name);
+
+ if (value && *value)
+ e_m365_json_add_string_member (builder, member_name, value);
+ else
+ e_m365_json_add_null_member (builder, member_name);
+}
+
+EM365Date
+e_m365_date_get (JsonObject *object,
+ const gchar *member_name)
+{
+ const gchar *value;
+ guint year = 0, month = 0, day = 0;
+
+ value = e_m365_json_get_string_member (object, member_name, NULL);
+
+ if (!value || !*value)
+ return -1;
+
+ if (sscanf (value, "%04u-%02u-%02u", &year, &month, &day) != 3) {
+ g_warning ("%s: Failed to decode date '%s' of member '%s'", G_STRFUNC, value, member_name);
+ return -1;
+ }
+
+ return e_m365_date_encode (year, month, day);
+}
+
+void
+e_m365_add_date (JsonBuilder *builder,
+ const gchar *member_name,
+ EM365Date value)
+{
+ guint year, month, day;
+
+ if (e_m365_date_decode (value, &year, &month, &day)) {
+ gchar buff[128];
+
+ g_snprintf (buff, sizeof (buff), "%04u-%02u-%02u", year, month, day);
+ e_m365_json_add_string_member (builder, member_name, buff);
+ }
+}
+
+gboolean
+e_m365_date_decode (EM365Date dt,
+ guint *out_year,
+ guint *out_month,
+ guint *out_day)
+{
+ g_return_val_if_fail (out_year != NULL, FALSE);
+ g_return_val_if_fail (out_month != NULL, FALSE);
+ g_return_val_if_fail (out_day != NULL, FALSE);
+
+ if (dt <= 0)
+ return FALSE;
+
+ *out_year = dt % 10000;
+ *out_month = (dt / 10000) % 100;
+ *out_day = (dt / 1000000) % 100;
+
+ return *out_year > 1000 &&
+ *out_month >= 1 && *out_month <= 12 &&
+ *out_day >= 1 && *out_day <= 31;
+}
+
+EM365Date
+e_m365_date_encode (guint year,
+ guint month,
+ guint day)
+{
+ g_return_val_if_fail (year > 0 && year < 10000, -1);
+ g_return_val_if_fail (month >= 1 && month <= 12, -1);
+ g_return_val_if_fail (day >= 1 && day <= 31, -1);
+
+ return year + (10000 * month) + (1000000 * day);
+}
+
+time_t
+e_m365_get_date_time_offset_member (JsonObject *object,
+ const gchar *member_name)
+{
+ const gchar *value;
+ time_t res = (time_t) 0;
+
+ value = e_m365_json_get_string_member (object, member_name, NULL);
+
+ if (value) {
+ GDateTime *dt;
+
+ dt = g_date_time_new_from_iso8601 (value, NULL);
+
+ if (!dt) {
+ gint len = strlen (value);
+
+ /* 2020-07-14T00:00:00.0000000 , eventually with 'Z' at the end */
+ if (len == 27 && value[4] == '-' && value[7] == '-' && value[10] == 'T' && value[13]
== ':' && value[16] == ':' && value[19] == '.') {
+ gchar tmp[32];
+
+ strncpy (tmp, value, 27);
+ tmp[27] = 'Z';
+ tmp[28] = '\0';
+
+ dt = g_date_time_new_from_iso8601 (tmp, NULL);
+ }
+ }
+
+ if (dt) {
+ res = (time_t) g_date_time_to_unix (dt);
+ g_date_time_unref (dt);
+ }
+ }
+
+ return res;
+}
+
+void
+e_m365_add_date_time_offset_member (JsonBuilder *builder,
+ const gchar *member_name,
+ time_t value)
+{
+ GDateTime *dt;
+ gchar *value_str;
+
+ if (value <= (time_t) 0) {
+ e_m365_json_add_null_member (builder, member_name);
+ return;
+ }
+
+ dt = g_date_time_new_from_unix_utc (value);
+ g_return_if_fail (dt != NULL);
+
+ value_str = g_date_time_format_iso8601 (dt);
+
+ e_m365_json_add_string_member (builder, member_name, value_str);
+
+ g_date_time_unref (dt);
+ g_free (value_str);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/datetimetimezone?view=graph-rest-1.0 */
+
+time_t
+e_m365_date_time_get_date_time (EM365DateTimeWithZone *datetime)
+{
+ return e_m365_get_date_time_offset_member (datetime, "dateTime");
+}
+
+const gchar *
+e_m365_date_time_get_time_zone (EM365DateTimeWithZone *datetime)
+{
+ return e_m365_json_get_string_member (datetime, "timeZone", NULL);
+}
+
+void
+e_m365_add_date_time (JsonBuilder *builder,
+ const gchar *member_name,
+ time_t date_time,
+ const gchar *zone)
+{
+ g_return_if_fail (member_name != NULL);
+
+ if (date_time <= (time_t) 0) {
+ e_m365_json_add_null_member (builder, member_name);
+ return;
+ }
+
+ e_m365_json_begin_object_member (builder, member_name);
+
+ e_m365_add_date_time_offset_member (builder, "dateTime", date_time);
+ e_m365_json_add_nonempty_string_member (builder, "timeZone", zone);
+
+ e_m365_json_end_object_member (builder);
+}
+
+/* https://docs.microsoft.com/en-us/graph/delta-query-overview */
+
+gboolean
+e_m365_delta_is_removed_object (JsonObject *object)
+{
+ return json_object_has_member (object, "@removed");
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/outlookcategory?view=graph-rest-1.0 */
+
+const gchar *
+e_m365_category_get_display_name (EM365Category *category)
+{
+ return e_m365_json_get_string_member (category, "displayName", NULL);
+}
+
+const gchar *
+e_m365_category_get_id (EM365Category *category)
+{
+ return e_m365_json_get_string_member (category, "id", NULL);
+}
+
+const gchar *
+e_m365_category_get_color (EM365Category *category)
+{
+ const gchar *colors_array[] = {
+ "#ff1a36", /* Red */
+ "#ff8c00", /* Orange */
+ "#f4b10b", /* Peach */
+ "#fff100", /* Yellow */
+ "#009e48", /* Green */
+ "#00b294", /* Teal */
+ "#89933f", /* Olive */
+ "#00bcf2", /* Blue */
+ "#8e69df", /* Purple */
+ "#f30092", /* Maroon */
+ "#6c7e9a", /* Steel */
+ "#425066", /* DarkSteel */
+ "#969696", /* Gray */
+ "#525552", /* DarkGray */
+ "#282828", /* Black */
+ "#a00023", /* DarkRed */
+ "#c45502", /* DarkOrange */
+ "#af7000", /* DarkPeach */
+ "#b59b02", /* DarkYellow */
+ "#176002", /* DarkGreen */
+ "#00725c", /* DarkTeal */
+ "#5c6022", /* DarkOlive */
+ "#036393", /* DarkBlue */
+ "#422f8e", /* DarkPurple */
+ "#960269" /* DarkMaroon */
+ };
+ const gchar *color_str;
+ gchar *enptr = NULL;
+ gint color_index;
+
+ color_str = e_m365_json_get_string_member (category, "color", NULL);
+
+ if (!color_str ||
+ g_ascii_strcasecmp (color_str, "None") == 0 ||
+ g_ascii_strncasecmp (color_str, "preset", 6) != 0)
+ return NULL;
+
+ color_index = (gint) g_ascii_strtoll (color_str + 6, &enptr, 10);
+
+ if (enptr != color_str && color_index >= 0 && color_index < G_N_ELEMENTS (colors_array))
+ return colors_array[color_index];
+
+ return NULL;
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/mailfolder?view=graph-rest-1.0
+ https://docs.microsoft.com/en-us/graph/api/resources/contactfolder?view=graph-rest-1.0
+ */
+
+const gchar *
+e_m365_folder_get_id (EM365Folder *folder)
+{
+ return e_m365_json_get_string_member (folder, "id", NULL);
+}
+
+const gchar *
+e_m365_folder_get_parent_folder_id (EM365Folder *folder)
+{
+ return e_m365_json_get_string_member (folder, "parentFolderId", NULL);
+}
+
+const gchar *
+e_m365_folder_get_display_name (EM365Folder *folder)
+{
+ return e_m365_json_get_string_member (folder, "displayName", NULL);
+}
+
+gint32
+e_m365_mail_folder_get_child_folder_count (EM365MailFolder *folder)
+{
+ return (gint32) e_m365_json_get_int_member (folder, "childFolderCount", 0);
+}
+
+gint32
+e_m365_mail_folder_get_total_item_count (EM365MailFolder *folder)
+{
+ return (gint32) e_m365_json_get_int_member (folder, "totalItemCount", 0);
+}
+
+gint32
+e_m365_mail_folder_get_unread_item_count (EM365MailFolder *folder)
+{
+ return (gint32) e_m365_json_get_int_member (folder, "unreadItemCount", 0);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/recipient?view=graph-rest-1.0
+ https://docs.microsoft.com/en-us/graph/api/resources/emailaddress?view=graph-rest-1.0
+ */
+const gchar *
+e_m365_recipient_get_name (EM365Recipient *recipient)
+{
+ JsonObject *email_address;
+
+ email_address = e_m365_json_get_object_member (recipient, "emailAddress");
+
+ if (!email_address)
+ return NULL;
+
+ return e_m365_json_get_string_member (email_address, "name", NULL);
+}
+
+const gchar *
+e_m365_recipient_get_address (EM365Recipient *recipient)
+{
+ JsonObject *email_address;
+
+ email_address = e_m365_json_get_object_member (recipient, "emailAddress");
+
+ if (!email_address)
+ return NULL;
+
+ return e_m365_json_get_string_member (email_address, "address", NULL);
+}
+
+void
+e_m365_add_recipient (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *name,
+ const gchar *address)
+{
+ g_return_if_fail ((name && *name) || (address && *address));
+
+ e_m365_json_begin_object_member (builder, member_name);
+ e_m365_json_begin_object_member (builder, "emailAddress");
+
+ e_m365_json_add_nonempty_string_member (builder, "name", name);
+ e_m365_json_add_nonempty_string_member (builder, "address", address);
+
+ e_m365_json_end_object_member (builder); /* emailAddress */
+ e_m365_json_end_object_member (builder); /* member_name */
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/internetmessageheader?view=graph-rest-1.0 */
+
+const gchar *
+e_m365_internet_message_header_get_name (EM365InternetMessageHeader *header)
+{
+ return e_m365_json_get_string_member (header, "name", NULL);
+}
+
+const gchar *
+e_m365_internet_message_header_get_value (EM365InternetMessageHeader *header)
+{
+ return e_m365_json_get_string_member (header, "value", NULL);
+}
+
+void
+e_m365_add_internet_message_header (JsonBuilder *builder,
+ const gchar *name,
+ const gchar *value)
+{
+ g_return_if_fail (name && *name);
+ g_return_if_fail (value);
+
+ json_builder_begin_object (builder);
+
+ if (value && (*value == ' ' || *value == '\t'))
+ value++;
+
+ e_m365_json_add_string_member (builder, "name", name);
+ e_m365_json_add_string_member (builder, "value", value);
+
+ json_builder_end_object (builder);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/followupflag?view=graph-rest-1.0 */
+
+EM365DateTimeWithZone *
+e_m365_followup_flag_get_completed_date_time (EM365FollowupFlag *flag)
+{
+ return e_m365_json_get_object_member (flag, "completedDateTime");
+}
+
+void
+e_m365_followup_flag_add_completed_date_time (JsonBuilder *builder,
+ time_t date_time,
+ const gchar *zone)
+{
+ e_m365_add_date_time (builder, "completedDateTime", date_time, zone);
+}
+
+EM365DateTimeWithZone *
+e_m365_followup_flag_get_due_date_time (EM365FollowupFlag *flag)
+{
+ return e_m365_json_get_object_member (flag, "dueDateTime");
+}
+
+void
+e_m365_followup_flag_add_due_date_time (JsonBuilder *builder,
+ time_t date_time,
+ const gchar *zone)
+{
+ e_m365_add_date_time (builder, "dueDateTime", date_time, zone);
+}
+
+EM365FollowupFlagStatusType
+e_m365_followup_flag_get_flag_status (EM365FollowupFlag *flag)
+{
+ return m365_json_utils_get_json_as_enum (flag, "flagStatus",
+ flag_status_map, G_N_ELEMENTS (flag_status_map),
+ E_M365_FOLLOWUP_FLAG_STATUS_NOT_SET,
+ E_M365_FOLLOWUP_FLAG_STATUS_UNKNOWN);
+}
+
+void
+e_m365_followup_flag_add_flag_status (JsonBuilder *builder,
+ EM365FollowupFlagStatusType status)
+{
+ m365_json_utils_add_enum_as_json (builder, "flagStatus", status,
+ flag_status_map, G_N_ELEMENTS (flag_status_map),
+ E_M365_FOLLOWUP_FLAG_STATUS_NOT_SET,
+ E_M365_FOLLOWUP_FLAG_STATUS_NOT_FLAGGED);
+}
+
+EM365DateTimeWithZone *
+e_m365_followup_flag_get_start_date_time (EM365FollowupFlag *flag)
+{
+ return e_m365_json_get_object_member (flag, "startDateTime");
+}
+
+void
+e_m365_followup_flag_add_start_date_time (JsonBuilder *builder,
+ time_t date_time,
+ const gchar *zone)
+{
+ e_m365_add_date_time (builder, "startDateTime", date_time, zone);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/itembody?view=graph-rest-1.0 */
+
+const gchar *
+e_m365_item_body_get_content (EM365ItemBody *item_body)
+{
+ return e_m365_json_get_string_member (item_body, "content", NULL);
+}
+
+EM365ItemBodyContentTypeType
+e_m365_item_body_get_content_type (EM365ItemBody *item_body)
+{
+ return m365_json_utils_get_json_as_enum (item_body, "contentType",
+ content_type_map, G_N_ELEMENTS (content_type_map),
+ E_M365_ITEM_BODY_CONTENT_TYPE_NOT_SET,
+ E_M365_ITEM_BODY_CONTENT_TYPE_UNKNOWN);
+}
+
+void
+e_m365_add_item_body (JsonBuilder *builder,
+ const gchar *member_name,
+ EM365ItemBodyContentTypeType content_type,
+ const gchar *content)
+{
+ g_return_if_fail (member_name != NULL);
+
+ if (content_type == E_M365_ITEM_BODY_CONTENT_TYPE_NOT_SET || !content) {
+ e_m365_json_add_null_member (builder, member_name);
+ return;
+ }
+
+ e_m365_json_begin_object_member (builder, member_name);
+
+ m365_json_utils_add_enum_as_json (builder, "contentType", content_type,
+ content_type_map, G_N_ELEMENTS (content_type_map),
+ E_M365_ITEM_BODY_CONTENT_TYPE_NOT_SET,
+ E_M365_ITEM_BODY_CONTENT_TYPE_TEXT);
+
+ e_m365_json_add_string_member (builder, "content", content);
+
+ e_m365_json_end_object_member (builder);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/message?view=graph-rest-1.0 */
+
+JsonArray * /* EM365Recipient * */
+e_m365_mail_message_get_bcc_recipients (EM365MailMessage *mail)
+{
+ return e_m365_json_get_array_member (mail, "bccRecipients");
+}
+
+void
+e_m365_mail_message_begin_bcc_recipients (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "bccRecipients");
+}
+
+void
+e_m365_mail_message_end_bcc_recipients (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+EM365ItemBody *
+e_m365_mail_message_get_body (EM365MailMessage *mail)
+{
+ return e_m365_json_get_object_member (mail, "body");
+}
+
+void
+e_m365_mail_message_add_body (JsonBuilder *builder,
+ EM365ItemBodyContentTypeType content_type,
+ const gchar *content)
+{
+ e_m365_add_item_body (builder, "body", content_type, content);
+}
+
+const gchar *
+e_m365_mail_message_get_body_preview (EM365MailMessage *mail)
+{
+ return e_m365_json_get_string_member (mail, "bodyPreview", NULL);
+}
+
+JsonArray * /* const gchar * */
+e_m365_mail_message_get_categories (EM365MailMessage *mail)
+{
+ return e_m365_json_get_array_member (mail, "categories");
+}
+
+void
+e_m365_mail_message_begin_categories (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "categories");
+}
+
+void
+e_m365_mail_message_end_categories (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+void
+e_m365_mail_message_add_category (JsonBuilder *builder,
+ const gchar *category)
+{
+ g_return_if_fail (category && *category);
+
+ json_builder_add_string_value (builder, category);
+}
+
+JsonArray * /* EM365Recipient * */
+e_m365_mail_message_get_cc_recipients (EM365MailMessage *mail)
+{
+ return e_m365_json_get_array_member (mail, "ccRecipients");
+}
+
+void
+e_m365_mail_message_begin_cc_recipients (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "ccRecipients");
+}
+
+void
+e_m365_mail_message_end_cc_recipients (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+const gchar *
+e_m365_mail_message_get_change_key (EM365MailMessage *mail)
+{
+ return e_m365_json_get_string_member (mail, "changeKey", NULL);
+}
+
+const gchar *
+e_m365_mail_message_get_conversation_id (EM365MailMessage *mail)
+{
+ return e_m365_json_get_string_member (mail, "conversationId", NULL);
+}
+
+JsonObject * /* Edm.Binary */
+e_m365_mail_message_get_conversation_index (EM365MailMessage *mail)
+{
+ return e_m365_json_get_object_member (mail, "conversationIndex");
+}
+
+time_t
+e_m365_mail_message_get_created_date_time (EM365MailMessage *mail)
+{
+ return e_m365_get_date_time_offset_member (mail, "createdDateTime");
+}
+
+EM365FollowupFlag *
+e_m365_mail_message_get_flag (EM365MailMessage *mail)
+{
+ return e_m365_json_get_object_member (mail, "flag");
+}
+
+void
+e_m365_mail_message_begin_flag (JsonBuilder *builder)
+{
+ e_m365_json_begin_object_member (builder, "flag");
+}
+
+void
+e_m365_mail_message_end_flag (JsonBuilder *builder)
+{
+ e_m365_json_end_object_member (builder);
+}
+
+EM365Recipient *
+e_m365_mail_message_get_from (EM365MailMessage *mail)
+{
+ return e_m365_json_get_object_member (mail, "from");
+}
+
+void
+e_m365_mail_message_add_from (JsonBuilder *builder,
+ const gchar *name,
+ const gchar *address)
+{
+ e_m365_add_recipient (builder, "from", name, address);
+}
+
+gboolean
+e_m365_mail_message_get_has_attachments (EM365MailMessage *mail)
+{
+ return e_m365_json_get_boolean_member (mail, "hasAttachments", FALSE);
+}
+
+const gchar *
+e_m365_mail_message_get_id (EM365MailMessage *mail)
+{
+ return e_m365_json_get_string_member (mail, "id", NULL);
+}
+
+EM365ImportanceType
+e_m365_mail_message_get_importance (EM365MailMessage *mail)
+{
+ return m365_json_utils_get_json_as_enum (mail, "importance",
+ importance_map, G_N_ELEMENTS (importance_map),
+ E_M365_IMPORTANCE_NOT_SET,
+ E_M365_IMPORTANCE_UNKNOWN);
+}
+
+void
+e_m365_mail_message_add_importance (JsonBuilder *builder,
+ EM365ImportanceType importance)
+{
+ m365_json_utils_add_enum_as_json (builder, "importance", importance,
+ importance_map, G_N_ELEMENTS (importance_map),
+ E_M365_IMPORTANCE_NOT_SET,
+ E_M365_IMPORTANCE_NOT_SET);
+}
+
+EM365InferenceClassificationType
+e_m365_mail_message_get_inference_classification (EM365MailMessage *mail)
+{
+ return m365_json_utils_get_json_as_enum (mail, "inferenceClassification",
+ inference_classification_map, G_N_ELEMENTS (inference_classification_map),
+ E_M365_INFERENCE_CLASSIFICATION_NOT_SET,
+ E_M365_INFERENCE_CLASSIFICATION_UNKNOWN);
+}
+
+JsonArray * /* EM365InternetMessageHeader * */
+e_m365_mail_message_get_internet_message_headers (EM365MailMessage *mail)
+{
+ return e_m365_json_get_array_member (mail, "internetMessageHeaders");
+}
+
+void
+e_m365_mail_message_begin_internet_message_headers (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "internetMessageHeaders");
+}
+
+void
+e_m365_mail_message_end_internet_message_headers (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+const gchar *
+e_m365_mail_message_get_internet_message_id (EM365MailMessage *mail)
+{
+ return e_m365_json_get_string_member (mail, "internetMessageId", NULL);
+}
+
+void
+e_m365_mail_message_add_internet_message_id (JsonBuilder *builder,
+ const gchar *message_id)
+{
+ e_m365_json_add_nonempty_string_member (builder, "internetMessageId", message_id);
+}
+
+gboolean
+e_m365_mail_message_get_is_delivery_receipt_requested (EM365MailMessage *mail)
+{
+ return e_m365_json_get_boolean_member (mail, "isDeliveryReceiptRequested", FALSE);
+}
+
+void
+e_m365_mail_message_add_is_delivery_receipt_requested (JsonBuilder *builder,
+ gboolean value)
+{
+ e_m365_json_add_boolean_member (builder, "isDeliveryReceiptRequested", value);
+}
+
+gboolean
+e_m365_mail_message_get_is_draft (EM365MailMessage *mail)
+{
+ return e_m365_json_get_boolean_member (mail, "isDraft", FALSE);
+}
+
+gboolean
+e_m365_mail_message_get_is_read (EM365MailMessage *mail)
+{
+ return e_m365_json_get_boolean_member (mail, "isRead", FALSE);
+}
+
+void
+e_m365_mail_message_add_is_read (JsonBuilder *builder,
+ gboolean value)
+{
+ e_m365_json_add_boolean_member (builder, "isRead", value);
+}
+
+gboolean
+e_m365_mail_message_get_is_read_receipt_requested (EM365MailMessage *mail)
+{
+ return e_m365_json_get_boolean_member (mail, "isReadReceiptRequested", FALSE);
+}
+
+void
+e_m365_mail_message_add_is_read_receipt_requested (JsonBuilder *builder,
+ gboolean value)
+{
+ e_m365_json_add_boolean_member (builder, "isReadReceiptRequested", value);
+}
+
+time_t
+e_m365_mail_message_get_last_modified_date_time (EM365MailMessage *mail)
+{
+ return e_m365_get_date_time_offset_member (mail, "lastModifiedDateTime");
+}
+
+const gchar *
+e_m365_mail_message_get_parent_folder_id (EM365MailMessage *mail)
+{
+ return e_m365_json_get_string_member (mail, "parentFolderId", NULL);
+}
+
+time_t
+e_m365_mail_message_get_received_date_time (EM365MailMessage *mail)
+{
+ return e_m365_get_date_time_offset_member (mail, "receivedDateTime");
+}
+
+void
+e_m365_mail_message_add_received_date_time (JsonBuilder *builder,
+ time_t value)
+{
+ e_m365_add_date_time_offset_member (builder, "receivedDateTime", value);
+}
+
+JsonArray * /* EM365Recipient * */
+e_m365_mail_message_get_reply_to (EM365MailMessage *mail)
+{
+ return e_m365_json_get_array_member (mail, "replyTo");
+}
+
+void
+e_m365_mail_message_begin_reply_to (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "replyTo");
+}
+
+void
+e_m365_mail_message_end_reply_to (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+EM365Recipient *
+e_m365_mail_message_get_sender (EM365MailMessage *mail)
+{
+ return e_m365_json_get_object_member (mail, "sender");
+}
+
+void
+e_m365_mail_message_add_sender (JsonBuilder *builder,
+ const gchar *name,
+ const gchar *address)
+{
+ g_return_if_fail ((name && *name) || (address && *address));
+
+ e_m365_add_recipient (builder, "sender", name, address);
+}
+
+time_t
+e_m365_mail_message_get_sent_date_time (EM365MailMessage *mail)
+{
+ return e_m365_get_date_time_offset_member (mail, "sentDateTime");
+}
+
+void
+e_m365_mail_message_add_sent_date_time (JsonBuilder *builder,
+ time_t value)
+{
+ e_m365_add_date_time_offset_member (builder, "sentDateTime", value);
+}
+
+const gchar *
+e_m365_mail_message_get_subject (EM365MailMessage *mail)
+{
+ return e_m365_json_get_string_member (mail, "subject", NULL);
+}
+
+void
+e_m365_mail_message_add_subject (JsonBuilder *builder,
+ const gchar *subject)
+{
+ e_m365_json_add_nonempty_string_member (builder, "subject", subject);
+}
+
+JsonArray * /* EM365Recipient * */
+e_m365_mail_message_get_to_recipients (EM365MailMessage *mail)
+{
+ return e_m365_json_get_array_member (mail, "toRecipients");
+}
+
+void
+e_m365_mail_message_begin_to_recipients (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "toRecipients");
+}
+
+void
+e_m365_mail_message_end_to_recipients (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+EM365ItemBody *
+e_m365_mail_message_get_unique_body (EM365MailMessage *mail)
+{
+ return e_m365_json_get_object_member (mail, "uniqueBody");
+}
+
+const gchar *
+e_m365_mail_message_get_web_link (EM365MailMessage *mail)
+{
+ return e_m365_json_get_string_member (mail, "webLink", NULL);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/attachment?view=graph-rest-1.0 */
+
+EM365AttachmentDataType
+e_m365_attachment_get_data_type (EM365Attachment *attachment)
+{
+ return m365_json_utils_get_json_as_enum (attachment, "@odata.type",
+ attachment_data_type_map, G_N_ELEMENTS (attachment_data_type_map),
+ E_M365_ATTACHMENT_DATA_TYPE_NOT_SET,
+ E_M365_ATTACHMENT_DATA_TYPE_UNKNOWN);
+}
+
+void
+e_m365_attachment_begin_attachment (JsonBuilder *builder,
+ EM365AttachmentDataType data_type)
+{
+ e_m365_json_begin_object_member (builder, NULL);
+
+ m365_json_utils_add_enum_as_json (builder, "@odata.type", data_type,
+ attachment_data_type_map, G_N_ELEMENTS (attachment_data_type_map),
+ E_M365_ATTACHMENT_DATA_TYPE_NOT_SET,
+ E_M365_ATTACHMENT_DATA_TYPE_FILE);
+}
+
+void
+e_m365_attachment_end_attachment (JsonBuilder *builder)
+{
+ e_m365_json_end_object_member (builder);
+}
+
+const gchar *
+e_m365_attachment_get_content_type (EM365Attachment *attachment)
+{
+ return e_m365_json_get_string_member (attachment, "contentType", NULL);
+}
+
+void
+e_m365_attachment_add_content_type (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_string_member (builder, "contentType", value);
+}
+
+const gchar *
+e_m365_attachment_get_id (EM365Attachment *attachment)
+{
+ return e_m365_json_get_string_member (attachment, "id", NULL);
+}
+
+gboolean
+e_m365_attachment_get_is_inline (EM365Attachment *attachment)
+{
+ return e_m365_json_get_boolean_member (attachment, "isInline", FALSE);
+}
+
+void
+e_m365_attachment_add_is_inline (JsonBuilder *builder,
+ gboolean value)
+{
+ e_m365_json_add_boolean_member (builder, "isInline", value);
+}
+
+time_t
+e_m365_attachment_get_last_modified_date_time (EM365Attachment *attachment)
+{
+ return e_m365_get_date_time_offset_member (attachment, "lastModifiedDateTime");
+}
+
+void
+e_m365_attachment_add_last_modified_date_time (JsonBuilder *builder,
+ time_t value)
+{
+ e_m365_add_date_time_offset_member (builder, "lastModifiedDateTime", value);
+}
+
+const gchar *
+e_m365_attachment_get_name (EM365Attachment *attachment)
+{
+ return e_m365_json_get_string_member (attachment, "name", NULL);
+}
+
+void
+e_m365_attachment_add_name (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_string_member (builder, "name", value);
+}
+
+gint32
+e_m365_attachment_get_size (EM365Attachment *attachment)
+{
+ return (gint32) e_m365_json_get_int_member (attachment, "size", -1);
+}
+
+void
+e_m365_attachment_add_size (JsonBuilder *builder,
+ gint32 value)
+{
+ e_m365_json_add_int_member (builder, "size", value);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/fileattachment?view=graph-rest-1.0 */
+
+const gchar * /* base64-encoded */
+e_m365_file_attachment_get_content_bytes (EM365Attachment *attachment)
+{
+ return e_m365_json_get_string_member (attachment, "contentBytes", NULL);
+}
+
+void
+e_m365_file_attachment_add_content_bytes (JsonBuilder *builder,
+ const gchar *base64_value)
+{
+ e_m365_json_add_string_member (builder, "contentBytes", base64_value);
+}
+
+const gchar *
+e_m365_file_attachment_get_content_id (EM365Attachment *attachment)
+{
+ return e_m365_json_get_string_member (attachment, "contentId", NULL);
+}
+
+void
+e_m365_file_attachment_add_content_id (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_string_member (builder, "contentId", value);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/emailaddress?view=graph-rest-1.0 */
+
+const gchar *
+e_m365_email_address_get_name (EM365EmailAddress *email)
+{
+ return e_m365_json_get_string_member (email, "name", NULL);
+}
+
+const gchar *
+e_m365_email_address_get_address (EM365EmailAddress *email)
+{
+ return e_m365_json_get_string_member (email, "address", NULL);
+}
+
+void
+e_m365_add_email_address (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *name,
+ const gchar *address)
+{
+ g_return_if_fail ((name && *name) || (address && *address));
+
+ e_m365_json_begin_object_member (builder, member_name);
+
+ e_m365_json_add_nonempty_string_member (builder, "name", name);
+ e_m365_json_add_nonempty_string_member (builder, "address", address);
+
+ e_m365_json_end_object_member (builder); /* member_name */
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/physicaladdress?view=graph-rest-1.0 */
+
+const gchar *
+e_m365_physical_address_get_city (EM365PhysicalAddress *address)
+{
+ return e_m365_json_get_string_member (address, "city", NULL);
+}
+
+const gchar *
+e_m365_physical_address_get_country_or_region (EM365PhysicalAddress *address)
+{
+ return e_m365_json_get_string_member (address, "countryOrRegion", NULL);
+}
+
+const gchar *
+e_m365_physical_address_get_postal_code (EM365PhysicalAddress *address)
+{
+ return e_m365_json_get_string_member (address, "postalCode", NULL);
+}
+
+const gchar *
+e_m365_physical_address_get_state (EM365PhysicalAddress *address)
+{
+ return e_m365_json_get_string_member (address, "state", NULL);
+}
+
+const gchar *
+e_m365_physical_address_get_street (EM365PhysicalAddress *address)
+{
+ return e_m365_json_get_string_member (address, "street", NULL);
+}
+
+void
+e_m365_add_physical_address (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *city,
+ const gchar *country_or_region,
+ const gchar *postal_code,
+ const gchar *state,
+ const gchar *street)
+{
+ if ((city && *city) ||
+ (country_or_region && *country_or_region) ||
+ (postal_code && *postal_code) ||
+ (state && *state) ||
+ (street && *street)) {
+ e_m365_json_begin_object_member (builder, member_name);
+ e_m365_json_add_nonempty_string_member (builder, "city", city);
+ e_m365_json_add_nonempty_string_member (builder, "countryOrRegion", country_or_region);
+ e_m365_json_add_nonempty_string_member (builder, "postalCode", postal_code);
+ e_m365_json_add_nonempty_string_member (builder, "state", state);
+ e_m365_json_add_nonempty_string_member (builder, "street", street);
+ e_m365_json_end_object_member (builder);
+ } else {
+ e_m365_json_begin_object_member (builder, member_name);
+ e_m365_json_end_object_member (builder);
+ }
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/contact?view=graph-rest-1.0 */
+
+const gchar *
+e_m365_contact_get_id (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "id", NULL);
+}
+
+const gchar *
+e_m365_contact_get_parent_folder_id (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "parentFolderId", NULL);
+}
+
+const gchar *
+e_m365_contact_get_change_key (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "changeKey", NULL);
+}
+
+time_t
+e_m365_contact_get_created_date_time (EM365Contact *contact)
+{
+ return e_m365_get_date_time_offset_member (contact, "createdDateTime");
+}
+
+time_t
+e_m365_contact_get_last_modified_date_time (EM365Contact *contact)
+{
+ return e_m365_get_date_time_offset_member (contact, "lastModifiedDateTime");
+}
+
+const gchar *
+e_m365_contact_get_assistant_name (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "assistantName", NULL);
+}
+
+void
+e_m365_contact_add_assistant_name (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "assistantName", value);
+}
+
+time_t
+e_m365_contact_get_birthday (EM365Contact *contact)
+{
+ return e_m365_get_date_time_offset_member (contact, "birthday");
+}
+
+void
+e_m365_contact_add_birthday (JsonBuilder *builder,
+ time_t value)
+{
+ e_m365_add_date_time_offset_member (builder, "birthday", value);
+}
+
+EM365PhysicalAddress *
+e_m365_contact_get_business_address (EM365Contact *contact)
+{
+ return e_m365_json_get_object_member (contact, "businessAddress");
+}
+
+void
+e_m365_contact_add_business_address (JsonBuilder *builder,
+ const gchar *city,
+ const gchar *country_or_region,
+ const gchar *postal_code,
+ const gchar *state,
+ const gchar *street)
+{
+ e_m365_add_physical_address (builder, "businessAddress", city, country_or_region, postal_code, state,
street);
+}
+
+const gchar *
+e_m365_contact_get_business_home_page (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "businessHomePage", NULL);
+}
+
+void
+e_m365_contact_add_business_home_page (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "businessHomePage", value);
+}
+
+JsonArray * /* const gchar * */
+e_m365_contact_get_business_phones (EM365Contact *contact)
+{
+ return e_m365_json_get_array_member (contact, "businessPhones");
+}
+
+void
+e_m365_contact_begin_business_phones (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "businessPhones");
+}
+
+void
+e_m365_contact_end_business_phones (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+void
+e_m365_contact_add_business_phone (JsonBuilder *builder,
+ const gchar *value)
+{
+ g_return_if_fail (value && *value);
+
+ json_builder_add_string_value (builder, value);
+}
+
+JsonArray * /* const gchar * */
+e_m365_contact_get_categories (EM365Contact *contact)
+{
+ return e_m365_json_get_array_member (contact, "categories");
+}
+
+void
+e_m365_contact_begin_categories (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "categories");
+}
+
+void
+e_m365_contact_end_categories (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+void
+e_m365_contact_add_category (JsonBuilder *builder,
+ const gchar *category)
+{
+ g_return_if_fail (category && *category);
+
+ json_builder_add_string_value (builder, category);
+}
+
+JsonArray * /* const gchar * */
+e_m365_contact_get_children (EM365Contact *contact)
+{
+ return e_m365_json_get_array_member (contact, "children");
+}
+
+void
+e_m365_contact_begin_children (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "children");
+}
+
+void
+e_m365_contact_end_children (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+void
+e_m365_contact_add_child (JsonBuilder *builder,
+ const gchar *value)
+{
+ g_return_if_fail (value && *value);
+
+ json_builder_add_string_value (builder, value);
+}
+
+const gchar *
+e_m365_contact_get_company_name (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "companyName", NULL);
+}
+
+void
+e_m365_contact_add_company_name (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "companyName", value);
+}
+
+const gchar *
+e_m365_contact_get_department (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "department", NULL);
+}
+
+void
+e_m365_contact_add_department (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "department", value);
+}
+
+const gchar *
+e_m365_contact_get_display_name (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "displayName", NULL);
+}
+
+void
+e_m365_contact_add_display_name (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "displayName", value);
+}
+
+JsonArray * /* EM365EmailAddress * */
+e_m365_contact_get_email_addresses (EM365Contact *contact)
+{
+ return e_m365_json_get_array_member (contact, "emailAddresses");
+}
+
+void
+e_m365_contact_begin_email_addresses (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "emailAddresses");
+}
+
+void
+e_m365_contact_end_email_addresses (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+const gchar *
+e_m365_contact_get_file_as (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "fileAs", NULL);
+}
+
+void
+e_m365_contact_add_file_as (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "fileAs", value);
+}
+
+const gchar *
+e_m365_contact_get_generation (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "generation", NULL);
+}
+
+void
+e_m365_contact_add_generation (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "generation", value);
+}
+
+const gchar *
+e_m365_contact_get_given_name (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "givenName", NULL);
+}
+
+void
+e_m365_contact_add_given_name (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "givenName", value);
+}
+
+EM365PhysicalAddress *
+e_m365_contact_get_home_address (EM365Contact *contact)
+{
+ return e_m365_json_get_object_member (contact, "homeAddress");
+}
+
+void
+e_m365_contact_add_home_address (JsonBuilder *builder,
+ const gchar *city,
+ const gchar *country_or_region,
+ const gchar *postal_code,
+ const gchar *state,
+ const gchar *street)
+{
+ e_m365_add_physical_address (builder, "homeAddress", city, country_or_region, postal_code, state,
street);
+}
+
+JsonArray * /* const gchar * */
+e_m365_contact_get_home_phones (EM365Contact *contact)
+{
+ return e_m365_json_get_array_member (contact, "homePhones");
+}
+
+void
+e_m365_contact_begin_home_phones (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "homePhones");
+}
+
+void
+e_m365_contact_end_home_phones (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+void
+e_m365_contact_add_home_phone (JsonBuilder *builder,
+ const gchar *value)
+{
+ g_return_if_fail (value && *value);
+
+ json_builder_add_string_value (builder, value);
+}
+
+JsonArray * /* const gchar * */
+e_m365_contact_get_im_addresses (EM365Contact *contact)
+{
+ return e_m365_json_get_array_member (contact, "imAddresses");
+}
+
+void
+e_m365_contact_begin_im_addresses (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "imAddresses");
+}
+
+void
+e_m365_contact_end_im_addresses (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+void
+e_m365_contact_add_im_address (JsonBuilder *builder,
+ const gchar *value)
+{
+ g_return_if_fail (value && *value);
+
+ json_builder_add_string_value (builder, value);
+}
+
+const gchar *
+e_m365_contact_get_initials (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "initials", NULL);
+}
+
+void
+e_m365_contact_add_initials (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "initials", value);
+}
+
+const gchar *
+e_m365_contact_get_job_title (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "jobTitle", NULL);
+}
+
+void
+e_m365_contact_add_job_title (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "jobTitle", value);
+}
+
+const gchar *
+e_m365_contact_get_manager (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "manager", NULL);
+}
+
+void
+e_m365_contact_add_manager (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "manager", value);
+}
+
+const gchar *
+e_m365_contact_get_middle_name (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "middleName", NULL);
+}
+
+void
+e_m365_contact_add_middle_name (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "middleName", value);
+}
+
+const gchar *
+e_m365_contact_get_mobile_phone (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "mobilePhone", NULL);
+}
+
+void
+e_m365_contact_add_mobile_phone (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "mobilePhone", value);
+}
+
+const gchar *
+e_m365_contact_get_nick_name (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "nickName", NULL);
+}
+
+void
+e_m365_contact_add_nick_name (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "nickName", value);
+}
+
+const gchar *
+e_m365_contact_get_office_location (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "officeLocation", NULL);
+}
+
+void
+e_m365_contact_add_office_location (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "officeLocation", value);
+}
+
+EM365PhysicalAddress *
+e_m365_contact_get_other_address (EM365Contact *contact)
+{
+ return e_m365_json_get_object_member (contact, "otherAddress");
+}
+
+void
+e_m365_contact_add_other_address (JsonBuilder *builder,
+ const gchar *city,
+ const gchar *country_or_region,
+ const gchar *postal_code,
+ const gchar *state,
+ const gchar *street)
+{
+ e_m365_add_physical_address (builder, "otherAddress", city, country_or_region, postal_code, state,
street);
+}
+
+const gchar *
+e_m365_contact_get_personal_notes (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "personalNotes", NULL);
+}
+
+void
+e_m365_contact_add_personal_notes (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "personalNotes", value);
+}
+
+const gchar *
+e_m365_contact_get_profession (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "profession", NULL);
+}
+
+void
+e_m365_contact_add_profession (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "profession", value);
+}
+
+const gchar *
+e_m365_contact_get_spouse_name (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "spouseName", NULL);
+}
+
+void
+e_m365_contact_add_spouse_name (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "spouseName", value);
+}
+
+const gchar *
+e_m365_contact_get_surname (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "surname", NULL);
+}
+
+void
+e_m365_contact_add_surname (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "surname", value);
+}
+
+const gchar *
+e_m365_contact_get_title (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "title", NULL);
+}
+
+void
+e_m365_contact_add_title (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "title", value);
+}
+
+const gchar *
+e_m365_contact_get_yomi_company_name (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "yomiCompanyName", NULL);
+}
+
+void
+e_m365_contact_add_yomi_company_name (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "yomiCompanyName", value);
+}
+
+const gchar *
+e_m365_contact_get_yomi_given_name (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "yomiGivenName", NULL);
+}
+
+void
+e_m365_contact_add_yomi_given_name (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "yomiGivenName", value);
+}
+
+const gchar *
+e_m365_contact_get_yomi_surname (EM365Contact *contact)
+{
+ return e_m365_json_get_string_member (contact, "yomiSurname", NULL);
+}
+
+void
+e_m365_contact_add_yomi_surname (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "yomiSurname", value);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/calendargroup?view=graph-rest-1.0 */
+
+const gchar *
+e_m365_calendar_group_get_id (EM365CalendarGroup *group)
+{
+ return e_m365_json_get_string_member (group, "id", NULL);
+}
+
+const gchar *
+e_m365_calendar_group_get_change_key (EM365CalendarGroup *group)
+{
+ return e_m365_json_get_string_member (group, "changeKey", NULL);
+}
+
+const gchar *
+e_m365_calendar_group_get_class_id (EM365CalendarGroup *group)
+{
+ return e_m365_json_get_string_member (group, "classId", NULL);
+}
+
+const gchar *
+e_m365_calendar_group_get_name (EM365CalendarGroup *group)
+{
+ return e_m365_json_get_string_member (group, "name", NULL);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/calendar?view=graph-rest-1.0 */
+
+const gchar *
+e_m365_calendar_get_id (EM365Calendar *calendar)
+{
+ return e_m365_json_get_string_member (calendar, "id", NULL);
+}
+
+const gchar *
+e_m365_calendar_get_change_key (EM365Calendar *calendar)
+{
+ return e_m365_json_get_string_member (calendar, "changeKey", NULL);
+}
+
+gboolean
+e_m365_calendar_get_can_edit (EM365Calendar *calendar)
+{
+ return e_m365_json_get_boolean_member (calendar, "canEdit", FALSE);
+}
+
+gboolean
+e_m365_calendar_get_can_share (EM365Calendar *calendar)
+{
+ return e_m365_json_get_boolean_member (calendar, "canShare", FALSE);
+}
+
+gboolean
+e_m365_calendar_get_can_view_private_items (EM365Calendar *calendar)
+{
+ return e_m365_json_get_boolean_member (calendar, "canViewPrivateItems", FALSE);
+}
+
+gboolean
+e_m365_calendar_get_is_removable (EM365Calendar *calendar)
+{
+ return e_m365_json_get_boolean_member (calendar, "isRemovable", FALSE);
+}
+
+gboolean
+e_m365_calendar_get_is_tallying_responses (EM365Calendar *calendar)
+{
+ return e_m365_json_get_boolean_member (calendar, "isTallyingResponses", FALSE);
+}
+
+EM365EmailAddress *
+e_m365_calendar_get_owner (EM365Calendar *calendar)
+{
+ return e_m365_json_get_object_member (calendar, "owner");
+}
+
+const gchar *
+e_m365_calendar_get_name (EM365Calendar *calendar)
+{
+ return e_m365_json_get_string_member (calendar, "name", NULL);
+}
+
+void
+e_m365_calendar_add_name (JsonBuilder *builder,
+ const gchar *name)
+{
+ e_m365_json_add_nonempty_string_member (builder, "name", name);
+}
+
+guint32 /* bit-or of EM365OnlineMeetingProviderType */
+e_m365_calendar_get_allowed_online_meeting_providers (EM365Calendar *calendar)
+{
+ guint32 providers = E_M365_ONLINE_MEETING_PROVIDER_NOT_SET;
+ JsonArray *array;
+
+ array = e_m365_json_get_array_member (calendar, "allowedOnlineMeetingProviders");
+
+ if (array) {
+ guint ii, len;
+
+ providers = E_M365_ONLINE_MEETING_PROVIDER_UNKNOWN;
+
+ len = json_array_get_length (array);
+
+ for (ii = 0; ii < len; ii++) {
+ const gchar *str = json_array_get_string_element (array, ii);
+ gint enum_value;
+
+ if (!str)
+ continue;
+
+ enum_value = m365_json_utils_json_value_as_enum (str,
+ meeting_provider_map, G_N_ELEMENTS (meeting_provider_map),
+ E_M365_ONLINE_MEETING_PROVIDER_NOT_SET,
+ E_M365_ONLINE_MEETING_PROVIDER_UNKNOWN);
+
+ if (enum_value != E_M365_ONLINE_MEETING_PROVIDER_NOT_SET)
+ providers |= enum_value;
+ }
+ }
+
+ return providers;
+}
+
+void
+e_m365_calendar_add_allowed_online_meeting_providers (JsonBuilder *builder,
+ guint providers) /* bit-or of
EM365OnlineMeetingProviderType */
+{
+ gint ii;
+
+ if (providers == E_M365_ONLINE_MEETING_PROVIDER_NOT_SET)
+ return;
+
+ e_m365_json_begin_array_member (builder, "allowedOnlineMeetingProviders");
+
+ if (providers == E_M365_ONLINE_MEETING_PROVIDER_UNKNOWN)
+ json_builder_add_string_value (builder, "unknown");
+
+ for (ii = 0; ii < G_N_ELEMENTS (meeting_provider_map); ii++) {
+ if ((providers & meeting_provider_map[ii].enum_value) != 0)
+ json_builder_add_string_value (builder, meeting_provider_map[ii].json_value);
+ }
+
+ e_m365_json_end_array_member (builder);
+}
+
+EM365CalendarColorType
+e_m365_calendar_get_color (EM365Calendar *calendar)
+{
+ const gchar *color;
+ gint ii;
+
+ color = e_m365_json_get_string_member (calendar, "color", NULL);
+
+ if (!color)
+ return E_M365_CALENDAR_COLOR_NOT_SET;
+
+ for (ii = 0; ii < G_N_ELEMENTS (color_map); ii++) {
+ if (g_ascii_strcasecmp (color_map[ii].name, color) == 0)
+ return color_map[ii].value;
+ }
+
+ return E_M365_CALENDAR_COLOR_UNKNOWN;
+}
+
+void
+e_m365_calendar_add_color (JsonBuilder *builder,
+ EM365CalendarColorType color)
+{
+ const gchar *name = NULL;
+ gint ii;
+
+ for (ii = 0; ii < G_N_ELEMENTS (color_map); ii++) {
+ if (color_map[ii].value == color) {
+ name = color_map[ii].name;
+ break;
+ }
+ }
+
+ if (name && g_ascii_strcasecmp (name, "maxColor") != 0)
+ e_m365_json_add_string_member (builder, "color", name);
+}
+
+EM365OnlineMeetingProviderType
+e_m365_calendar_get_default_online_meeting_provider (EM365Calendar *calendar)
+{
+ return m365_json_utils_get_json_as_enum (calendar, "defaultOnlineMeetingProvider",
+ meeting_provider_map, G_N_ELEMENTS (meeting_provider_map),
+ E_M365_ONLINE_MEETING_PROVIDER_NOT_SET,
+ E_M365_ONLINE_MEETING_PROVIDER_UNKNOWN);
+}
+
+void
+e_m365_calendar_add_default_online_meeting_provider (JsonBuilder *builder,
+ EM365OnlineMeetingProviderType provider)
+{
+ m365_json_utils_add_enum_as_json (builder, "defaultOnlineMeetingProvider", provider,
+ meeting_provider_map, G_N_ELEMENTS (meeting_provider_map),
+ E_M365_ONLINE_MEETING_PROVIDER_NOT_SET,
+ E_M365_ONLINE_MEETING_PROVIDER_UNKNOWN);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/responsestatus?view=graph-rest-1.0 */
+
+EM365ResponseType
+e_m365_response_status_get_response (EM365ResponseStatus *response_status)
+{
+ return m365_json_utils_get_json_as_enum (response_status, "response",
+ response_map, G_N_ELEMENTS (response_map),
+ E_M365_RESPONSE_NOT_SET,
+ E_M365_RESPONSE_UNKNOWN);
+}
+
+time_t
+e_m365_response_status_get_time (EM365ResponseStatus *response_status)
+{
+ return e_m365_get_date_time_offset_member (response_status, "time");
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/attendee?view=graph-rest-1.0 */
+
+EM365ResponseStatus *
+e_m365_attendee_get_status (EM365Attendee *attendee)
+{
+ return e_m365_json_get_object_member (attendee, "status");
+}
+
+EM365AttendeeType
+e_m365_attendee_get_type (EM365Attendee *attendee)
+{
+ return m365_json_utils_get_json_as_enum (attendee, "type",
+ attendee_map, G_N_ELEMENTS (attendee_map),
+ E_M365_ATTENDEE_NOT_SET,
+ E_M365_ATTENDEE_UNKNOWN);
+}
+
+EM365EmailAddress *
+e_m365_attendee_get_email_address (EM365Attendee *attendee)
+{
+ return e_m365_json_get_object_member (attendee, "emailAddress");
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/outlookgeocoordinates?view=graph-rest-1.0 */
+
+gdouble
+e_m365_outlook_geo_coordinates_get_accuracy (EM365OutlookGeoCoordinates *coords)
+{
+ return e_m365_json_get_double_member (coords, "accuracy", 0.0);
+}
+
+void
+e_m365_outlook_geo_coordinates_add_accuracy (JsonBuilder *builder,
+ gdouble value)
+{
+ e_m365_json_add_double_member (builder, "accuracy", value);
+}
+
+gdouble
+e_m365_outlook_geo_coordinates_get_altitude (EM365OutlookGeoCoordinates *coords)
+{
+ return e_m365_json_get_double_member (coords, "altitude", 0.0);
+}
+
+void
+e_m365_outlook_geo_coordinates_add_altitude (JsonBuilder *builder,
+ gdouble value)
+{
+ e_m365_json_add_double_member (builder, "altitude", value);
+}
+
+gdouble
+e_m365_outlook_geo_coordinates_get_altitude_accuracy (EM365OutlookGeoCoordinates *coords)
+{
+ return e_m365_json_get_double_member (coords, "altitudeAccuracy", 0.0);
+}
+
+void
+e_m365_outlook_geo_coordinates_add_altitude_accuracy (JsonBuilder *builder,
+ gdouble value)
+{
+ e_m365_json_add_double_member (builder, "altitudeAccuracy", value);
+}
+
+gdouble
+e_m365_outlook_geo_coordinates_get_latitude (EM365OutlookGeoCoordinates *coords)
+{
+ return e_m365_json_get_double_member (coords, "latitude", 0.0);
+}
+
+void
+e_m365_outlook_geo_coordinates_add_latitude (JsonBuilder *builder,
+ gdouble value)
+{
+ e_m365_json_add_double_member (builder, "latitude", value);
+}
+
+gdouble
+e_m365_outlook_geo_coordinates_get_longitude (EM365OutlookGeoCoordinates *coords)
+{
+ return e_m365_json_get_double_member (coords, "longitude", 0.0);
+}
+
+void
+e_m365_outlook_geo_coordinates_add_longitude (JsonBuilder *builder,
+ gdouble value)
+{
+ e_m365_json_add_double_member (builder, "longitude", value);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/location?view=graph-rest-1.0 */
+
+EM365PhysicalAddress *
+e_m365_location_get_address (EM365Location *location)
+{
+ return e_m365_json_get_object_member (location, "address");
+}
+
+void
+e_m365_location_add_address (JsonBuilder *builder,
+ const gchar *city,
+ const gchar *country_or_region,
+ const gchar *postal_code,
+ const gchar *state,
+ const gchar *street)
+{
+ e_m365_add_physical_address (builder, "address", city, country_or_region, postal_code, state, street);
+}
+
+EM365OutlookGeoCoordinates *
+e_m365_location_get_coordinates (EM365Location *location)
+{
+ return e_m365_json_get_object_member (location, "coordinates");
+}
+
+void
+e_m365_location_begin_coordinates (JsonBuilder *builder)
+{
+ e_m365_json_begin_object_member (builder, "coordinates");
+}
+
+void
+e_m365_location_end_coordinates (JsonBuilder *builder)
+{
+ e_m365_json_end_object_member (builder);
+}
+
+const gchar *
+e_m365_location_get_display_name (EM365Location *location)
+{
+ return e_m365_json_get_string_member (location, "displayName", NULL);
+}
+
+void
+e_m365_location_add_display_name (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "displayName", value);
+}
+
+const gchar *
+e_m365_location_get_email_address (EM365Location *location)
+{
+ return e_m365_json_get_string_member (location, "locationEmailAddress", NULL);
+}
+
+void
+e_m365_location_add_email_address (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "locationEmailAddress", value);
+}
+
+const gchar *
+e_m365_location_get_uri (EM365Location *location)
+{
+ return e_m365_json_get_string_member (location, "locationUri", NULL);
+}
+
+void
+e_m365_location_add_uri (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_nonempty_or_null_string_member (builder, "locationUri", value);
+}
+
+EM365LocationType
+e_m365_location_get_type (EM365Location *location)
+{
+ return m365_json_utils_get_json_as_enum (location, "locationType",
+ location_type_map, G_N_ELEMENTS (location_type_map),
+ E_M365_LOCATION_NOT_SET,
+ E_M365_LOCATION_UNKNOWN);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/phone?view=graph-rest-1.0 */
+
+const gchar *
+e_m365_phone_get_number (EM365Phone *phone)
+{
+ return e_m365_json_get_string_member (phone, "number", NULL);
+}
+
+EM365PhoneType
+e_m365_phone_get_type (EM365Phone *phone)
+{
+ return m365_json_utils_get_json_as_enum (phone, "type",
+ phone_map, G_N_ELEMENTS (phone_map),
+ E_M365_PHONE_NOT_SET,
+ E_M365_PHONE_UNKNOWN);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/onlinemeetinginfo?view=graph-rest-1.0 */
+
+const gchar *
+e_m365_online_meeting_info_get_conference_id (EM365OnlineMeetingInfo *meeting_info)
+{
+ return e_m365_json_get_string_member (meeting_info, "conferenceId", NULL);
+}
+
+const gchar *
+e_m365_online_meeting_info_get_join_url (EM365OnlineMeetingInfo *meeting_info)
+{
+ return e_m365_json_get_string_member (meeting_info, "joinUrl", NULL);
+}
+
+JsonArray * /* EM365Phone * */
+e_m365_online_meeting_info_get_phones (EM365OnlineMeetingInfo *meeting_info)
+{
+ return e_m365_json_get_array_member (meeting_info, "phones");
+}
+
+const gchar *
+e_m365_online_meeting_info_get_quick_dial (EM365OnlineMeetingInfo *meeting_info)
+{
+ return e_m365_json_get_string_member (meeting_info, "quickDial", NULL);
+}
+
+JsonArray * /* gchar * */
+e_m365_online_meeting_info_get_toll_free_numbers (EM365OnlineMeetingInfo *meeting_info)
+{
+ return e_m365_json_get_array_member (meeting_info, "tollFreeNumbers");
+}
+
+const gchar *
+e_m365_online_meeting_info_get_toll_number (EM365OnlineMeetingInfo *meeting_info)
+{
+ return e_m365_json_get_string_member (meeting_info, "tollNumber", NULL);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/patternedrecurrence?view=graph-rest-1.0 */
+
+EM365RecurrencePattern *
+e_m365_patterned_recurrence_get_pattern (EM365PatternedRecurrence *patterned_recurrence)
+{
+ return e_m365_json_get_object_member (patterned_recurrence, "pattern");
+}
+
+void
+e_m365_patterned_recurrence_begin_pattern (JsonBuilder *builder)
+{
+ e_m365_json_begin_object_member (builder, "pattern");
+}
+
+void
+e_m365_patterned_recurrence_end_pattern (JsonBuilder *builder)
+{
+ e_m365_json_end_object_member (builder);
+}
+
+EM365RecurrenceRange *
+e_m365_patterned_recurrence_get_range (EM365PatternedRecurrence *patterned_recurrence)
+{
+ return e_m365_json_get_object_member (patterned_recurrence, "range");
+}
+
+void
+e_m365_patterned_recurrence_begin_range (JsonBuilder *builder)
+{
+ e_m365_json_begin_object_member (builder, "range");
+}
+
+void
+e_m365_patterned_recurrence_end_range (JsonBuilder *builder)
+{
+ e_m365_json_end_object_member (builder);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/recurrencepattern?view=graph-rest-1.0 */
+
+EM365DayOfWeekType
+e_m365_array_get_day_of_week_element (JsonArray *array, /* const gchar * representing EM365DayOfWeekType */
+ guint index)
+{
+ return m365_json_utils_json_value_as_enum (json_array_get_string_element (array, index),
+ day_of_week_map, G_N_ELEMENTS (day_of_week_map),
+ E_M365_DAY_OF_WEEK_NOT_SET,
+ E_M365_DAY_OF_WEEK_UNKNOWN);
+}
+
+gint
+e_m365_recurrence_pattern_get_day_of_month (EM365RecurrencePattern *pattern)
+{
+ return e_m365_json_get_int_member (pattern, "dayOfMonth", 0);
+}
+
+void
+e_m365_recurrence_pattern_add_day_of_month (JsonBuilder *builder,
+ gint value)
+{
+ e_m365_json_add_int_member (builder, "dayOfMonth", value);
+}
+
+JsonArray * /* const gchar * representing EM365DayOfWeekType, use e_m365_array_get_day_of_week_element() */
+e_m365_recurrence_pattern_get_days_of_week (EM365RecurrencePattern *pattern)
+{
+ return e_m365_json_get_array_member (pattern, "daysOfWeek");
+}
+
+void
+e_m365_recurrence_pattern_begin_days_of_week (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "daysOfWeek");
+}
+
+void
+e_m365_recurrence_pattern_end_days_of_week (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+void
+e_m365_recurrence_pattern_add_day_of_week (JsonBuilder *builder,
+ EM365DayOfWeekType value)
+{
+ m365_json_utils_add_enum_as_json (builder, NULL, value,
+ day_of_week_map, G_N_ELEMENTS (day_of_week_map),
+ E_M365_DAY_OF_WEEK_NOT_SET,
+ E_M365_DAY_OF_WEEK_NOT_SET);
+}
+
+EM365DayOfWeekType
+e_m365_recurrence_pattern_get_first_day_of_week (EM365RecurrencePattern *pattern)
+{
+ return m365_json_utils_get_json_as_enum (pattern, "firstDayOfWeek",
+ day_of_week_map, G_N_ELEMENTS (day_of_week_map),
+ E_M365_DAY_OF_WEEK_NOT_SET,
+ E_M365_DAY_OF_WEEK_UNKNOWN);
+}
+
+void
+e_m365_recurrence_pattern_add_first_day_of_week (JsonBuilder *builder,
+ EM365DayOfWeekType value)
+{
+ m365_json_utils_add_enum_as_json (builder, "firstDayOfWeek", value,
+ day_of_week_map, G_N_ELEMENTS (day_of_week_map),
+ E_M365_DAY_OF_WEEK_NOT_SET,
+ E_M365_DAY_OF_WEEK_NOT_SET);
+}
+
+EM365WeekIndexType
+e_m365_recurrence_pattern_get_index (EM365RecurrencePattern *pattern)
+{
+ return m365_json_utils_get_json_as_enum (pattern, "index",
+ week_index_map, G_N_ELEMENTS (week_index_map),
+ E_M365_WEEK_INDEX_NOT_SET,
+ E_M365_WEEK_INDEX_UNKNOWN);
+}
+
+void
+e_m365_recurrence_pattern_add_index (JsonBuilder *builder,
+ EM365WeekIndexType value)
+{
+ m365_json_utils_add_enum_as_json (builder, "index", value,
+ week_index_map, G_N_ELEMENTS (week_index_map),
+ E_M365_WEEK_INDEX_NOT_SET,
+ E_M365_WEEK_INDEX_NOT_SET);
+}
+
+gint
+e_m365_recurrence_pattern_get_interval (EM365RecurrencePattern *pattern)
+{
+ return e_m365_json_get_int_member (pattern, "interval", -1);
+}
+
+void
+e_m365_recurrence_pattern_add_interval (JsonBuilder *builder,
+ gint value)
+{
+ e_m365_json_add_int_member (builder, "interval", value);
+}
+
+gint
+e_m365_recurrence_pattern_get_month (EM365RecurrencePattern *pattern)
+{
+ return e_m365_json_get_int_member (pattern, "month", -1);
+}
+
+void
+e_m365_recurrence_pattern_add_month (JsonBuilder *builder,
+ gint value)
+{
+ e_m365_json_add_int_member (builder, "month", value);
+}
+
+EM365RecurrencePatternType
+e_m365_recurrence_pattern_get_type (EM365RecurrencePattern *pattern)
+{
+ return m365_json_utils_get_json_as_enum (pattern, "type",
+ recurrence_pattern_map, G_N_ELEMENTS (recurrence_pattern_map),
+ E_M365_RECURRENCE_PATTERN_NOT_SET,
+ E_M365_RECURRENCE_PATTERN_UNKNOWN);
+}
+
+void
+e_m365_recurrence_pattern_add_type (JsonBuilder *builder,
+ EM365RecurrencePatternType value)
+{
+ m365_json_utils_add_enum_as_json (builder, "type", value,
+ recurrence_pattern_map, G_N_ELEMENTS (recurrence_pattern_map),
+ E_M365_RECURRENCE_PATTERN_NOT_SET,
+ E_M365_RECURRENCE_PATTERN_UNKNOWN);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/recurrencerange?view=graph-rest-1.0 */
+
+EM365Date
+e_m365_recurrence_range_get_end_date (EM365RecurrenceRange *range)
+{
+ return e_m365_date_get (range, "endDate");
+}
+
+void
+e_m365_recurrence_range_add_end_date (JsonBuilder *builder,
+ EM365Date value)
+{
+ e_m365_add_date (builder, "endDate", value);
+}
+
+gint
+e_m365_recurrence_range_get_number_of_occurrences (EM365RecurrenceRange *range)
+{
+ return e_m365_json_get_int_member (range, "numberOfOccurrences", -1);
+}
+
+void
+e_m365_recurrence_range_add_number_of_occurrences (JsonBuilder *builder,
+ gint value)
+{
+ e_m365_json_add_int_member (builder, "numberOfOccurrences", value);
+}
+
+const gchar *
+e_m365_recurrence_range_get_recurrence_time_zone (EM365RecurrenceRange *range)
+{
+ return e_m365_json_get_string_member (range, "recurrenceTimeZone", NULL);
+}
+
+void
+e_m365_recurrence_range_add_recurrence_time_zone (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_string_member (builder, "recurrenceTimeZone", value);
+}
+
+EM365Date
+e_m365_recurrence_range_get_start_date (EM365RecurrenceRange *range)
+{
+ return e_m365_date_get (range, "startDate");
+}
+
+void
+e_m365_recurrence_range_add_start_date (JsonBuilder *builder,
+ EM365Date value)
+{
+ e_m365_add_date (builder, "startDate", value);
+}
+
+EM365RecurrenceRangeType
+e_m365_recurrence_range_get_type (EM365RecurrenceRange *range)
+{
+ return m365_json_utils_get_json_as_enum (range, "type",
+ recurrence_range_map, G_N_ELEMENTS (recurrence_range_map),
+ E_M365_RECURRENCE_RANGE_NOT_SET,
+ E_M365_RECURRENCE_RANGE_UNKNOWN);
+}
+
+void
+e_m365_recurrence_range_add_type (JsonBuilder *builder,
+ EM365RecurrenceRangeType value)
+{
+ m365_json_utils_add_enum_as_json (builder, "type", value,
+ recurrence_range_map, G_N_ELEMENTS (recurrence_range_map),
+ E_M365_RECURRENCE_RANGE_NOT_SET,
+ E_M365_RECURRENCE_RANGE_UNKNOWN);
+}
+
+/* https://docs.microsoft.com/en-us/graph/api/resources/event?view=graph-rest-1.0 */
+
+const gchar *
+e_m365_event_get_id (EM365Event *event)
+{
+ return e_m365_json_get_string_member (event, "id", NULL);
+}
+
+const gchar *
+e_m365_event_get_change_key (EM365Event *event)
+{
+ return e_m365_json_get_string_member (event, "changeKey", NULL);
+}
+
+JsonArray * /* EM365Attendee * */
+e_m365_event_get_attendees (EM365Event *event)
+{
+ return e_m365_json_get_array_member (event, "attendees");
+}
+
+void
+e_m365_event_begin_attendees (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "attendees");
+}
+
+void
+e_m365_event_end_attendees (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+void
+e_m365_event_add_attendee (JsonBuilder *builder,
+ EM365AttendeeType type,
+ EM365ResponseType response,
+ time_t response_time,
+ const gchar *name,
+ const gchar *address)
+{
+ if (response_time <= (time_t) 0)
+ response_time = time (NULL);
+
+ e_m365_json_begin_object_member (builder, NULL);
+
+ m365_json_utils_add_enum_as_json (builder, "type", type,
+ attendee_map, G_N_ELEMENTS (attendee_map),
+ E_M365_ATTENDEE_NOT_SET,
+ E_M365_ATTENDEE_NOT_SET);
+
+ e_m365_json_begin_object_member (builder, "status");
+
+ m365_json_utils_add_enum_as_json (builder, "response", response,
+ response_map, G_N_ELEMENTS (response_map),
+ E_M365_RESPONSE_NOT_SET,
+ E_M365_RESPONSE_UNKNOWN);
+
+ e_m365_add_date_time_offset_member (builder, "time", response_time);
+
+ e_m365_json_end_object_member (builder); /* status */
+
+ if ((name && *name) || (address && *address))
+ e_m365_add_email_address (builder, "emailAddress", name, address);
+
+ e_m365_json_end_object_member (builder);
+}
+
+void
+e_m365_event_add_null_attendees (JsonBuilder *builder)
+{
+ e_m365_json_add_null_member (builder, "attendees");
+}
+
+EM365ItemBody *
+e_m365_event_get_body (EM365Event *event)
+{
+ return e_m365_json_get_object_member (event, "body");
+}
+
+void
+e_m365_event_add_body (JsonBuilder *builder,
+ EM365ItemBodyContentTypeType content_type,
+ const gchar *content)
+{
+ e_m365_add_item_body (builder, "body", content_type, content);
+}
+
+const gchar *
+e_m365_event_get_body_preview (EM365Event *event)
+{
+ return e_m365_json_get_string_member (event, "bodyPreview", NULL);
+}
+
+JsonArray * /* const gchar * */
+e_m365_event_get_categories (EM365Event *event)
+{
+ return e_m365_json_get_array_member (event, "categories");
+}
+
+void
+e_m365_event_begin_categories (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "categories");
+}
+
+void
+e_m365_event_end_categories (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+void
+e_m365_event_add_category (JsonBuilder *builder,
+ const gchar *category)
+{
+ g_return_if_fail (category && *category);
+
+ json_builder_add_string_value (builder, category);
+}
+
+time_t
+e_m365_event_get_created_date_time (EM365Event *event)
+{
+ return e_m365_get_date_time_offset_member (event, "createdDateTime");
+}
+
+EM365DateTimeWithZone *
+e_m365_event_get_end (EM365Event *event)
+{
+ return e_m365_json_get_object_member (event, "end");
+}
+
+void
+e_m365_event_add_end (JsonBuilder *builder,
+ time_t date_time,
+ const gchar *zone)
+{
+ e_m365_add_date_time (builder, "end", date_time, zone);
+}
+
+gboolean
+e_m365_event_get_has_attachments (EM365Event *event)
+{
+ return e_m365_json_get_boolean_member (event, "hasAttachments", FALSE);
+}
+
+const gchar *
+e_m365_event_get_ical_uid (EM365Event *event)
+{
+ return e_m365_json_get_string_member (event, "iCalUId", NULL);
+}
+
+EM365ImportanceType
+e_m365_event_get_importance (EM365Event *event)
+{
+ return m365_json_utils_get_json_as_enum (event, "importance",
+ importance_map, G_N_ELEMENTS (importance_map),
+ E_M365_IMPORTANCE_NOT_SET,
+ E_M365_IMPORTANCE_UNKNOWN);
+}
+
+void
+e_m365_event_add_importance (JsonBuilder *builder,
+ EM365ImportanceType value)
+{
+ m365_json_utils_add_enum_as_json (builder, "importance", value,
+ importance_map, G_N_ELEMENTS (importance_map),
+ E_M365_IMPORTANCE_NOT_SET,
+ E_M365_IMPORTANCE_UNKNOWN);
+}
+
+gboolean
+e_m365_event_get_is_all_day (EM365Event *event)
+{
+ return e_m365_json_get_boolean_member (event, "isAllDay", FALSE);
+}
+
+void
+e_m365_event_add_is_all_day (JsonBuilder *builder,
+ gboolean value)
+{
+ e_m365_json_add_boolean_member (builder, "isAllDay", value);
+}
+
+gboolean
+e_m365_event_get_is_cancelled (EM365Event *event)
+{
+ return e_m365_json_get_boolean_member (event, "isCancelled", FALSE);
+}
+
+gboolean
+e_m365_event_get_is_online_meeting (EM365Event *event)
+{
+ return e_m365_json_get_boolean_member (event, "isOnlineMeeting", FALSE);
+}
+
+void
+e_m365_event_add_is_online_meeting (JsonBuilder *builder,
+ gboolean value)
+{
+ e_m365_json_add_boolean_member (builder, "isOnlineMeeting", value);
+}
+
+gboolean
+e_m365_event_get_is_organizer (EM365Event *event)
+{
+ return e_m365_json_get_boolean_member (event, "isOrganizer", FALSE);
+}
+
+gboolean
+e_m365_event_get_is_reminder_on (EM365Event *event)
+{
+ return e_m365_json_get_boolean_member (event, "isReminderOn", FALSE);
+}
+
+void
+e_m365_event_add_is_reminder_on (JsonBuilder *builder,
+ gboolean value)
+{
+ e_m365_json_add_boolean_member (builder, "isReminderOn", value);
+}
+
+time_t
+e_m365_event_get_last_modified_date_time (EM365Event *event)
+{
+ return e_m365_get_date_time_offset_member (event, "lastModifiedDateTime");
+}
+
+EM365Location *
+e_m365_event_get_location (EM365Event *event)
+{
+ return e_m365_json_get_object_member (event, "location");
+}
+
+void
+e_m365_event_begin_location (JsonBuilder *builder)
+{
+ e_m365_json_begin_object_member (builder, "location");
+}
+
+void
+e_m365_event_end_location (JsonBuilder *builder)
+{
+ e_m365_json_end_object_member (builder);
+}
+
+void
+e_m365_event_add_null_location (JsonBuilder *builder)
+{
+ e_m365_json_add_null_member (builder, "location");
+}
+
+JsonArray * /* EM365Location * */
+e_m365_event_get_locations (EM365Event *event)
+{
+ return e_m365_json_get_array_member (event, "locations");
+}
+
+void
+e_m365_event_begin_locations (JsonBuilder *builder)
+{
+ e_m365_json_begin_array_member (builder, "locations");
+}
+
+void
+e_m365_event_end_locations (JsonBuilder *builder)
+{
+ e_m365_json_end_array_member (builder);
+}
+
+void
+e_m365_event_begin_locations_location (JsonBuilder *builder)
+{
+ e_m365_json_begin_object_member (builder, NULL);
+}
+
+void
+e_m365_event_end_locations_location (JsonBuilder *builder)
+{
+ e_m365_json_end_object_member (builder);
+}
+
+EM365OnlineMeetingInfo *
+e_m365_event_get_online_meeting_info (EM365Event *event)
+{
+ return e_m365_json_get_object_member (event, "onlineMeeting");
+}
+
+EM365OnlineMeetingProviderType
+e_m365_event_get_online_meeting_provider (EM365Event *event)
+{
+ return m365_json_utils_get_json_as_enum (event, "onlineMeetingProvider",
+ meeting_provider_map, G_N_ELEMENTS (meeting_provider_map),
+ E_M365_ONLINE_MEETING_PROVIDER_NOT_SET,
+ E_M365_ONLINE_MEETING_PROVIDER_UNKNOWN);
+}
+
+void
+e_m365_event_add_online_meeting_provider (JsonBuilder *builder,
+ EM365OnlineMeetingProviderType value)
+{
+ if (value == E_M365_ONLINE_MEETING_PROVIDER_NOT_SET) {
+ e_m365_json_add_null_member (builder, "onlineMeetingProvider");
+ } else {
+ m365_json_utils_add_enum_as_json (builder, "onlineMeetingProvider", value,
+ meeting_provider_map, G_N_ELEMENTS (meeting_provider_map),
+ E_M365_ONLINE_MEETING_PROVIDER_NOT_SET,
+ E_M365_ONLINE_MEETING_PROVIDER_UNKNOWN);
+ }
+}
+
+const gchar *
+e_m365_event_get_online_meeting_url (EM365Event *event)
+{
+ return e_m365_json_get_string_member (event, "onlineMeetingUrl", NULL);
+}
+
+EM365Recipient *
+e_m365_event_get_organizer (EM365Event *event)
+{
+ return e_m365_json_get_object_member (event, "organizer");
+}
+
+void
+e_m365_event_add_organizer (JsonBuilder *builder,
+ const gchar *name,
+ const gchar *address)
+{
+ e_m365_add_recipient (builder, "organizer", name, address);
+}
+
+void
+e_m365_event_add_null_organizer (JsonBuilder *builder)
+{
+ e_m365_json_add_null_member (builder, "organizer");
+}
+
+const gchar *
+e_m365_event_get_original_end_timezone (EM365Event *event)
+{
+ return e_m365_json_get_string_member (event, "originalEndTimeZone", NULL);
+}
+
+time_t
+e_m365_event_get_original_start (EM365Event *event)
+{
+ return e_m365_get_date_time_offset_member (event, "originalStart");
+}
+
+const gchar *
+e_m365_event_get_original_start_timezone (EM365Event *event)
+{
+ return e_m365_json_get_string_member (event, "originalStartTimeZone", NULL);
+}
+
+EM365PatternedRecurrence *
+e_m365_event_get_recurrence (EM365Event *event)
+{
+ return e_m365_json_get_object_member (event, "recurrence");
+}
+
+void
+e_m365_event_begin_recurrence (JsonBuilder *builder)
+{
+ e_m365_json_begin_object_member (builder, "recurrence");
+}
+
+void
+e_m365_event_end_recurrence (JsonBuilder *builder)
+{
+ e_m365_json_end_object_member (builder);
+}
+
+void
+e_m365_event_add_null_recurrence (JsonBuilder *builder)
+{
+ e_m365_json_add_null_member (builder, "recurrence");
+}
+
+gint
+e_m365_event_get_reminder_minutes_before_start (EM365Event *event)
+{
+ return e_m365_json_get_int_member (event, "reminderMinutesBeforeStart", -1);
+}
+
+void
+e_m365_event_add_reminder_minutes_before_start (JsonBuilder *builder,
+ gint value)
+{
+ e_m365_json_add_int_member (builder, "reminderMinutesBeforeStart", value);
+}
+
+gboolean
+e_m365_event_get_response_requested (EM365Event *event)
+{
+ return e_m365_json_get_boolean_member (event, "responseRequested", FALSE);
+}
+
+void
+e_m365_event_add_response_requested (JsonBuilder *builder,
+ gboolean value)
+{
+ e_m365_json_add_boolean_member (builder, "responseRequested", value);
+}
+
+
+EM365ResponseStatus *
+e_m365_event_get_response_status (EM365Event *event)
+{
+ return e_m365_json_get_object_member (event, "responseStatus");
+}
+
+EM365SensitivityType
+e_m365_event_get_sensitivity (EM365Event *event)
+{
+ return m365_json_utils_get_json_as_enum (event, "sensitivity",
+ sensitivity_map, G_N_ELEMENTS (sensitivity_map),
+ E_M365_SENSITIVITY_NOT_SET,
+ E_M365_SENSITIVITY_UNKNOWN);
+}
+
+void
+e_m365_event_add_sensitivity (JsonBuilder *builder,
+ EM365SensitivityType value)
+{
+ m365_json_utils_add_enum_as_json (builder, "sensitivity", value,
+ sensitivity_map, G_N_ELEMENTS (sensitivity_map),
+ E_M365_SENSITIVITY_NOT_SET,
+ E_M365_SENSITIVITY_UNKNOWN);
+}
+
+const gchar *
+e_m365_event_get_series_master_id (EM365Event *event)
+{
+ return e_m365_json_get_string_member (event, "seriesMasterId", NULL);
+}
+
+EM365FreeBusyStatusType
+e_m365_event_get_show_as (EM365Event *event)
+{
+ return m365_json_utils_get_json_as_enum (event, "showAs",
+ free_busy_status_map, G_N_ELEMENTS (free_busy_status_map),
+ E_M365_FREE_BUSY_STATUS_NOT_SET,
+ E_M365_FREE_BUSY_STATUS_UNKNOWN);
+}
+
+void
+e_m365_event_add_show_as (JsonBuilder *builder,
+ EM365FreeBusyStatusType value)
+{
+ m365_json_utils_add_enum_as_json (builder, "showAs", value,
+ free_busy_status_map, G_N_ELEMENTS (free_busy_status_map),
+ E_M365_FREE_BUSY_STATUS_NOT_SET,
+ E_M365_FREE_BUSY_STATUS_UNKNOWN);
+}
+
+EM365DateTimeWithZone *
+e_m365_event_get_start (EM365Event *event)
+{
+ return e_m365_json_get_object_member (event, "start");
+}
+
+void
+e_m365_event_add_start (JsonBuilder *builder,
+ time_t date_time,
+ const gchar *zone)
+{
+ e_m365_add_date_time (builder, "start", date_time, zone);
+}
+
+const gchar *
+e_m365_event_get_subject (EM365Event *event)
+{
+ return e_m365_json_get_string_member (event, "subject", NULL);
+}
+
+void
+e_m365_event_add_subject (JsonBuilder *builder,
+ const gchar *value)
+{
+ e_m365_json_add_string_member (builder, "subject", value ? value : "");
+}
+
+EM365EventTypeType
+e_m365_event_get_type (EM365Event *event)
+{
+ return m365_json_utils_get_json_as_enum (event, "type",
+ event_type_map, G_N_ELEMENTS (event_type_map),
+ E_M365_EVENT_TYPE_NOT_SET,
+ E_M365_EVENT_TYPE_UNKNOWN);
+}
+
+const gchar *
+e_m365_event_get_web_link (EM365Event *event)
+{
+ return e_m365_json_get_string_member (event, "webLink", NULL);
+}
diff --git a/src/Microsoft365/common/e-m365-json-utils.h b/src/Microsoft365/common/e-m365-json-utils.h
new file mode 100644
index 00000000..15e50640
--- /dev/null
+++ b/src/Microsoft365/common/e-m365-json-utils.h
@@ -0,0 +1,919 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_M365_JSON_UTILS_H
+#define E_M365_JSON_UTILS_H
+
+#include <time.h>
+#include <json-glib/json-glib.h>
+
+G_BEGIN_DECLS
+
+/* Just for better readability */
+#define EM365Attachment JsonObject
+#define EM365Attendee JsonObject
+#define EM365Calendar JsonObject
+#define EM365CalendarGroup JsonObject
+#define EM365Category JsonObject
+#define EM365Contact JsonObject
+#define EM365Date gint
+#define EM365DateTimeWithZone JsonObject
+#define EM365EmailAddress JsonObject
+#define EM365Event JsonObject
+#define EM365Folder JsonObject
+#define EM365FollowupFlag JsonObject
+#define EM365InternetMessageHeader JsonObject
+#define EM365ItemBody JsonObject
+#define EM365Location JsonObject
+#define EM365MailFolder JsonObject
+#define EM365MailMessage JsonObject
+#define EM365OnlineMeetingInfo JsonObject
+#define EM365OutlookGeoCoordinates JsonObject
+#define EM365PatternedRecurrence JsonObject
+#define EM365Phone JsonObject
+#define EM365PhysicalAddress JsonObject
+#define EM365Recipient JsonObject
+#define EM365RecurrencePattern JsonObject
+#define EM365RecurrenceRange JsonObject
+#define EM365ResponseStatus JsonObject
+
+typedef enum _EM365AttachmentDataType {
+ E_M365_ATTACHMENT_DATA_TYPE_NOT_SET,
+ E_M365_ATTACHMENT_DATA_TYPE_UNKNOWN,
+ E_M365_ATTACHMENT_DATA_TYPE_FILE,
+ E_M365_ATTACHMENT_DATA_TYPE_ITEM,
+ E_M365_ATTACHMENT_DATA_TYPE_REFERENCE
+} EM365AttachmentDataType;
+
+typedef enum _EM365AttendeeType {
+ E_M365_ATTENDEE_NOT_SET,
+ E_M365_ATTENDEE_UNKNOWN,
+ E_M365_ATTENDEE_REQUIRED,
+ E_M365_ATTENDEE_OPTIONAL,
+ E_M365_ATTENDEE_RESOURCE
+} EM365AttendeeType;
+
+typedef enum _EM365CalendarColorType {
+ E_M365_CALENDAR_COLOR_NOT_SET = -3,
+ E_M365_CALENDAR_COLOR_UNKNOWN = -2,
+ E_M365_CALENDAR_COLOR_AUTO = -1,
+ E_M365_CALENDAR_COLOR_LIGHT_BLUE = 0,
+ E_M365_CALENDAR_COLOR_LIGHT_GREEN = 1,
+ E_M365_CALENDAR_COLOR_LIGHT_ORANGE = 2,
+ E_M365_CALENDAR_COLOR_LIGHT_GRAY = 3,
+ E_M365_CALENDAR_COLOR_LIGHT_YELLOW = 4,
+ E_M365_CALENDAR_COLOR_LIGHT_TEAL = 5,
+ E_M365_CALENDAR_COLOR_LIGHT_PINK = 6,
+ E_M365_CALENDAR_COLOR_LIGHT_BROWN = 7,
+ E_M365_CALENDAR_COLOR_LIGHT_RED = 8,
+ E_M365_CALENDAR_COLOR_MAX_COLOR = 9
+} EM365CalendarColorType;
+
+typedef enum _EM365DayOfWeekType {
+ E_M365_DAY_OF_WEEK_NOT_SET,
+ E_M365_DAY_OF_WEEK_UNKNOWN,
+ E_M365_DAY_OF_WEEK_SUNDAY,
+ E_M365_DAY_OF_WEEK_MONDAY,
+ E_M365_DAY_OF_WEEK_TUESDAY,
+ E_M365_DAY_OF_WEEK_WEDNESDAY,
+ E_M365_DAY_OF_WEEK_THURSDAY,
+ E_M365_DAY_OF_WEEK_FRIDAY,
+ E_M365_DAY_OF_WEEK_SATURDAY
+} EM365DayOfWeekType;
+
+typedef enum _EM365EventTypeType {
+ E_M365_EVENT_TYPE_NOT_SET,
+ E_M365_EVENT_TYPE_UNKNOWN,
+ E_M365_EVENT_TYPE_SINGLE_INSTANCE,
+ E_M365_EVENT_TYPE_OCCURRENCE,
+ E_M365_EVENT_TYPE_EXCEPTION,
+ E_M365_EVENT_TYPE_SERIES_MASTER
+} EM365EventTypeType;
+
+typedef enum _EM365FollowupFlagStatusType {
+ E_M365_FOLLOWUP_FLAG_STATUS_NOT_SET,
+ E_M365_FOLLOWUP_FLAG_STATUS_UNKNOWN,
+ E_M365_FOLLOWUP_FLAG_STATUS_NOT_FLAGGED,
+ E_M365_FOLLOWUP_FLAG_STATUS_COMPLETE,
+ E_M365_FOLLOWUP_FLAG_STATUS_FLAGGED
+} EM365FollowupFlagStatusType;
+
+typedef enum _EM365FreeBusyStatusType {
+ E_M365_FREE_BUSY_STATUS_NOT_SET,
+ E_M365_FREE_BUSY_STATUS_UNKNOWN,
+ E_M365_FREE_BUSY_STATUS_FREE,
+ E_M365_FREE_BUSY_STATUS_TENTATIVE,
+ E_M365_FREE_BUSY_STATUS_BUSY,
+ E_M365_FREE_BUSY_STATUS_OOF,
+ E_M365_FREE_BUSY_STATUS_WORKING_ELSEWHERE
+} EM365FreeBusyStatusType;
+
+typedef enum _EM365ImportanceType {
+ E_M365_IMPORTANCE_NOT_SET,
+ E_M365_IMPORTANCE_UNKNOWN,
+ E_M365_IMPORTANCE_LOW,
+ E_M365_IMPORTANCE_NORMAL,
+ E_M365_IMPORTANCE_HIGH
+} EM365ImportanceType;
+
+typedef enum _EM365InferenceClassificationType {
+ E_M365_INFERENCE_CLASSIFICATION_NOT_SET,
+ E_M365_INFERENCE_CLASSIFICATION_UNKNOWN,
+ E_M365_INFERENCE_CLASSIFICATION_FOCUSED,
+ E_M365_INFERENCE_CLASSIFICATION_OTHER
+} EM365InferenceClassificationType;
+
+typedef enum _EM365ItemBodyContentTypeType {
+ E_M365_ITEM_BODY_CONTENT_TYPE_NOT_SET,
+ E_M365_ITEM_BODY_CONTENT_TYPE_UNKNOWN,
+ E_M365_ITEM_BODY_CONTENT_TYPE_TEXT,
+ E_M365_ITEM_BODY_CONTENT_TYPE_HTML
+} EM365ItemBodyContentTypeType;
+
+typedef enum _EM365LocationType {
+ E_M365_LOCATION_NOT_SET,
+ E_M365_LOCATION_UNKNOWN,
+ E_M365_LOCATION_DEFAULT,
+ E_M365_LOCATION_CONFERENCE_ROOM,
+ E_M365_LOCATION_HOME_ADDRESS,
+ E_M365_LOCATION_BUSINESS_ADDRESS,
+ E_M365_LOCATION_GEO_COORDINATES,
+ E_M365_LOCATION_STREET_ADDRESS,
+ E_M365_LOCATION_HOTEL,
+ E_M365_LOCATION_RESTAURANT,
+ E_M365_LOCATION_LOCAL_BUSINESS,
+ E_M365_LOCATION_POSTAL_ADDRESS
+} EM365LocationType;
+
+typedef enum _EM365OnlineMeetingProviderType {
+ E_M365_ONLINE_MEETING_PROVIDER_NOT_SET = -1,
+ E_M365_ONLINE_MEETING_PROVIDER_UNKNOWN = 0,
+ E_M365_ONLINE_MEETING_PROVIDER_SKYPE_FOR_BUSINESS = 1 << 0,
+ E_M365_ONLINE_MEETING_PROVIDER_SKYPE_FOR_CONSUMER = 1 << 1,
+ E_M365_ONLINE_MEETING_PROVIDER_TEAMS_FOR_BUSINESS = 1 << 2
+} EM365OnlineMeetingProviderType;
+
+typedef enum _EM365PhoneType {
+ E_M365_PHONE_NOT_SET,
+ E_M365_PHONE_UNKNOWN,
+ E_M365_PHONE_HOME,
+ E_M365_PHONE_BUSINESS,
+ E_M365_PHONE_MOBILE,
+ E_M365_PHONE_OTHER,
+ E_M365_PHONE_ASSISTANT,
+ E_M365_PHONE_HOMEFAX,
+ E_M365_PHONE_BUSINESSFAX,
+ E_M365_PHONE_OTHERFAX,
+ E_M365_PHONE_PAGER,
+ E_M365_PHONE_RADIO
+} EM365PhoneType;
+
+typedef enum _EM365RecurrencePatternType {
+ E_M365_RECURRENCE_PATTERN_NOT_SET,
+ E_M365_RECURRENCE_PATTERN_UNKNOWN,
+ E_M365_RECURRENCE_PATTERN_DAILY,
+ E_M365_RECURRENCE_PATTERN_WEEKLY,
+ E_M365_RECURRENCE_PATTERN_ABSOLUTE_MONTHLY,
+ E_M365_RECURRENCE_PATTERN_RELATIVE_MONTHLY,
+ E_M365_RECURRENCE_PATTERN_ABSOLUTE_YEARLY,
+ E_M365_RECURRENCE_PATTERN_RELATIVE_YEARLY
+} EM365RecurrencePatternType;
+
+typedef enum _EM365RecurrenceRangeType {
+ E_M365_RECURRENCE_RANGE_NOT_SET,
+ E_M365_RECURRENCE_RANGE_UNKNOWN,
+ E_M365_RECURRENCE_RANGE_ENDDATE,
+ E_M365_RECURRENCE_RANGE_NOEND,
+ E_M365_RECURRENCE_RANGE_NUMBERED
+} EM365RecurrenceRangeType;
+
+typedef enum _EM365ResponseType {
+ E_M365_RESPONSE_NOT_SET,
+ E_M365_RESPONSE_UNKNOWN,
+ E_M365_RESPONSE_NONE,
+ E_M365_RESPONSE_ORGANIZER,
+ E_M365_RESPONSE_TENTATIVELY_ACCEPTED,
+ E_M365_RESPONSE_ACCEPTED,
+ E_M365_RESPONSE_DECLINED,
+ E_M365_RESPONSE_NOT_RESPONDED
+} EM365ResponseType;
+
+typedef enum _EM365SensitivityType {
+ E_M365_SENSITIVITY_NOT_SET,
+ E_M365_SENSITIVITY_UNKNOWN,
+ E_M365_SENSITIVITY_NORMAL,
+ E_M365_SENSITIVITY_PERSONAL,
+ E_M365_SENSITIVITY_PRIVATE,
+ E_M365_SENSITIVITY_CONFIDENTIAL
+} EM365SensitivityType;
+
+typedef enum _EM365WeekIndexType {
+ E_M365_WEEK_INDEX_NOT_SET,
+ E_M365_WEEK_INDEX_UNKNOWN,
+ E_M365_WEEK_INDEX_FIRST,
+ E_M365_WEEK_INDEX_SECOND,
+ E_M365_WEEK_INDEX_THIRD,
+ E_M365_WEEK_INDEX_FOURTH,
+ E_M365_WEEK_INDEX_LAST
+} EM365WeekIndexType;
+
+const gchar * e_m365_calendar_color_to_rgb (EM365CalendarColorType color);
+EM365CalendarColorType
+ e_m365_rgb_to_calendar_color (const gchar *rgb);
+
+JsonArray * e_m365_json_get_array_member (JsonObject *object,
+ const gchar *member_name);
+void e_m365_json_begin_array_member (JsonBuilder *builder,
+ const gchar *member_name);
+void e_m365_json_end_array_member (JsonBuilder *builder);
+gboolean e_m365_json_get_boolean_member (JsonObject *object,
+ const gchar *member_name,
+ gboolean default_value);
+void e_m365_json_add_boolean_member (JsonBuilder *builder,
+ const gchar *member_name,
+ gboolean value);
+gdouble e_m365_json_get_double_member (JsonObject *object,
+ const gchar *member_name,
+ gdouble default_value);
+void e_m365_json_add_double_member (JsonBuilder *builder,
+ const gchar *member_name,
+ gdouble value);
+gint64 e_m365_json_get_int_member (JsonObject *object,
+ const gchar *member_name,
+ gint64 default_value);
+void e_m365_json_add_int_member (JsonBuilder *builder,
+ const gchar *member_name,
+ gint64 value);
+gboolean e_m365_json_get_null_member (JsonObject *object,
+ const gchar *member_name,
+ gboolean default_value);
+void e_m365_json_add_null_member (JsonBuilder *builder,
+ const gchar *member_name);
+JsonObject * e_m365_json_get_object_member (JsonObject *object,
+ const gchar *member_name);
+void e_m365_json_begin_object_member (JsonBuilder *builder,
+ const gchar *member_name);
+void e_m365_json_end_object_member (JsonBuilder *builder);
+const gchar * e_m365_json_get_string_member (JsonObject *object,
+ const gchar *member_name,
+ const gchar *default_value);
+void e_m365_json_add_string_member (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *value);
+void e_m365_json_add_nonempty_string_member (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *value);
+void e_m365_json_add_nonempty_or_null_string_member
+ (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *value);
+
+EM365Date e_m365_date_get (JsonObject *object,
+ const gchar *member_name);
+void e_m365_add_date (JsonBuilder *builder,
+ const gchar *member_name,
+ EM365Date value);
+gboolean e_m365_date_decode (EM365Date dt,
+ guint *out_year,
+ guint *out_month,
+ guint *out_day);
+EM365Date e_m365_date_encode (guint year,
+ guint month,
+ guint day);
+
+time_t e_m365_get_date_time_offset_member (JsonObject *object,
+ const gchar *member_name);
+void e_m365_add_date_time_offset_member (JsonBuilder *builder,
+ const gchar *member_name,
+ time_t value);
+
+time_t e_m365_date_time_get_date_time (EM365DateTimeWithZone *datetime);
+const gchar * e_m365_date_time_get_time_zone (EM365DateTimeWithZone *datetime);
+void e_m365_add_date_time (JsonBuilder *builder,
+ const gchar *member_name,
+ time_t date_time,
+ const gchar *zone);
+
+gboolean e_m365_delta_is_removed_object (JsonObject *object);
+
+const gchar * e_m365_category_get_display_name (EM365Category *category);
+const gchar * e_m365_category_get_id (EM365Category *category);
+const gchar * e_m365_category_get_color (EM365Category *category);
+
+const gchar * e_m365_folder_get_id (EM365Folder *folder);
+const gchar * e_m365_folder_get_parent_folder_id (EM365Folder *folder);
+const gchar * e_m365_folder_get_display_name (EM365Folder *folder);
+
+gint32 e_m365_mail_folder_get_child_folder_count
+ (EM365MailFolder *folder);
+gint32 e_m365_mail_folder_get_total_item_count (EM365MailFolder *folder);
+gint32 e_m365_mail_folder_get_unread_item_count(EM365MailFolder *folder);
+
+const gchar * e_m365_recipient_get_name (EM365Recipient *recipient);
+const gchar * e_m365_recipient_get_address (EM365Recipient *recipient);
+void e_m365_add_recipient (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *name,
+ const gchar *address);
+
+const gchar * e_m365_internet_message_header_get_name (EM365InternetMessageHeader *header);
+const gchar * e_m365_internet_message_header_get_value(EM365InternetMessageHeader *header);
+void e_m365_add_internet_message_header (JsonBuilder *builder,
+ const gchar *name,
+ const gchar *value);
+
+EM365DateTimeWithZone *
+ e_m365_followup_flag_get_completed_date_time
+ (EM365FollowupFlag *flag);
+void e_m365_followup_flag_add_completed_date_time
+ (JsonBuilder *builder,
+ time_t date_time,
+ const gchar *zone);
+EM365DateTimeWithZone *
+ e_m365_followup_flag_get_due_date_time (EM365FollowupFlag *flag);
+void e_m365_followup_flag_add_due_date_time (JsonBuilder *builder,
+ time_t date_time,
+ const gchar *zone);
+EM365FollowupFlagStatusType
+ e_m365_followup_flag_get_flag_status (EM365FollowupFlag *flag);
+void e_m365_followup_flag_add_flag_status (JsonBuilder *builder,
+ EM365FollowupFlagStatusType status);
+EM365DateTimeWithZone *
+ e_m365_followup_flag_get_start_date_time(EM365FollowupFlag *flag);
+void e_m365_followup_flag_add_start_date_time(JsonBuilder *builder,
+ time_t date_time,
+ const gchar *zone);
+
+const gchar * e_m365_item_body_get_content (EM365ItemBody *item_body);
+EM365ItemBodyContentTypeType
+ e_m365_item_body_get_content_type (EM365ItemBody *item_body);
+void e_m365_add_item_body (JsonBuilder *builder,
+ const gchar *member_name,
+ EM365ItemBodyContentTypeType content_type,
+ const gchar *content);
+
+JsonArray * e_m365_mail_message_get_bcc_recipients (EM365MailMessage *mail); /* EM365Recipient * */
+void e_m365_mail_message_begin_bcc_recipients(JsonBuilder *builder);
+void e_m365_mail_message_end_bcc_recipients (JsonBuilder *builder);
+EM365ItemBody * e_m365_mail_message_get_body (EM365MailMessage *mail);
+void e_m365_mail_message_add_body (JsonBuilder *builder,
+ EM365ItemBodyContentTypeType content_type,
+ const gchar *content);
+const gchar * e_m365_mail_message_get_body_preview (EM365MailMessage *mail);
+JsonArray * e_m365_mail_message_get_categories (EM365MailMessage *mail); /* const gchar * */
+void e_m365_mail_message_begin_categories (JsonBuilder *builder);
+void e_m365_mail_message_end_categories (JsonBuilder *builder);
+void e_m365_mail_message_add_category (JsonBuilder *builder,
+ const gchar *category);
+JsonArray * e_m365_mail_message_get_cc_recipients (EM365MailMessage *mail); /* EM365Recipient * */
+void e_m365_mail_message_begin_cc_recipients (JsonBuilder *builder);
+void e_m365_mail_message_end_cc_recipients (JsonBuilder *builder);
+const gchar * e_m365_mail_message_get_change_key (EM365MailMessage *mail);
+const gchar * e_m365_mail_message_get_conversation_id (EM365MailMessage *mail);
+JsonObject * e_m365_mail_message_get_conversation_index
+ (EM365MailMessage *mail);
+time_t e_m365_mail_message_get_created_date_time
+ (EM365MailMessage *mail);
+EM365FollowupFlag *
+ e_m365_mail_message_get_flag (EM365MailMessage *mail);
+void e_m365_mail_message_begin_flag (JsonBuilder *builder);
+void e_m365_mail_message_end_flag (JsonBuilder *builder);
+EM365Recipient *
+ e_m365_mail_message_get_from (EM365MailMessage *mail);
+void e_m365_mail_message_add_from (JsonBuilder *builder,
+ const gchar *name,
+ const gchar *address);
+gboolean e_m365_mail_message_get_has_attachments (EM365MailMessage *mail);
+const gchar * e_m365_mail_message_get_id (EM365MailMessage *mail);
+EM365ImportanceType
+ e_m365_mail_message_get_importance (EM365MailMessage *mail);
+void e_m365_mail_message_add_importance (JsonBuilder *builder,
+ EM365ImportanceType importance);
+EM365InferenceClassificationType
+ e_m365_mail_message_get_inference_classification
+ (EM365MailMessage *mail);
+JsonArray * e_m365_mail_message_get_internet_message_headers
+ (EM365MailMessage *mail); /*
EM365InternetMessageHeader * */
+void e_m365_mail_message_begin_internet_message_headers
+ (JsonBuilder *builder);
+void e_m365_mail_message_end_internet_message_headers
+ (JsonBuilder *builder);
+const gchar * e_m365_mail_message_get_internet_message_id
+ (EM365MailMessage *mail);
+void e_m365_mail_message_add_internet_message_id
+ (JsonBuilder *builder,
+ const gchar *message_id);
+gboolean e_m365_mail_message_get_is_delivery_receipt_requested
+ (EM365MailMessage *mail);
+void e_m365_mail_message_add_is_delivery_receipt_requested
+ (JsonBuilder *builder,
+ gboolean value);
+gboolean e_m365_mail_message_get_is_draft (EM365MailMessage *mail);
+gboolean e_m365_mail_message_get_is_read (EM365MailMessage *mail);
+void e_m365_mail_message_add_is_read (JsonBuilder *builder,
+ gboolean value);
+gboolean e_m365_mail_message_get_is_read_receipt_requested
+ (EM365MailMessage *mail);
+void e_m365_mail_message_add_is_read_receipt_requested
+ (JsonBuilder *builder,
+ gboolean value);
+time_t e_m365_mail_message_get_last_modified_date_time
+ (EM365MailMessage *mail);
+const gchar * e_m365_mail_message_get_parent_folder_id(EM365MailMessage *mail);
+time_t e_m365_mail_message_get_received_date_time
+ (EM365MailMessage *mail);
+void e_m365_mail_message_add_received_date_time
+ (JsonBuilder *builder,
+ time_t value);
+JsonArray * e_m365_mail_message_get_reply_to (EM365MailMessage *mail); /* EM365Recipient * */
+void e_m365_mail_message_begin_reply_to (JsonBuilder *builder);
+void e_m365_mail_message_end_reply_to (JsonBuilder *builder);
+EM365Recipient *e_m365_mail_message_get_sender (EM365MailMessage *mail);
+void e_m365_mail_message_add_sender (JsonBuilder *builder,
+ const gchar *name,
+ const gchar *address);
+time_t e_m365_mail_message_get_sent_date_time (EM365MailMessage *mail);
+void e_m365_mail_message_add_sent_date_time (JsonBuilder *builder,
+ time_t value);
+const gchar * e_m365_mail_message_get_subject (EM365MailMessage *mail);
+void e_m365_mail_message_add_subject (JsonBuilder *builder,
+ const gchar *subject);
+JsonArray * e_m365_mail_message_get_to_recipients (EM365MailMessage *mail); /* EM365Recipient * */
+void e_m365_mail_message_begin_to_recipients (JsonBuilder *builder);
+void e_m365_mail_message_end_to_recipients (JsonBuilder *builder);
+EM365ItemBody * e_m365_mail_message_get_unique_body (EM365MailMessage *mail);
+const gchar * e_m365_mail_message_get_web_link (EM365MailMessage *mail);
+
+EM365AttachmentDataType
+ e_m365_attachment_get_data_type (EM365Attachment *attachment);
+void e_m365_attachment_begin_attachment (JsonBuilder *builder,
+ EM365AttachmentDataType data_type);
+void e_m365_attachment_end_attachment (JsonBuilder *builder);
+const gchar * e_m365_attachment_get_content_type (EM365Attachment *attachment);
+void e_m365_attachment_add_content_type (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_attachment_get_id (EM365Attachment *attachment);
+gboolean e_m365_attachment_get_is_inline (EM365Attachment *attachment);
+void e_m365_attachment_add_is_inline (JsonBuilder *builder,
+ gboolean value);
+time_t e_m365_attachment_get_last_modified_date_time
+ (EM365Attachment *attachment);
+void e_m365_attachment_add_last_modified_date_time
+ (JsonBuilder *builder,
+ time_t value);
+const gchar * e_m365_attachment_get_name (EM365Attachment *attachment);
+void e_m365_attachment_add_name (JsonBuilder *builder,
+ const gchar *value);
+gint32 e_m365_attachment_get_size (EM365Attachment *attachment);
+void e_m365_attachment_add_size (JsonBuilder *builder,
+ gint32 value);
+const gchar * e_m365_file_attachment_get_content_bytes(EM365Attachment *attachment); /* base64-encoded */
+void e_m365_file_attachment_add_content_bytes(JsonBuilder *builder,
+ const gchar *base64_value);
+const gchar * e_m365_file_attachment_get_content_id (EM365Attachment *attachment);
+void e_m365_file_attachment_add_content_id (JsonBuilder *builder,
+ const gchar *value);
+
+const gchar * e_m365_email_address_get_name (EM365EmailAddress *email);
+const gchar * e_m365_email_address_get_address (EM365EmailAddress *email);
+void e_m365_add_email_address (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *name,
+ const gchar *address);
+const gchar * e_m365_physical_address_get_city (EM365PhysicalAddress *address);
+const gchar * e_m365_physical_address_get_country_or_region
+ (EM365PhysicalAddress *address);
+const gchar * e_m365_physical_address_get_postal_code (EM365PhysicalAddress *address);
+const gchar * e_m365_physical_address_get_state (EM365PhysicalAddress *address);
+const gchar * e_m365_physical_address_get_street (EM365PhysicalAddress *address);
+void e_m365_add_physical_address (JsonBuilder *builder,
+ const gchar *member_name,
+ const gchar *city,
+ const gchar *country_or_region,
+ const gchar *postal_code,
+ const gchar *state,
+ const gchar *street);
+
+const gchar * e_m365_contact_get_id (EM365Contact *contact);
+const gchar * e_m365_contact_get_parent_folder_id (EM365Contact *contact);
+const gchar * e_m365_contact_get_change_key (EM365Contact *contact);
+time_t e_m365_contact_get_created_date_time (EM365Contact *contact);
+time_t e_m365_contact_get_last_modified_date_time
+ (EM365Contact *contact);
+const gchar * e_m365_contact_get_assistant_name (EM365Contact *contact);
+void e_m365_contact_add_assistant_name (JsonBuilder *builder,
+ const gchar *value);
+time_t e_m365_contact_get_birthday (EM365Contact *contact);
+void e_m365_contact_add_birthday (JsonBuilder *builder,
+ time_t value);
+EM365PhysicalAddress *
+ e_m365_contact_get_business_address (EM365Contact *contact);
+void e_m365_contact_add_business_address (JsonBuilder *builder,
+ const gchar *city,
+ const gchar *country_or_region,
+ const gchar *postal_code,
+ const gchar *state,
+ const gchar *street);
+const gchar * e_m365_contact_get_business_home_page (EM365Contact *contact);
+void e_m365_contact_add_business_home_page (JsonBuilder *builder,
+ const gchar *value);
+JsonArray * e_m365_contact_get_business_phones (EM365Contact *contact); /* const gchar * */
+void e_m365_contact_begin_business_phones (JsonBuilder *builder);
+void e_m365_contact_end_business_phones (JsonBuilder *builder);
+void e_m365_contact_add_business_phone (JsonBuilder *builder,
+ const gchar *value);
+JsonArray * e_m365_contact_get_categories (EM365Contact *contact); /* const gchar * */
+void e_m365_contact_begin_categories (JsonBuilder *builder);
+void e_m365_contact_end_categories (JsonBuilder *builder);
+void e_m365_contact_add_category (JsonBuilder *builder,
+ const gchar *category);
+JsonArray * e_m365_contact_get_children (EM365Contact *contact); /* const gchar * */
+void e_m365_contact_begin_children (JsonBuilder *builder);
+void e_m365_contact_end_children (JsonBuilder *builder);
+void e_m365_contact_add_child (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_company_name (EM365Contact *contact);
+void e_m365_contact_add_company_name (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_department (EM365Contact *contact);
+void e_m365_contact_add_department (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_display_name (EM365Contact *contact);
+void e_m365_contact_add_display_name (JsonBuilder *builder,
+ const gchar *value);
+JsonArray * e_m365_contact_get_email_addresses (EM365Contact *contact); /* EM365EmailAddress * */
+void e_m365_contact_begin_email_addresses (JsonBuilder *builder);
+void e_m365_contact_end_email_addresses (JsonBuilder *builder);
+const gchar * e_m365_contact_get_file_as (EM365Contact *contact);
+void e_m365_contact_add_file_as (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_generation (EM365Contact *contact);
+void e_m365_contact_add_generation (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_given_name (EM365Contact *contact);
+void e_m365_contact_add_given_name (JsonBuilder *builder,
+ const gchar *value);
+EM365PhysicalAddress *
+ e_m365_contact_get_home_address (EM365Contact *contact);
+void e_m365_contact_add_home_address (JsonBuilder *builder,
+ const gchar *city,
+ const gchar *country_or_region,
+ const gchar *postal_code,
+ const gchar *state,
+ const gchar *street);
+JsonArray * e_m365_contact_get_home_phones (EM365Contact *contact); /* const gchar * */
+void e_m365_contact_begin_home_phones (JsonBuilder *builder);
+void e_m365_contact_end_home_phones (JsonBuilder *builder);
+void e_m365_contact_add_home_phone (JsonBuilder *builder,
+ const gchar *value);
+JsonArray * e_m365_contact_get_im_addresses (EM365Contact *contact); /* const gchar * */
+void e_m365_contact_begin_im_addresses (JsonBuilder *builder);
+void e_m365_contact_end_im_addresses (JsonBuilder *builder);
+void e_m365_contact_add_im_address (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_initials (EM365Contact *contact);
+void e_m365_contact_add_initials (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_job_title (EM365Contact *contact);
+void e_m365_contact_add_job_title (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_manager (EM365Contact *contact);
+void e_m365_contact_add_manager (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_middle_name (EM365Contact *contact);
+void e_m365_contact_add_middle_name (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_mobile_phone (EM365Contact *contact);
+void e_m365_contact_add_mobile_phone (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_nick_name (EM365Contact *contact);
+void e_m365_contact_add_nick_name (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_office_location (EM365Contact *contact);
+void e_m365_contact_add_office_location (JsonBuilder *builder,
+ const gchar *value);
+EM365PhysicalAddress *
+ e_m365_contact_get_other_address (EM365Contact *contact);
+void e_m365_contact_add_other_address (JsonBuilder *builder,
+ const gchar *city,
+ const gchar *country_or_region,
+ const gchar *postal_code,
+ const gchar *state,
+ const gchar *street);
+const gchar * e_m365_contact_get_personal_notes (EM365Contact *contact);
+void e_m365_contact_add_personal_notes (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_profession (EM365Contact *contact);
+void e_m365_contact_add_profession (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_spouse_name (EM365Contact *contact);
+void e_m365_contact_add_spouse_name (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_surname (EM365Contact *contact);
+void e_m365_contact_add_surname (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_title (EM365Contact *contact);
+void e_m365_contact_add_title (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_yomi_company_name (EM365Contact *contact);
+void e_m365_contact_add_yomi_company_name (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_yomi_given_name (EM365Contact *contact);
+void e_m365_contact_add_yomi_given_name (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_contact_get_yomi_surname (EM365Contact *contact);
+void e_m365_contact_add_yomi_surname (JsonBuilder *builder,
+ const gchar *value);
+
+const gchar * e_m365_calendar_group_get_id (EM365CalendarGroup *group);
+const gchar * e_m365_calendar_group_get_change_key (EM365CalendarGroup *group);
+const gchar * e_m365_calendar_group_get_class_id (EM365CalendarGroup *group);
+const gchar * e_m365_calendar_group_get_name (EM365CalendarGroup *group);
+
+const gchar * e_m365_calendar_get_id (EM365Calendar *calendar);
+const gchar * e_m365_calendar_get_change_key (EM365Calendar *calendar);
+gboolean e_m365_calendar_get_can_edit (EM365Calendar *calendar);
+gboolean e_m365_calendar_get_can_share (EM365Calendar *calendar);
+gboolean e_m365_calendar_get_can_view_private_items
+ (EM365Calendar *calendar);
+gboolean e_m365_calendar_get_is_removable (EM365Calendar *calendar);
+gboolean e_m365_calendar_get_is_tallying_responses
+ (EM365Calendar *calendar);
+EM365EmailAddress *
+ e_m365_calendar_get_owner (EM365Calendar *calendar);
+const gchar * e_m365_calendar_get_name (EM365Calendar *calendar);
+void e_m365_calendar_add_name (JsonBuilder *builder,
+ const gchar *name);
+guint32 e_m365_calendar_get_allowed_online_meeting_providers /* bit-or of
EM365OnlineMeetingProviderType */
+ (EM365Calendar *calendar);
+void e_m365_calendar_add_allowed_online_meeting_providers
+ (JsonBuilder *builder,
+ guint providers); /* bit-or of
EM365OnlineMeetingProviderType */
+EM365CalendarColorType
+ e_m365_calendar_get_color (EM365Calendar *calendar);
+void e_m365_calendar_add_color (JsonBuilder *builder,
+ EM365CalendarColorType color);
+EM365OnlineMeetingProviderType
+ e_m365_calendar_get_default_online_meeting_provider
+ (EM365Calendar *calendar);
+void e_m365_calendar_add_default_online_meeting_provider
+ (JsonBuilder *builder,
+ EM365OnlineMeetingProviderType provider);
+EM365ResponseType
+ e_m365_response_status_get_response (EM365ResponseStatus *response_status);
+time_t e_m365_response_status_get_time (EM365ResponseStatus *response_status);
+
+EM365ResponseStatus *
+ e_m365_attendee_get_status (EM365Attendee *attendee);
+EM365AttendeeType
+ e_m365_attendee_get_type (EM365Attendee *attendee);
+EM365EmailAddress *
+ e_m365_attendee_get_email_address (EM365Attendee *attendee);
+
+gdouble e_m365_outlook_geo_coordinates_get_accuracy
+ (EM365OutlookGeoCoordinates *coords);
+void e_m365_outlook_geo_coordinates_add_accuracy
+ (JsonBuilder *builder,
+ gdouble value);
+gdouble e_m365_outlook_geo_coordinates_get_altitude
+ (EM365OutlookGeoCoordinates *coords);
+void e_m365_outlook_geo_coordinates_add_altitude
+ (JsonBuilder *builder,
+ gdouble value);
+gdouble e_m365_outlook_geo_coordinates_get_altitude_accuracy
+ (EM365OutlookGeoCoordinates *coords);
+void e_m365_outlook_geo_coordinates_add_altitude_accuracy
+ (JsonBuilder *builder,
+ gdouble value);
+gdouble e_m365_outlook_geo_coordinates_get_latitude
+ (EM365OutlookGeoCoordinates *coords);
+void e_m365_outlook_geo_coordinates_add_latitude
+ (JsonBuilder *builder,
+ gdouble value);
+gdouble e_m365_outlook_geo_coordinates_get_longitude
+ (EM365OutlookGeoCoordinates *coords);
+void e_m365_outlook_geo_coordinates_add_longitude
+ (JsonBuilder *builder,
+ gdouble value);
+EM365PhysicalAddress *
+ e_m365_location_get_address (EM365Location *location);
+void e_m365_location_add_address (JsonBuilder *builder,
+ const gchar *city,
+ const gchar *country_or_region,
+ const gchar *postal_code,
+ const gchar *state,
+ const gchar *street);
+EM365OutlookGeoCoordinates *
+ e_m365_location_get_coordinates (EM365Location *location);
+void e_m365_location_begin_coordinates (JsonBuilder *builder);
+void e_m365_location_end_coordinates (JsonBuilder *builder);
+const gchar * e_m365_location_get_display_name (EM365Location *location);
+void e_m365_location_add_display_name (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_location_get_email_address (EM365Location *location);
+void e_m365_location_add_email_address (JsonBuilder *builder,
+ const gchar *value);
+const gchar * e_m365_location_get_uri (EM365Location *location);
+void e_m365_location_add_uri (JsonBuilder *builder,
+ const gchar *value);
+EM365LocationType
+ e_m365_location_get_type (EM365Location *location);
+
+const gchar * e_m365_phone_get_number (EM365Phone *phone);
+EM365PhoneType e_m365_phone_get_type (EM365Phone *phone);
+
+const gchar * e_m365_online_meeting_info_get_conference_id
+ (EM365OnlineMeetingInfo *meeting_info);
+const gchar * e_m365_online_meeting_info_get_join_url (EM365OnlineMeetingInfo *meeting_info);
+JsonArray * e_m365_online_meeting_info_get_phones (EM365OnlineMeetingInfo *meeting_info); /* EM365Phone
* */
+const gchar * e_m365_online_meeting_info_get_quick_dial
+ (EM365OnlineMeetingInfo *meeting_info);
+JsonArray * e_m365_online_meeting_info_get_toll_free_numbers
+ (EM365OnlineMeetingInfo *meeting_info); /* gchar * */
+const gchar * e_m365_online_meeting_info_get_toll_number
+ (EM365OnlineMeetingInfo *meeting_info);
+
+EM365DayOfWeekType
+ e_m365_array_get_day_of_week_element (JsonArray *array, /* const gchar * representing
EM365DayOfWeekType */
+ guint index);
+gint e_m365_recurrence_pattern_get_day_of_month
+ (EM365RecurrencePattern *pattern);
+void e_m365_recurrence_pattern_add_day_of_month
+ (JsonBuilder *builder,
+ gint value);
+JsonArray * e_m365_recurrence_pattern_get_days_of_week
+ (EM365RecurrencePattern *pattern); /* const gchar *
representing EM365DayOfWeekType, use e_m365_array_get_day_of_week_element() */
+void e_m365_recurrence_pattern_begin_days_of_week
+ (JsonBuilder *builder);
+void e_m365_recurrence_pattern_end_days_of_week
+ (JsonBuilder *builder);
+void e_m365_recurrence_pattern_add_day_of_week
+ (JsonBuilder *builder,
+ EM365DayOfWeekType value);
+EM365DayOfWeekType
+ e_m365_recurrence_pattern_get_first_day_of_week
+ (EM365RecurrencePattern *pattern);
+void e_m365_recurrence_pattern_add_first_day_of_week
+ (JsonBuilder *builder,
+ EM365DayOfWeekType value);
+EM365WeekIndexType
+ e_m365_recurrence_pattern_get_index (EM365RecurrencePattern *pattern);
+void e_m365_recurrence_pattern_add_index (JsonBuilder *builder,
+ EM365WeekIndexType value);
+gint e_m365_recurrence_pattern_get_interval (EM365RecurrencePattern *pattern);
+void e_m365_recurrence_pattern_add_interval (JsonBuilder *builder,
+ gint value);
+gint e_m365_recurrence_pattern_get_month (EM365RecurrencePattern *pattern);
+void e_m365_recurrence_pattern_add_month (JsonBuilder *builder,
+ gint value);
+EM365RecurrencePatternType
+ e_m365_recurrence_pattern_get_type (EM365RecurrencePattern *pattern);
+void e_m365_recurrence_pattern_add_type (JsonBuilder *builder,
+ EM365RecurrencePatternType value);
+
+EM365Date e_m365_recurrence_range_get_end_date (EM365RecurrenceRange *range);
+void e_m365_recurrence_range_add_end_date (JsonBuilder *builder,
+ EM365Date value);
+gint e_m365_recurrence_range_get_number_of_occurrences
+ (EM365RecurrenceRange *range);
+void e_m365_recurrence_range_add_number_of_occurrences
+ (JsonBuilder *builder,
+ gint value);
+const gchar * e_m365_recurrence_range_get_recurrence_time_zone
+ (EM365RecurrenceRange *range);
+void e_m365_recurrence_range_add_recurrence_time_zone
+ (JsonBuilder *builder,
+ const gchar *value);
+EM365Date e_m365_recurrence_range_get_start_date (EM365RecurrenceRange *range);
+void e_m365_recurrence_range_add_start_date (JsonBuilder *builder,
+ EM365Date value);
+EM365RecurrenceRangeType
+ e_m365_recurrence_range_get_type (EM365RecurrenceRange *range);
+void e_m365_recurrence_range_add_type (JsonBuilder *builder,
+ EM365RecurrenceRangeType value);
+
+EM365RecurrencePattern *
+ e_m365_patterned_recurrence_get_pattern (EM365PatternedRecurrence *patterned_recurrence);
+void e_m365_patterned_recurrence_begin_pattern
+ (JsonBuilder *builder);
+void e_m365_patterned_recurrence_end_pattern
+ (JsonBuilder *builder);
+EM365RecurrenceRange *
+ e_m365_patterned_recurrence_get_range (EM365PatternedRecurrence *patterned_recurrence);
+void e_m365_patterned_recurrence_begin_range
+ (JsonBuilder *builder);
+void e_m365_patterned_recurrence_end_range
+ (JsonBuilder *builder);
+
+const gchar * e_m365_event_get_id (EM365Event *event);
+const gchar * e_m365_event_get_change_key (EM365Event *event);
+JsonArray * e_m365_event_get_attendees (EM365Event *event); /* EM365Attendee * */
+void e_m365_event_begin_attendees (JsonBuilder *builder);
+void e_m365_event_end_attendees (JsonBuilder *builder);
+void e_m365_event_add_attendee (JsonBuilder *builder,
+ EM365AttendeeType type,
+ EM365ResponseType response,
+ time_t response_time,
+ const gchar *name,
+ const gchar *address);
+void e_m365_event_add_null_attendees (JsonBuilder *builder);
+EM365ItemBody * e_m365_event_get_body (EM365Event *event);
+void e_m365_event_add_body (JsonBuilder *builder,
+ EM365ItemBodyContentTypeType content_type,
+ const gchar *content);
+const gchar * e_m365_event_get_body_preview (EM365Event *event);
+JsonArray * e_m365_event_get_categories (EM365Event *event); /* const gchar * */
+void e_m365_event_begin_categories (JsonBuilder *builder);
+void e_m365_event_end_categories (JsonBuilder *builder);
+void e_m365_event_add_category (JsonBuilder *builder,
+ const gchar *category);
+time_t e_m365_event_get_created_date_time (EM365Event *event);
+EM365DateTimeWithZone *
+ e_m365_event_get_end (EM365Event *event);
+void e_m365_event_add_end (JsonBuilder *builder,
+ time_t date_time,
+ const gchar *zone);
+gboolean e_m365_event_get_has_attachments (EM365Event *event);
+const gchar * e_m365_event_get_ical_uid (EM365Event *event);
+EM365ImportanceType
+ e_m365_event_get_importance (EM365Event *event);
+void e_m365_event_add_importance (JsonBuilder *builder,
+ EM365ImportanceType value);
+gboolean e_m365_event_get_is_all_day (EM365Event *event);
+void e_m365_event_add_is_all_day (JsonBuilder *builder,
+ gboolean value);
+gboolean e_m365_event_get_is_cancelled (EM365Event *event);
+gboolean e_m365_event_get_is_online_meeting (EM365Event *event);
+void e_m365_event_add_is_online_meeting (JsonBuilder *builder,
+ gboolean value);
+gboolean e_m365_event_get_is_organizer (EM365Event *event);
+gboolean e_m365_event_get_is_reminder_on (EM365Event *event);
+void e_m365_event_add_is_reminder_on (JsonBuilder *builder,
+ gboolean value);
+time_t e_m365_event_get_last_modified_date_time(EM365Event *event);
+EM365Location * e_m365_event_get_location (EM365Event *event);
+void e_m365_event_begin_location (JsonBuilder *builder);
+void e_m365_event_end_location (JsonBuilder *builder);
+void e_m365_event_add_null_location (JsonBuilder *builder);
+JsonArray * e_m365_event_get_locations (EM365Event *event); /* EM365Location * */
+void e_m365_event_begin_locations (JsonBuilder *builder);
+void e_m365_event_end_locations (JsonBuilder *builder);
+void e_m365_event_begin_locations_location (JsonBuilder *builder);
+void e_m365_event_end_locations_location (JsonBuilder *builder);
+EM365OnlineMeetingInfo *
+ e_m365_event_get_online_meeting_info (EM365Event *event);
+EM365OnlineMeetingProviderType
+ e_m365_event_get_online_meeting_provider(EM365Event *event);
+void e_m365_event_add_online_meeting_provider(JsonBuilder *builder,
+ EM365OnlineMeetingProviderType value);
+const gchar * e_m365_event_get_online_meeting_url (EM365Event *event);
+EM365Recipient *e_m365_event_get_organizer (EM365Event *event);
+void e_m365_event_add_organizer (JsonBuilder *builder,
+ const gchar *name,
+ const gchar *address);
+void e_m365_event_add_null_organizer (JsonBuilder *builder);
+const gchar * e_m365_event_get_original_end_timezone (EM365Event *event);
+time_t e_m365_event_get_original_start (EM365Event *event);
+const gchar * e_m365_event_get_original_start_timezone(EM365Event *event);
+EM365PatternedRecurrence *
+ e_m365_event_get_recurrence (EM365Event *event);
+void e_m365_event_begin_recurrence (JsonBuilder *builder);
+void e_m365_event_end_recurrence (JsonBuilder *builder);
+void e_m365_event_add_null_recurrence (JsonBuilder *builder);
+gint e_m365_event_get_reminder_minutes_before_start
+ (EM365Event *event);
+void e_m365_event_add_reminder_minutes_before_start
+ (JsonBuilder *builder,
+ gint value);
+gboolean e_m365_event_get_response_requested (EM365Event *event);
+void e_m365_event_add_response_requested (JsonBuilder *builder,
+ gboolean value);
+EM365ResponseStatus *
+ e_m365_event_get_response_status (EM365Event *event);
+EM365SensitivityType
+ e_m365_event_get_sensitivity (EM365Event *event);
+void e_m365_event_add_sensitivity (JsonBuilder *builder,
+ EM365SensitivityType value);
+const gchar * e_m365_event_get_series_master_id (EM365Event *event);
+EM365FreeBusyStatusType
+ e_m365_event_get_show_as (EM365Event *event);
+void e_m365_event_add_show_as (JsonBuilder *builder,
+ EM365FreeBusyStatusType value);
+EM365DateTimeWithZone *
+ e_m365_event_get_start (EM365Event *event);
+void e_m365_event_add_start (JsonBuilder *builder,
+ time_t date_time,
+ const gchar *zone);
+const gchar * e_m365_event_get_subject (EM365Event *event);
+void e_m365_event_add_subject (JsonBuilder *builder,
+ const gchar *value);
+EM365EventTypeType
+ e_m365_event_get_type (EM365Event *event);
+const gchar * e_m365_event_get_web_link (EM365Event *event);
+
+G_END_DECLS
+
+#endif /* E_M365_JSON_UTILS_H */
diff --git a/src/Microsoft365/common/e-oauth2-service-microsoft365.c
b/src/Microsoft365/common/e-oauth2-service-microsoft365.c
new file mode 100644
index 00000000..550f1394
--- /dev/null
+++ b/src/Microsoft365/common/e-oauth2-service-microsoft365.c
@@ -0,0 +1,374 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "evolution-ews-config.h"
+
+#include <glib/gi18n-lib.h>
+#include <libedataserver/libedataserver.h>
+
+#include "camel-m365-settings.h"
+
+#include "e-oauth2-service-microsoft365.h"
+
+/* https://portal.azure.com/
+ https://docs.microsoft.com/en-us/graph/auth/
+
+ https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-developers-guide
+ https://tsmatz.wordpress.com/2016/10/07/application-permission-with-v2-endpoint-and-microsoft-graph/
+*/
+
+#define MICROSOFT365_SCOPE "Calendars.ReadWrite " \
+ "Calendars.ReadWrite.Shared " \
+ "Contacts.ReadWrite " \
+ "Contacts.ReadWrite.Shared " \
+ "Mail.ReadWrite " \
+ "Mail.ReadWrite.Shared " \
+ "Mail.Send " \
+ "Mail.Send.Shared " \
+ "MailboxSettings.Read " \
+ "Notes.Create " \
+ "Notes.ReadWrite.All " \
+ "offline_access " \
+ "Tasks.ReadWrite " \
+ "Tasks.ReadWrite.Shared "
+
+struct _EOAuth2ServiceMicrosoft365Private
+{
+ GMutex string_cache_lock;
+ GHashTable *string_cache;
+};
+
+/* Forward Declarations */
+static void e_oauth2_service_microsoft365_oauth2_service_init (EOAuth2ServiceInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (EOAuth2ServiceMicrosoft365, e_oauth2_service_microsoft365,
E_TYPE_OAUTH2_SERVICE_BASE, 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (E_TYPE_OAUTH2_SERVICE,
e_oauth2_service_microsoft365_oauth2_service_init)
+ G_ADD_PRIVATE_DYNAMIC (EOAuth2ServiceMicrosoft365))
+
+static const gchar *
+eos_microsoft365_cache_string (EOAuth2ServiceMicrosoft365 *oauth2_microsoft365,
+ gchar *str) /* takes ownership of the 'str' */
+{
+ const gchar *cached_str;
+
+ g_return_val_if_fail (E_IS_OAUTH2_SERVICE_MICROSOFT365 (oauth2_microsoft365), NULL);
+
+ if (!str)
+ return NULL;
+
+ if (!*str)
+ return "";
+
+ g_mutex_lock (&oauth2_microsoft365->priv->string_cache_lock);
+
+ cached_str = g_hash_table_lookup (oauth2_microsoft365->priv->string_cache, str);
+ if (cached_str) {
+ g_free (str);
+ } else {
+ g_hash_table_insert (oauth2_microsoft365->priv->string_cache, str, str);
+ cached_str = str;
+ }
+
+ g_mutex_unlock (&oauth2_microsoft365->priv->string_cache_lock);
+
+ return cached_str;
+}
+
+static CamelM365Settings *
+eos_microsoft365_get_camel_settings (ESource *source)
+{
+ ESourceCamel *extension;
+
+ if (!source)
+ return NULL;
+
+ g_return_val_if_fail (E_IS_SOURCE (source), NULL);
+
+ extension = e_source_get_extension (source, e_source_camel_get_extension_name ("microsoft365"));
+
+ return CAMEL_M365_SETTINGS (e_source_camel_get_settings (extension));
+}
+
+static gboolean
+eos_microsoft365_guess_can_process (EOAuth2Service *service,
+ const gchar *protocol,
+ const gchar *hostname)
+{
+ return e_oauth2_services_is_supported () &&
+ protocol && g_ascii_strcasecmp (protocol, "microsoft365") == 0;
+}
+
+static const gchar *
+eos_microsoft365_get_name (EOAuth2Service *service)
+{
+ return "Microsoft365";
+}
+
+static const gchar *
+eos_microsoft365_get_display_name (EOAuth2Service *service)
+{
+ /* Translators: This is a user-visible string, display name of an OAuth2 service. */
+ return C_("OAuth2Service", "Microsoft365");
+}
+
+static const gchar *
+eos_microsoft365_get_client_id (EOAuth2Service *service,
+ ESource *source)
+{
+ EOAuth2ServiceMicrosoft365 *oauth2_microsoft365 = E_OAUTH2_SERVICE_MICROSOFT365 (service);
+ CamelM365Settings *m365_settings;
+
+ m365_settings = eos_microsoft365_get_camel_settings (source);
+ if (m365_settings && camel_m365_settings_get_override_oauth2 (m365_settings)) {
+ gchar *client_id = camel_m365_settings_dup_oauth2_client_id (m365_settings);
+
+ if (client_id && !*client_id) {
+ g_free (client_id);
+ client_id = NULL;
+ }
+
+ if (client_id)
+ return eos_microsoft365_cache_string (oauth2_microsoft365, client_id);
+ }
+
+ return MICROSOFT365_CLIENT_ID;
+}
+
+static const gchar *
+eos_microsoft365_get_client_secret (EOAuth2Service *service,
+ ESource *source)
+{
+ return NULL;
+}
+
+static const gchar *
+eos_microsoft365_get_authentication_uri (EOAuth2Service *service,
+ ESource *source)
+{
+ EOAuth2ServiceMicrosoft365 *oauth2_microsoft365 = E_OAUTH2_SERVICE_MICROSOFT365 (service);
+ CamelM365Settings *m365_settings;
+
+ m365_settings = eos_microsoft365_get_camel_settings (source);
+ if (m365_settings && camel_m365_settings_get_override_oauth2 (m365_settings)) {
+ gchar *tenant;
+ const gchar *res;
+
+ tenant = camel_m365_settings_dup_oauth2_tenant (m365_settings);
+ if (tenant && !*tenant) {
+ g_free (tenant);
+ tenant = NULL;
+ }
+
+ res = eos_microsoft365_cache_string (oauth2_microsoft365,
+ g_strdup_printf ("https://login.microsoftonline.com/%s/oauth2/v2.0/authorize",
+ tenant ? tenant : MICROSOFT365_TENANT));
+
+ g_free (tenant);
+
+ return res;
+ }
+
+ return "https://login.microsoftonline.com/" MICROSOFT365_TENANT "/oauth2/v2.0/authorize";
+}
+
+static const gchar *
+eos_microsoft365_get_refresh_uri (EOAuth2Service *service,
+ ESource *source)
+{
+ EOAuth2ServiceMicrosoft365 *oauth2_microsoft365 = E_OAUTH2_SERVICE_MICROSOFT365 (service);
+ CamelM365Settings *m365_settings;
+
+ m365_settings = eos_microsoft365_get_camel_settings (source);
+ if (m365_settings && camel_m365_settings_get_override_oauth2 (m365_settings)) {
+ gchar *tenant;
+ const gchar *res;
+
+ tenant = camel_m365_settings_dup_oauth2_tenant (m365_settings);
+ if (tenant && !*tenant) {
+ g_free (tenant);
+ tenant = NULL;
+ }
+
+ res = eos_microsoft365_cache_string (oauth2_microsoft365,
+ g_strdup_printf ("https://login.microsoftonline.com/%s/oauth2/v2.0/token",
+ tenant ? tenant : MICROSOFT365_TENANT));
+
+ g_free (tenant);
+
+ return res;
+ }
+
+ return "https://login.microsoftonline.com/" MICROSOFT365_TENANT "/oauth2/v2.0/token";
+}
+
+static const gchar *
+eos_microsoft365_get_redirect_uri (EOAuth2Service *service,
+ ESource *source)
+{
+ EOAuth2ServiceMicrosoft365 *oauth2_microsoft365 = E_OAUTH2_SERVICE_MICROSOFT365 (service);
+ CamelM365Settings *m365_settings;
+ const gchar *res;
+
+ m365_settings = eos_microsoft365_get_camel_settings (source);
+ if (m365_settings && camel_m365_settings_get_override_oauth2 (m365_settings)) {
+ gchar *redirect_uri;
+
+ redirect_uri = camel_m365_settings_dup_oauth2_redirect_uri (m365_settings);
+
+ if (redirect_uri && !*redirect_uri) {
+ g_free (redirect_uri);
+ redirect_uri = NULL;
+ }
+
+ if (redirect_uri)
+ return eos_microsoft365_cache_string (oauth2_microsoft365, redirect_uri);
+ }
+
+ res = MICROSOFT365_REDIRECT_URI;
+ if (res && *res)
+ return res;
+
+ return "https://login.microsoftonline.com/common/oauth2/nativeclient";
+}
+
+static void
+eos_microsoft365_prepare_authentication_uri_query (EOAuth2Service *service,
+ ESource *source,
+ GHashTable *uri_query)
+{
+ g_return_if_fail (uri_query != NULL);
+
+ e_oauth2_service_util_set_to_form (uri_query, "response_type", "code");
+ e_oauth2_service_util_set_to_form (uri_query, "scope", MICROSOFT365_SCOPE);
+ e_oauth2_service_util_set_to_form (uri_query, "response_mode", "query");
+}
+
+static gboolean
+eos_microsoft365_extract_authorization_code (EOAuth2Service *service,
+ ESource *source,
+ const gchar *page_title,
+ const gchar *page_uri,
+ const gchar *page_content,
+ gchar **out_authorization_code)
+{
+ SoupURI *suri;
+ gboolean known = FALSE;
+
+ g_return_val_if_fail (out_authorization_code != NULL, FALSE);
+
+ *out_authorization_code = NULL;
+
+ if (!page_uri || !*page_uri)
+ return FALSE;
+
+ suri = soup_uri_new (page_uri);
+ if (!suri)
+ return FALSE;
+
+ if (suri->query) {
+ GHashTable *uri_query = soup_form_decode (suri->query);
+
+ if (uri_query) {
+ const gchar *code;
+
+ code = g_hash_table_lookup (uri_query, "code");
+
+ if (code && *code) {
+ *out_authorization_code = g_strdup (code);
+ known = TRUE;
+ } else if (g_hash_table_lookup (uri_query, "error")) {
+ known = TRUE;
+ if (g_strcmp0 (g_hash_table_lookup (uri_query, "error"), "access_denied") !=
0) {
+ const gchar *description;
+
+ description = g_hash_table_lookup (uri_query, "error_description");
+ if (description) {
+ g_warning ("%s: error:%s description:%s", G_STRFUNC,
+ (const gchar *) g_hash_table_lookup (uri_query,
"error"),
+ description);
+ }
+ }
+ }
+
+ g_hash_table_unref (uri_query);
+ }
+ }
+
+ soup_uri_free (suri);
+
+ return known;
+}
+
+static void
+eos_microsoft365_prepare_refresh_token_form (EOAuth2Service *service,
+ ESource *source,
+ const gchar *refresh_token,
+ GHashTable *form)
+{
+ g_return_if_fail (form != NULL);
+
+ e_oauth2_service_util_set_to_form (form, "scope", MICROSOFT365_SCOPE);
+ e_oauth2_service_util_set_to_form (form, "redirect_uri", e_oauth2_service_get_redirect_uri (service,
source));
+}
+
+static void
+eos_microsoft365_finalize (GObject *object)
+{
+ EOAuth2ServiceMicrosoft365 *oauth2_microsoft365 = E_OAUTH2_SERVICE_MICROSOFT365 (object);
+
+ g_mutex_lock (&oauth2_microsoft365->priv->string_cache_lock);
+ g_hash_table_destroy (oauth2_microsoft365->priv->string_cache);
+ g_mutex_unlock (&oauth2_microsoft365->priv->string_cache_lock);
+ g_mutex_clear (&oauth2_microsoft365->priv->string_cache_lock);
+
+ /* Chain up to parent's method. */
+ G_OBJECT_CLASS (e_oauth2_service_microsoft365_parent_class)->finalize (object);
+}
+
+static void
+e_oauth2_service_microsoft365_oauth2_service_init (EOAuth2ServiceInterface *iface)
+{
+ iface->guess_can_process = eos_microsoft365_guess_can_process;
+ iface->get_name = eos_microsoft365_get_name;
+ iface->get_display_name = eos_microsoft365_get_display_name;
+ iface->get_client_id = eos_microsoft365_get_client_id;
+ iface->get_client_secret = eos_microsoft365_get_client_secret;
+ iface->get_authentication_uri = eos_microsoft365_get_authentication_uri;
+ iface->get_refresh_uri = eos_microsoft365_get_refresh_uri;
+ iface->get_redirect_uri = eos_microsoft365_get_redirect_uri;
+ iface->prepare_authentication_uri_query = eos_microsoft365_prepare_authentication_uri_query;
+ iface->extract_authorization_code = eos_microsoft365_extract_authorization_code;
+ iface->prepare_refresh_token_form = eos_microsoft365_prepare_refresh_token_form;
+}
+
+static void
+e_oauth2_service_microsoft365_class_init (EOAuth2ServiceMicrosoft365Class *klass)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = eos_microsoft365_finalize;
+}
+
+static void
+e_oauth2_service_microsoft365_class_finalize (EOAuth2ServiceMicrosoft365Class *klass)
+{
+}
+
+static void
+e_oauth2_service_microsoft365_init (EOAuth2ServiceMicrosoft365 *oauth2_microsoft365)
+{
+ oauth2_microsoft365->priv = e_oauth2_service_microsoft365_get_instance_private (oauth2_microsoft365);
+
+ g_mutex_init (&oauth2_microsoft365->priv->string_cache_lock);
+ oauth2_microsoft365->priv->string_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
NULL);
+}
+
+void
+e_oauth2_service_microsoft365_type_register (GTypeModule *type_module)
+{
+ e_oauth2_service_microsoft365_register_type (type_module);
+}
diff --git a/src/Microsoft365/common/e-oauth2-service-microsoft365.h
b/src/Microsoft365/common/e-oauth2-service-microsoft365.h
new file mode 100644
index 00000000..0e76d93f
--- /dev/null
+++ b/src/Microsoft365/common/e-oauth2-service-microsoft365.h
@@ -0,0 +1,54 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_OAUTH2_SERVICE_MICROSOFT365_H
+#define E_OAUTH2_SERVICE_MICROSOFT365_H
+
+#include <gmodule.h>
+#include <libedataserver/libedataserver.h>
+
+/* Standard GObject macros */
+#define E_TYPE_OAUTH2_SERVICE_MICROSOFT365 \
+ (e_oauth2_service_microsoft365_get_type ())
+#define E_OAUTH2_SERVICE_MICROSOFT365(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_OAUTH2_SERVICE_MICROSOFT365, EOAuth2ServiceMicrosoft365))
+#define E_OAUTH2_SERVICE_MICROSOFT365_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_OAUTH2_SERVICE_MICROSOFT365, EOAuth2ServiceMicrosoft365Class))
+#define E_IS_OAUTH2_SERVICE_MICROSOFT365(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_OAUTH2_SERVICE_MICROSOFT365))
+#define E_IS_OAUTH2_SERVICE_MICROSOFT365_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_OAUTH2_SERVICE_MICROSOFT365))
+#define E_OAUTH2_SERVICE_MICROSOFT365_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_OAUTH2_SERVICE_MICROSOFT365, EOAuth2ServiceMicrosoft365Class))
+
+G_BEGIN_DECLS
+
+typedef struct _EOAuth2ServiceMicrosoft365 EOAuth2ServiceMicrosoft365;
+typedef struct _EOAuth2ServiceMicrosoft365Class EOAuth2ServiceMicrosoft365Class;
+typedef struct _EOAuth2ServiceMicrosoft365Private EOAuth2ServiceMicrosoft365Private;
+
+struct _EOAuth2ServiceMicrosoft365 {
+ EOAuth2ServiceBase parent;
+ EOAuth2ServiceMicrosoft365Private *priv;
+};
+
+struct _EOAuth2ServiceMicrosoft365Class {
+ EOAuth2ServiceBaseClass parent_class;
+};
+
+GType e_oauth2_service_microsoft365_get_type (void) G_GNUC_CONST;
+
+void e_oauth2_service_microsoft365_type_register
+ (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_OAUTH2_SERVICE_MICROSOFT365_H */
diff --git a/src/Office365/common/e-source-o365-folder.c b/src/Microsoft365/common/e-source-m365-folder.c
similarity index 57%
rename from src/Office365/common/e-source-o365-folder.c
rename to src/Microsoft365/common/e-source-m365-folder.c
index d8321f5a..d4040a90 100644
--- a/src/Office365/common/e-source-o365-folder.c
+++ b/src/Microsoft365/common/e-source-m365-folder.c
@@ -1,25 +1,14 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
-#include "e-source-o365-folder.h"
+#include "e-source-m365-folder.h"
-struct _ESourceO365FolderPrivate {
+struct _ESourceM365FolderPrivate {
gchar *id;
gchar *group_id;
gboolean is_default;
@@ -32,30 +21,30 @@ enum {
PROP_GROUP_ID
};
-G_DEFINE_TYPE_WITH_PRIVATE (ESourceO365Folder, e_source_o365_folder, E_TYPE_SOURCE_EXTENSION)
+G_DEFINE_TYPE_WITH_PRIVATE (ESourceM365Folder, e_source_m365_folder, E_TYPE_SOURCE_EXTENSION)
static void
-source_o365_folder_set_property (GObject *object,
+source_m365_folder_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
case PROP_IS_DEFAULT:
- e_source_o365_folder_set_is_default (
- E_SOURCE_O365_FOLDER (object),
+ e_source_m365_folder_set_is_default (
+ E_SOURCE_M365_FOLDER (object),
g_value_get_boolean (value));
return;
case PROP_ID:
- e_source_o365_folder_set_id (
- E_SOURCE_O365_FOLDER (object),
+ e_source_m365_folder_set_id (
+ E_SOURCE_M365_FOLDER (object),
g_value_get_string (value));
return;
case PROP_GROUP_ID:
- e_source_o365_folder_set_group_id (
- E_SOURCE_O365_FOLDER (object),
+ e_source_m365_folder_set_group_id (
+ E_SOURCE_M365_FOLDER (object),
g_value_get_string (value));
return;
}
@@ -64,7 +53,7 @@ source_o365_folder_set_property (GObject *object,
}
static void
-source_o365_folder_get_property (GObject *object,
+source_m365_folder_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
@@ -73,22 +62,22 @@ source_o365_folder_get_property (GObject *object,
case PROP_IS_DEFAULT:
g_value_set_boolean (
value,
- e_source_o365_folder_get_is_default (
- E_SOURCE_O365_FOLDER (object)));
+ e_source_m365_folder_get_is_default (
+ E_SOURCE_M365_FOLDER (object)));
return;
case PROP_ID:
g_value_take_string (
value,
- e_source_o365_folder_dup_id (
- E_SOURCE_O365_FOLDER (object)));
+ e_source_m365_folder_dup_id (
+ E_SOURCE_M365_FOLDER (object)));
return;
case PROP_GROUP_ID:
g_value_take_string (
value,
- e_source_o365_folder_dup_group_id (
- E_SOURCE_O365_FOLDER (object)));
+ e_source_m365_folder_dup_group_id (
+ E_SOURCE_M365_FOLDER (object)));
return;
}
@@ -96,30 +85,30 @@ source_o365_folder_get_property (GObject *object,
}
static void
-source_o365_folder_finalize (GObject *object)
+source_m365_folder_finalize (GObject *object)
{
- ESourceO365Folder *o365_folder = E_SOURCE_O365_FOLDER (object);
+ ESourceM365Folder *m365_folder = E_SOURCE_M365_FOLDER (object);
- g_free (o365_folder->priv->id);
- g_free (o365_folder->priv->group_id);
+ g_free (m365_folder->priv->id);
+ g_free (m365_folder->priv->group_id);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_source_o365_folder_parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_source_m365_folder_parent_class)->finalize (object);
}
static void
-e_source_o365_folder_class_init (ESourceO365FolderClass *class)
+e_source_m365_folder_class_init (ESourceM365FolderClass *class)
{
GObjectClass *object_class;
ESourceExtensionClass *extension_class;
object_class = G_OBJECT_CLASS (class);
- object_class->set_property = source_o365_folder_set_property;
- object_class->get_property = source_o365_folder_get_property;
- object_class->finalize = source_o365_folder_finalize;
+ object_class->set_property = source_m365_folder_set_property;
+ object_class->get_property = source_m365_folder_get_property;
+ object_class->finalize = source_m365_folder_finalize;
extension_class = E_SOURCE_EXTENSION_CLASS (class);
- extension_class->name = E_SOURCE_EXTENSION_O365_FOLDER;
+ extension_class->name = E_SOURCE_EXTENSION_M365_FOLDER;
g_object_class_install_property (
object_class,
@@ -162,38 +151,38 @@ e_source_o365_folder_class_init (ESourceO365FolderClass *class)
}
static void
-e_source_o365_folder_init (ESourceO365Folder *extension)
+e_source_m365_folder_init (ESourceM365Folder *extension)
{
- extension->priv = e_source_o365_folder_get_instance_private (extension);
+ extension->priv = e_source_m365_folder_get_instance_private (extension);
}
void
-e_source_o365_folder_type_register (GTypeModule *type_module)
+e_source_m365_folder_type_register (GTypeModule *type_module)
{
/* We need to ensure this is registered, because it's looked up
* by name in e_source_get_extension(). */
- g_type_ensure (E_TYPE_SOURCE_O365_FOLDER);
+ g_type_ensure (E_TYPE_SOURCE_M365_FOLDER);
}
const gchar *
-e_source_o365_folder_get_id (ESourceO365Folder *extension)
+e_source_m365_folder_get_id (ESourceM365Folder *extension)
{
- g_return_val_if_fail (E_IS_SOURCE_O365_FOLDER (extension), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_M365_FOLDER (extension), NULL);
return extension->priv->id;
}
gchar *
-e_source_o365_folder_dup_id (ESourceO365Folder *extension)
+e_source_m365_folder_dup_id (ESourceM365Folder *extension)
{
const gchar *protected;
gchar *duplicate;
- g_return_val_if_fail (E_IS_SOURCE_O365_FOLDER (extension), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_M365_FOLDER (extension), NULL);
e_source_extension_property_lock (E_SOURCE_EXTENSION (extension));
- protected = e_source_o365_folder_get_id (extension);
+ protected = e_source_m365_folder_get_id (extension);
duplicate = g_strdup (protected);
e_source_extension_property_unlock (E_SOURCE_EXTENSION (extension));
@@ -202,10 +191,10 @@ e_source_o365_folder_dup_id (ESourceO365Folder *extension)
}
void
-e_source_o365_folder_set_id (ESourceO365Folder *extension,
+e_source_m365_folder_set_id (ESourceM365Folder *extension,
const gchar *id)
{
- g_return_if_fail (E_IS_SOURCE_O365_FOLDER (extension));
+ g_return_if_fail (E_IS_SOURCE_M365_FOLDER (extension));
e_source_extension_property_lock (E_SOURCE_EXTENSION (extension));
@@ -223,18 +212,18 @@ e_source_o365_folder_set_id (ESourceO365Folder *extension,
}
gboolean
-e_source_o365_folder_get_is_default (ESourceO365Folder *extension)
+e_source_m365_folder_get_is_default (ESourceM365Folder *extension)
{
- g_return_val_if_fail (E_IS_SOURCE_O365_FOLDER (extension), FALSE);
+ g_return_val_if_fail (E_IS_SOURCE_M365_FOLDER (extension), FALSE);
return extension->priv->is_default;
}
void
-e_source_o365_folder_set_is_default (ESourceO365Folder *extension,
+e_source_m365_folder_set_is_default (ESourceM365Folder *extension,
gboolean value)
{
- g_return_if_fail (E_IS_SOURCE_O365_FOLDER (extension));
+ g_return_if_fail (E_IS_SOURCE_M365_FOLDER (extension));
e_source_extension_property_lock (E_SOURCE_EXTENSION (extension));
@@ -251,24 +240,24 @@ e_source_o365_folder_set_is_default (ESourceO365Folder *extension,
}
const gchar *
-e_source_o365_folder_get_group_id (ESourceO365Folder *extension)
+e_source_m365_folder_get_group_id (ESourceM365Folder *extension)
{
- g_return_val_if_fail (E_IS_SOURCE_O365_FOLDER (extension), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_M365_FOLDER (extension), NULL);
return extension->priv->group_id;
}
gchar *
-e_source_o365_folder_dup_group_id (ESourceO365Folder *extension)
+e_source_m365_folder_dup_group_id (ESourceM365Folder *extension)
{
const gchar *protected;
gchar *duplicate;
- g_return_val_if_fail (E_IS_SOURCE_O365_FOLDER (extension), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_M365_FOLDER (extension), NULL);
e_source_extension_property_lock (E_SOURCE_EXTENSION (extension));
- protected = e_source_o365_folder_get_group_id (extension);
+ protected = e_source_m365_folder_get_group_id (extension);
duplicate = g_strdup (protected);
e_source_extension_property_unlock (E_SOURCE_EXTENSION (extension));
@@ -277,10 +266,10 @@ e_source_o365_folder_dup_group_id (ESourceO365Folder *extension)
}
void
-e_source_o365_folder_set_group_id (ESourceO365Folder *extension,
+e_source_m365_folder_set_group_id (ESourceM365Folder *extension,
const gchar *group_id)
{
- g_return_if_fail (E_IS_SOURCE_O365_FOLDER (extension));
+ g_return_if_fail (E_IS_SOURCE_M365_FOLDER (extension));
e_source_extension_property_lock (E_SOURCE_EXTENSION (extension));
diff --git a/src/Microsoft365/common/e-source-m365-folder.h b/src/Microsoft365/common/e-source-m365-folder.h
new file mode 100644
index 00000000..0f8750e8
--- /dev/null
+++ b/src/Microsoft365/common/e-source-m365-folder.h
@@ -0,0 +1,70 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_SOURCE_M365_FOLDER_H
+#define E_SOURCE_M365_FOLDER_H
+
+#include <libedataserver/libedataserver.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SOURCE_M365_FOLDER \
+ (e_source_m365_folder_get_type ())
+#define E_SOURCE_M365_FOLDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SOURCE_M365_FOLDER, ESourceM365Folder))
+#define E_SOURCE_M365_FOLDER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SOURCE_M365_FOLDER, ESourceM365FolderClass))
+#define E_IS_SOURCE_M365_FOLDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SOURCE_M365_FOLDER))
+#define E_IS_SOURCE_M365_FOLDER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SOURCE_M365_FOLDER))
+#define E_SOURCE_M365_FOLDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SOURCE_M365_FOLDER, ESourceM365FolderClass))
+
+#define E_SOURCE_EXTENSION_M365_FOLDER "Microsoft365 Folder"
+
+G_BEGIN_DECLS
+
+typedef struct _ESourceM365Folder ESourceM365Folder;
+typedef struct _ESourceM365FolderClass ESourceM365FolderClass;
+typedef struct _ESourceM365FolderPrivate ESourceM365FolderPrivate;
+
+struct _ESourceM365Folder {
+ ESourceExtension parent;
+ ESourceM365FolderPrivate *priv;
+};
+
+struct _ESourceM365FolderClass {
+ ESourceExtensionClass parent_class;
+};
+
+GType e_source_m365_folder_get_type (void) G_GNUC_CONST;
+void e_source_m365_folder_type_register
+ (GTypeModule *type_module);
+const gchar * e_source_m365_folder_get_id (ESourceM365Folder *extension);
+gchar * e_source_m365_folder_dup_id (ESourceM365Folder *extension);
+void e_source_m365_folder_set_id (ESourceM365Folder *extension,
+ const gchar *id);
+gboolean e_source_m365_folder_get_is_default
+ (ESourceM365Folder *extension);
+void e_source_m365_folder_set_is_default
+ (ESourceM365Folder *extension,
+ gboolean value);
+const gchar * e_source_m365_folder_get_group_id
+ (ESourceM365Folder *extension);
+gchar * e_source_m365_folder_dup_group_id
+ (ESourceM365Folder *extension);
+void e_source_m365_folder_set_group_id
+ (ESourceM365Folder *extension,
+ const gchar *group_id);
+
+G_END_DECLS
+
+#endif /* E_SOURCE_M365_FOLDER_H */
diff --git a/src/Office365/evolution/CMakeLists.txt b/src/Microsoft365/evolution/CMakeLists.txt
similarity index 68%
rename from src/Office365/evolution/CMakeLists.txt
rename to src/Microsoft365/evolution/CMakeLists.txt
index eb4db02d..e239083b 100644
--- a/src/Office365/evolution/CMakeLists.txt
+++ b/src/Microsoft365/evolution/CMakeLists.txt
@@ -1,11 +1,11 @@
set(sources
- e-cal-config-o365.c
- e-cal-config-o365.h
- e-book-config-o365.c
- e-book-config-o365.h
- e-mail-config-o365-backend.c
- e-mail-config-o365-backend.h
- module-o365-configuration.c
+ e-cal-config-m365.c
+ e-cal-config-m365.h
+ e-book-config-m365.c
+ e-book-config-m365.h
+ e-mail-config-m365-backend.c
+ e-mail-config-m365-backend.h
+ module-m365-configuration.c
)
set(extra_deps)
set(extra_defines)
@@ -28,7 +28,7 @@ set(extra_ldflags
${LIBEBOOK_LDFLAGS}
)
-add_simple_module_o365(module-office365-configuration
+add_simple_module_m365(module-microsoft365-configuration
sources
extra_deps
extra_defines
diff --git a/src/Microsoft365/evolution/e-book-config-m365.c b/src/Microsoft365/evolution/e-book-config-m365.c
new file mode 100644
index 00000000..2d7b54c8
--- /dev/null
+++ b/src/Microsoft365/evolution/e-book-config-m365.c
@@ -0,0 +1,66 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "evolution-ews-config.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "common/camel-m365-settings.h"
+#include "common/e-source-m365-folder.h"
+
+#include "e-book-config-m365.h"
+
+G_DEFINE_DYNAMIC_TYPE (EBookConfigM365, e_book_config_m365, E_TYPE_SOURCE_CONFIG_BACKEND)
+
+static gboolean
+book_config_m365_allow_creation (ESourceConfigBackend *backend)
+{
+ return TRUE;
+}
+
+static void
+book_config_m365_insert_widgets (ESourceConfigBackend *backend,
+ ESource *scratch_source)
+{
+ if (!scratch_source)
+ return;
+
+ e_source_config_add_refresh_interval (e_source_config_backend_get_config (backend), scratch_source);
+}
+
+static void
+e_book_config_m365_class_init (EBookConfigM365Class *class)
+{
+ EExtensionClass *extension_class;
+ ESourceConfigBackendClass *backend_class;
+
+ extension_class = E_EXTENSION_CLASS (class);
+ extension_class->extensible_type = E_TYPE_BOOK_SOURCE_CONFIG;
+
+ backend_class = E_SOURCE_CONFIG_BACKEND_CLASS (class);
+ backend_class->backend_name = "microsoft365";
+ backend_class->allow_creation = book_config_m365_allow_creation;
+ backend_class->insert_widgets = book_config_m365_insert_widgets;
+}
+
+static void
+e_book_config_m365_class_finalize (EBookConfigM365Class *class)
+{
+}
+
+static void
+e_book_config_m365_init (EBookConfigM365 *backend)
+{
+}
+
+void
+e_book_config_m365_type_register (GTypeModule *type_module)
+{
+ /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+ * function, so we have to wrap it with a public function in
+ * order to register types from a separate compilation unit. */
+ e_book_config_m365_register_type (type_module);
+}
diff --git a/src/Microsoft365/evolution/e-book-config-m365.h b/src/Microsoft365/evolution/e-book-config-m365.h
new file mode 100644
index 00000000..e619282d
--- /dev/null
+++ b/src/Microsoft365/evolution/e-book-config-m365.h
@@ -0,0 +1,51 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_BOOK_CONFIG_M365_H
+#define E_BOOK_CONFIG_M365_H
+
+#include <e-util/e-util.h>
+
+/* Standard GObject macros */
+#define E_TYPE_BOOK_CONFIG_M365 \
+ (e_book_config_m365_get_type ())
+#define E_BOOK_CONFIG_M365(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_BOOK_CONFIG_M365, EBookConfigM365))
+#define E_BOOK_CONFIG_M365_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_BOOK_CONFIG_M365, EBookConfigM365Class))
+#define E_IS_BOOK_CONFIG_M365(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_BOOK_CONFIG_M365))
+#define E_IS_BOOK_CONFIG_M365_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_BOOK_CONFIG_M365))
+#define E_BOOK_CONFIG_M365_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_BOOK_CONFIG_M365, EBookConfigM365Class))
+
+G_BEGIN_DECLS
+
+typedef struct _EBookConfigM365 EBookConfigM365;
+typedef struct _EBookConfigM365Class EBookConfigM365Class;
+typedef struct _EBookConfigM365Private EBookConfigM365Private;
+
+struct _EBookConfigM365 {
+ ESourceConfigBackend parent;
+ EBookConfigM365Private *priv;
+};
+
+struct _EBookConfigM365Class {
+ ESourceConfigBackendClass parent_class;
+};
+
+GType e_book_config_m365_get_type (void) G_GNUC_CONST;
+void e_book_config_m365_type_register(GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_BOOK_CONFIG_M365_H */
diff --git a/src/Office365/evolution/e-cal-config-o365.c b/src/Microsoft365/evolution/e-cal-config-m365.c
similarity index 50%
rename from src/Office365/evolution/e-cal-config-o365.c
rename to src/Microsoft365/evolution/e-cal-config-m365.c
index 663da38e..1f53bb34 100644
--- a/src/Office365/evolution/e-cal-config-o365.c
+++ b/src/Microsoft365/evolution/e-cal-config-m365.c
@@ -1,28 +1,17 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
-#include "e-cal-config-o365.h"
+#include "e-cal-config-m365.h"
-G_DEFINE_DYNAMIC_TYPE (ECalConfigO365, e_cal_config_o365, E_TYPE_SOURCE_CONFIG_BACKEND)
+G_DEFINE_DYNAMIC_TYPE (ECalConfigM365, e_cal_config_m365, E_TYPE_SOURCE_CONFIG_BACKEND)
static gboolean
-cal_config_o365_allow_creation (ESourceConfigBackend *backend)
+cal_config_m365_allow_creation (ESourceConfigBackend *backend)
{
ESourceConfig *config;
ECalSourceConfig *cal_config;
@@ -48,7 +37,7 @@ cal_config_o365_allow_creation (ESourceConfigBackend *backend)
}
static void
-cal_config_o365_insert_widgets (ESourceConfigBackend *backend,
+cal_config_m365_insert_widgets (ESourceConfigBackend *backend,
ESource *scratch_source)
{
if (!scratch_source)
@@ -58,7 +47,7 @@ cal_config_o365_insert_widgets (ESourceConfigBackend *backend,
}
static void
-e_cal_config_o365_class_init (ECalConfigO365Class *class)
+e_cal_config_m365_class_init (ECalConfigM365Class *class)
{
EExtensionClass *extension_class;
ESourceConfigBackendClass *backend_class;
@@ -67,26 +56,26 @@ e_cal_config_o365_class_init (ECalConfigO365Class *class)
extension_class->extensible_type = E_TYPE_CAL_SOURCE_CONFIG;
backend_class = E_SOURCE_CONFIG_BACKEND_CLASS (class);
- backend_class->backend_name = "office365";
- backend_class->allow_creation = cal_config_o365_allow_creation;
- backend_class->insert_widgets = cal_config_o365_insert_widgets;
+ backend_class->backend_name = "microsoft365";
+ backend_class->allow_creation = cal_config_m365_allow_creation;
+ backend_class->insert_widgets = cal_config_m365_insert_widgets;
}
static void
-e_cal_config_o365_class_finalize (ECalConfigO365Class *class)
+e_cal_config_m365_class_finalize (ECalConfigM365Class *class)
{
}
static void
-e_cal_config_o365_init (ECalConfigO365 *backend)
+e_cal_config_m365_init (ECalConfigM365 *backend)
{
}
void
-e_cal_config_o365_type_register (GTypeModule *type_module)
+e_cal_config_m365_type_register (GTypeModule *type_module)
{
/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
* function, so we have to wrap it with a public function in
* order to register types from a separate compilation unit. */
- e_cal_config_o365_register_type (type_module);
+ e_cal_config_m365_register_type (type_module);
}
diff --git a/src/Microsoft365/evolution/e-cal-config-m365.h b/src/Microsoft365/evolution/e-cal-config-m365.h
new file mode 100644
index 00000000..9ac9b574
--- /dev/null
+++ b/src/Microsoft365/evolution/e-cal-config-m365.h
@@ -0,0 +1,51 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_CAL_CONFIG_M365_H
+#define E_CAL_CONFIG_M365_H
+
+#include <e-util/e-util.h>
+
+/* Standard GObject macros */
+#define E_TYPE_CAL_CONFIG_M365 \
+ (e_cal_config_m365_get_type ())
+#define E_CAL_CONFIG_M365(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_CONFIG_M365, ECalConfigM365))
+#define E_CAL_CONFIG_M365_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CAL_CONFIG_M365, ECalConfigM365Class))
+#define E_IS_CAL_CONFIG_M365(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_CONFIG_M365))
+#define E_IS_CAL_CONFIG_M365_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_CONFIG_M365))
+#define E_CAL_CONFIG_M365_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_CONFIG_M365, ECalConfigM365Class))
+
+G_BEGIN_DECLS
+
+typedef struct _ECalConfigM365 ECalConfigM365;
+typedef struct _ECalConfigM365Class ECalConfigM365Class;
+typedef struct _ECalConfigM365Private ECalConfigM365Private;
+
+struct _ECalConfigM365 {
+ ESourceConfigBackend parent;
+ ECalConfigM365Private *priv;
+};
+
+struct _ECalConfigM365Class {
+ ESourceConfigBackendClass parent_class;
+};
+
+GType e_cal_config_m365_get_type (void) G_GNUC_CONST;
+void e_cal_config_m365_type_register (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_CAL_CONFIG_M365_H */
diff --git a/src/Office365/evolution/e-mail-config-o365-backend.c
b/src/Microsoft365/evolution/e-mail-config-m365-backend.c
similarity index 70%
rename from src/Office365/evolution/e-mail-config-o365-backend.c
rename to src/Microsoft365/evolution/e-mail-config-m365-backend.c
index 2c627e39..8da11fb4 100644
--- a/src/Office365/evolution/e-mail-config-o365-backend.c
+++ b/src/Microsoft365/evolution/e-mail-config-m365-backend.c
@@ -1,18 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
@@ -25,12 +14,12 @@
#include <mail/e-mail-config-auth-check.h>
#include <mail/e-mail-config-receiving-page.h>
-#include "common/camel-o365-settings.h"
-#include "common/e-o365-connection.h"
+#include "common/camel-m365-settings.h"
+#include "common/e-m365-connection.h"
-#include "e-mail-config-o365-backend.h"
+#include "e-mail-config-m365-backend.h"
-struct _EMailConfigO365BackendPrivate {
+struct _EMailConfigM365BackendPrivate {
GtkWidget *user_entry;
GtkWidget *impersonate_user_entry;
GtkGrid *oauth2_settings_grid;
@@ -40,11 +29,11 @@ struct _EMailConfigO365BackendPrivate {
GtkWidget *oauth2_redirect_uri_entry;
};
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (EMailConfigO365Backend, e_mail_config_o365_backend,
E_TYPE_MAIL_CONFIG_SERVICE_BACKEND, 0,
- G_ADD_PRIVATE_DYNAMIC (EMailConfigO365Backend))
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (EMailConfigM365Backend, e_mail_config_m365_backend,
E_TYPE_MAIL_CONFIG_SERVICE_BACKEND, 0,
+ G_ADD_PRIVATE_DYNAMIC (EMailConfigM365Backend))
static ESource *
-mail_config_o365_backend_new_collection (EMailConfigServiceBackend *backend)
+mail_config_m365_backend_new_collection (EMailConfigServiceBackend *backend)
{
EMailConfigServiceBackendClass *class;
ESourceBackend *extension;
@@ -57,7 +46,7 @@ mail_config_o365_backend_new_collection (EMailConfigServiceBackend *backend)
* the backend is associated with. We return a new collection
* for both the Receiving Page and Sending Page. Although the
* Sending Page instance ultimately gets discarded, it's still
- * needed to avoid creating an [Office365 Backend] extension
+ * needed to avoid creating an [Microsoft365 Backend] extension
* in the mail transport source. */
class = E_MAIL_CONFIG_SERVICE_BACKEND_GET_CLASS (backend);
@@ -71,7 +60,7 @@ mail_config_o365_backend_new_collection (EMailConfigServiceBackend *backend)
}
static void
-mail_config_o365_backend_set_oauth2_tooltip (GtkWidget *widget,
+mail_config_m365_backend_set_oauth2_tooltip (GtkWidget *widget,
const gchar *value,
const gchar *when_value_empty,
gchar *when_value_filled) /* takes ownership */
@@ -84,10 +73,10 @@ mail_config_o365_backend_set_oauth2_tooltip (GtkWidget *widget,
}
static void
-mail_config_o365_backend_insert_widgets (EMailConfigServiceBackend *backend,
+mail_config_m365_backend_insert_widgets (EMailConfigServiceBackend *backend,
GtkBox *parent)
{
- EMailConfigO365Backend *o365_backend;
+ EMailConfigM365Backend *m365_backend;
EMailConfigServicePage *page;
ESource *source;
ESourceExtension *extension;
@@ -100,7 +89,7 @@ mail_config_o365_backend_insert_widgets (EMailConfigServiceBackend *backend,
const gchar *text;
gchar *markup;
- o365_backend = E_MAIL_CONFIG_O365_BACKEND (backend);
+ m365_backend = E_MAIL_CONFIG_M365_BACKEND (backend);
page = e_mail_config_service_backend_get_page (backend);
/* This backend serves double duty. One instance holds the
@@ -144,19 +133,19 @@ mail_config_o365_backend_insert_widgets (EMailConfigServiceBackend *backend,
gtk_widget_set_hexpand (widget, TRUE);
gtk_label_set_mnemonic_widget (label, widget);
gtk_grid_attach (GTK_GRID (container), widget, 1, 0, 2, 1);
- o365_backend->priv->user_entry = widget; /* do not reference */
+ m365_backend->priv->user_entry = widget; /* do not reference */
gtk_widget_show (widget);
widget = gtk_check_button_new_with_mnemonic (_("Open _Mailbox of other user"));
gtk_grid_attach (GTK_GRID (container), widget, 1, 1, 1, 1);
gtk_widget_show (widget);
- if (camel_o365_settings_get_use_impersonation (CAMEL_O365_SETTINGS (settings))) {
- const gchar *impersonate_user = camel_o365_settings_get_impersonate_user (CAMEL_O365_SETTINGS
(settings));
+ if (camel_m365_settings_get_use_impersonation (CAMEL_M365_SETTINGS (settings))) {
+ const gchar *impersonate_user = camel_m365_settings_get_impersonate_user (CAMEL_M365_SETTINGS
(settings));
if (impersonate_user && !*impersonate_user) {
- camel_o365_settings_set_impersonate_user (CAMEL_O365_SETTINGS (settings), NULL);
- camel_o365_settings_set_use_impersonation (CAMEL_O365_SETTINGS (settings), FALSE);
+ camel_m365_settings_set_impersonate_user (CAMEL_M365_SETTINGS (settings), NULL);
+ camel_m365_settings_set_use_impersonation (CAMEL_M365_SETTINGS (settings), FALSE);
}
}
@@ -169,7 +158,7 @@ mail_config_o365_backend_insert_widgets (EMailConfigServiceBackend *backend,
gtk_widget_set_hexpand (widget, TRUE);
gtk_grid_attach (GTK_GRID (container), widget, 1, 2, 1, 1);
gtk_widget_show (widget);
- o365_backend->priv->impersonate_user_entry = widget; /* do not reference */
+ m365_backend->priv->impersonate_user_entry = widget; /* do not reference */
e_binding_bind_object_text_property (
settings, "impersonate-user",
@@ -194,17 +183,17 @@ mail_config_o365_backend_insert_widgets (EMailConfigServiceBackend *backend,
widget = gtk_grid_new ();
gtk_widget_set_margin_left (widget, 12);
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
- o365_backend->priv->oauth2_settings_grid = GTK_GRID (widget);
+ m365_backend->priv->oauth2_settings_grid = GTK_GRID (widget);
- gtk_grid_set_column_spacing (o365_backend->priv->oauth2_settings_grid, 4);
- gtk_grid_set_row_spacing (o365_backend->priv->oauth2_settings_grid, 4);
+ gtk_grid_set_column_spacing (m365_backend->priv->oauth2_settings_grid, 4);
+ gtk_grid_set_row_spacing (m365_backend->priv->oauth2_settings_grid, 4);
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_grid_attach (o365_backend->priv->oauth2_settings_grid, container, 0, 0, 2, 1);
+ gtk_grid_attach (m365_backend->priv->oauth2_settings_grid, container, 0, 0, 2, 1);
- widget = gtk_check_button_new_with_mnemonic (_("_Override Office365 OAuth2 settings"));
+ widget = gtk_check_button_new_with_mnemonic (_("_Override Microsoft 365 OAuth2 settings"));
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- o365_backend->priv->oauth2_override_check = widget;
+ m365_backend->priv->oauth2_override_check = widget;
markup = g_markup_printf_escaped ("(<a
href=\"https://wiki.gnome.org/Apps/Evolution/EWS/OAuth2\">%s</a>)", _("Help…"));
widget = gtk_label_new (markup);
@@ -218,116 +207,116 @@ mail_config_o365_backend_insert_widgets (EMailConfigServiceBackend *backend,
widget = gtk_label_new_with_mnemonic (_("_Tenant:"));
gtk_widget_set_margin_left (widget, 12);
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
- gtk_grid_attach (o365_backend->priv->oauth2_settings_grid, widget, 0, 1, 1, 1);
+ gtk_grid_attach (m365_backend->priv->oauth2_settings_grid, widget, 0, 1, 1, 1);
label = GTK_LABEL (widget);
e_binding_bind_property (
- o365_backend->priv->oauth2_override_check, "active",
+ m365_backend->priv->oauth2_override_check, "active",
widget, "sensitive",
G_BINDING_SYNC_CREATE);
widget = gtk_entry_new ();
gtk_widget_set_hexpand (widget, TRUE);
gtk_label_set_mnemonic_widget (label, widget);
- gtk_grid_attach (o365_backend->priv->oauth2_settings_grid, widget, 1, 1, 1, 1);
- o365_backend->priv->oauth2_tenant_entry = widget;
+ gtk_grid_attach (m365_backend->priv->oauth2_settings_grid, widget, 1, 1, 1, 1);
+ m365_backend->priv->oauth2_tenant_entry = widget;
e_binding_bind_property (
- o365_backend->priv->oauth2_override_check, "active",
+ m365_backend->priv->oauth2_override_check, "active",
widget, "sensitive",
G_BINDING_SYNC_CREATE);
- mail_config_o365_backend_set_oauth2_tooltip (widget, OFFICE365_TENANT,
+ mail_config_m365_backend_set_oauth2_tooltip (widget, MICROSOFT365_TENANT,
/* Translators: 'Tenant' here means a term used by Microsoft to identify a company or
organization in a Microsoft 365 world. Same for 'common', it's a default URL path.
You probably do not want to translate it. More for example here:
https://powerbi.microsoft.com/en-us/blog/what-is-a-tenant/ */
_("Default tenant is “common“"),
/* Translators: 'Tenant' here means a term used by Microsoft to identify a company or
organization in a Microsoft 365 world.
You probably do not want to translate it. More for example here:
https://powerbi.microsoft.com/en-us/blog/what-is-a-tenant/ */
- g_strdup_printf (_("Default tenant is “%s”"), OFFICE365_TENANT));
+ g_strdup_printf (_("Default tenant is “%s”"), MICROSOFT365_TENANT));
widget = gtk_label_new_with_mnemonic (_("Application I_D:"));
gtk_widget_set_margin_left (widget, 12);
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
- gtk_grid_attach (o365_backend->priv->oauth2_settings_grid, widget, 0, 2, 1, 1);
+ gtk_grid_attach (m365_backend->priv->oauth2_settings_grid, widget, 0, 2, 1, 1);
label = GTK_LABEL (widget);
e_binding_bind_property (
- o365_backend->priv->oauth2_override_check, "active",
+ m365_backend->priv->oauth2_override_check, "active",
widget, "sensitive",
G_BINDING_SYNC_CREATE);
widget = gtk_entry_new ();
gtk_widget_set_hexpand (widget, TRUE);
gtk_label_set_mnemonic_widget (label, widget);
- gtk_grid_attach (o365_backend->priv->oauth2_settings_grid, widget, 1, 2, 1, 1);
- o365_backend->priv->oauth2_client_id_entry = widget;
+ gtk_grid_attach (m365_backend->priv->oauth2_settings_grid, widget, 1, 2, 1, 1);
+ m365_backend->priv->oauth2_client_id_entry = widget;
e_binding_bind_property (
- o365_backend->priv->oauth2_override_check, "active",
+ m365_backend->priv->oauth2_override_check, "active",
widget, "sensitive",
G_BINDING_SYNC_CREATE);
- mail_config_o365_backend_set_oauth2_tooltip (widget, OFFICE365_CLIENT_ID,
+ mail_config_m365_backend_set_oauth2_tooltip (widget, MICROSOFT365_CLIENT_ID,
_("There is not set any default application ID"),
- g_strdup_printf (_("Default application ID is “%s”"), OFFICE365_CLIENT_ID));
+ g_strdup_printf (_("Default application ID is “%s”"), MICROSOFT365_CLIENT_ID));
widget = gtk_label_new_with_mnemonic (_("_Redirect URI:"));
gtk_widget_set_margin_left (widget, 12);
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
- gtk_grid_attach (o365_backend->priv->oauth2_settings_grid, widget, 0, 3, 1, 1);
+ gtk_grid_attach (m365_backend->priv->oauth2_settings_grid, widget, 0, 3, 1, 1);
label = GTK_LABEL (widget);
e_binding_bind_property (
- o365_backend->priv->oauth2_override_check, "active",
+ m365_backend->priv->oauth2_override_check, "active",
widget, "sensitive",
G_BINDING_SYNC_CREATE);
widget = gtk_entry_new ();
gtk_widget_set_hexpand (widget, TRUE);
gtk_label_set_mnemonic_widget (label, widget);
- gtk_grid_attach (o365_backend->priv->oauth2_settings_grid, widget, 1, 3, 1, 1);
- o365_backend->priv->oauth2_redirect_uri_entry = widget;
+ gtk_grid_attach (m365_backend->priv->oauth2_settings_grid, widget, 1, 3, 1, 1);
+ m365_backend->priv->oauth2_redirect_uri_entry = widget;
e_binding_bind_property (
- o365_backend->priv->oauth2_override_check, "active",
+ m365_backend->priv->oauth2_override_check, "active",
widget, "sensitive",
G_BINDING_SYNC_CREATE);
markup = g_strdup_printf (_("Default redirect URI is “%s”"),
"https://login.microsoftonline.com/common/oauth2/nativeclient");
- mail_config_o365_backend_set_oauth2_tooltip (widget, OFFICE365_REDIRECT_URI,
+ mail_config_m365_backend_set_oauth2_tooltip (widget, MICROSOFT365_REDIRECT_URI,
markup,
- g_strdup_printf (_("Default redirect URI is “%s”"), OFFICE365_REDIRECT_URI));
+ g_strdup_printf (_("Default redirect URI is “%s”"), MICROSOFT365_REDIRECT_URI));
g_free (markup);
- gtk_widget_show_all (GTK_WIDGET (o365_backend->priv->oauth2_settings_grid));
+ gtk_widget_show_all (GTK_WIDGET (m365_backend->priv->oauth2_settings_grid));
e_binding_bind_object_text_property (
settings, "user",
- o365_backend->priv->user_entry, "text",
+ m365_backend->priv->user_entry, "text",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
e_binding_bind_property (
settings, "override-oauth2",
- o365_backend->priv->oauth2_override_check, "active",
+ m365_backend->priv->oauth2_override_check, "active",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
e_binding_bind_object_text_property (
settings, "oauth2-tenant",
- o365_backend->priv->oauth2_tenant_entry, "text",
+ m365_backend->priv->oauth2_tenant_entry, "text",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
e_binding_bind_object_text_property (
settings, "oauth2-client-id",
- o365_backend->priv->oauth2_client_id_entry, "text",
+ m365_backend->priv->oauth2_client_id_entry, "text",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
e_binding_bind_object_text_property (
settings, "oauth2-redirect_uri",
- o365_backend->priv->oauth2_redirect_uri_entry, "text",
+ m365_backend->priv->oauth2_redirect_uri_entry, "text",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
@@ -345,11 +334,11 @@ mail_config_o365_backend_insert_widgets (EMailConfigServiceBackend *backend,
auth_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_AUTHENTICATION);
e_source_authentication_set_host (auth_extension, "graph.microsoft.com");
e_source_authentication_set_port (auth_extension, 442);
- e_source_authentication_set_method (auth_extension, "Office365");
+ e_source_authentication_set_method (auth_extension, "Microsoft365");
}
static void
-mail_config_o365_backend_setup_defaults (EMailConfigServiceBackend *backend)
+mail_config_m365_backend_setup_defaults (EMailConfigServiceBackend *backend)
{
CamelSettings *settings;
EMailConfigServicePage *page;
@@ -370,12 +359,12 @@ mail_config_o365_backend_setup_defaults (EMailConfigServiceBackend *backend)
email_address = e_mail_config_service_page_get_email_address (page);
settings = e_mail_config_service_backend_get_settings (backend);
- camel_o365_settings_set_email (CAMEL_O365_SETTINGS (settings), email_address);
+ camel_m365_settings_set_email (CAMEL_M365_SETTINGS (settings), email_address);
camel_network_settings_set_user (CAMEL_NETWORK_SETTINGS (settings), email_address);
}
static gboolean
-mail_config_o365_backend_auto_configure (EMailConfigServiceBackend *backend,
+mail_config_m365_backend_auto_configure (EMailConfigServiceBackend *backend,
EConfigLookup *config_lookup,
gint *out_priority,
gboolean *out_is_complete)
@@ -387,16 +376,16 @@ mail_config_o365_backend_auto_configure (EMailConfigServiceBackend *backend,
}
static gboolean
-mail_config_o365_backend_check_complete (EMailConfigServiceBackend *backend)
+mail_config_m365_backend_check_complete (EMailConfigServiceBackend *backend)
{
EMailConfigServicePage *page;
- EMailConfigO365Backend *o365_backend;
+ EMailConfigM365Backend *m365_backend;
CamelSettings *settings;
CamelNetworkSettings *network_settings;
const gchar *user;
gboolean correct, complete = TRUE;
- o365_backend = E_MAIL_CONFIG_O365_BACKEND (backend);
+ m365_backend = E_MAIL_CONFIG_M365_BACKEND (backend);
page = e_mail_config_service_backend_get_page (backend);
/* This backend serves double duty. One instance holds the
@@ -417,32 +406,32 @@ mail_config_o365_backend_check_complete (EMailConfigServiceBackend *backend)
correct = user != NULL && *user != '\0';
complete = complete && correct;
- e_util_set_entry_issue_hint (o365_backend->priv->user_entry, correct ? NULL : _("User name cannot be
empty"));
+ e_util_set_entry_issue_hint (m365_backend->priv->user_entry, correct ? NULL : _("User name cannot be
empty"));
if (correct) {
- CamelO365Settings *o365_settings = CAMEL_O365_SETTINGS (settings);
+ CamelM365Settings *m365_settings = CAMEL_M365_SETTINGS (settings);
const gchar *client_id;
- if (camel_o365_settings_get_override_oauth2 (o365_settings)) {
- client_id = camel_o365_settings_get_oauth2_client_id (o365_settings);
+ if (camel_m365_settings_get_override_oauth2 (m365_settings)) {
+ client_id = camel_m365_settings_get_oauth2_client_id (m365_settings);
} else {
- client_id = OFFICE365_CLIENT_ID;
+ client_id = MICROSOFT365_CLIENT_ID;
}
correct = client_id && *client_id;
complete = complete && correct;
- e_util_set_entry_issue_hint (o365_backend->priv->oauth2_client_id_entry, correct ? NULL :
_("Application ID cannot be empty"));
+ e_util_set_entry_issue_hint (m365_backend->priv->oauth2_client_id_entry, correct ? NULL :
_("Application ID cannot be empty"));
}
return complete;
}
static void
-mail_config_o365_backend_commit_changes (EMailConfigServiceBackend *backend)
+mail_config_m365_backend_commit_changes (EMailConfigServiceBackend *backend)
{
CamelSettings *settings;
- CamelO365Settings *o365_settings;
+ CamelM365Settings *m365_settings;
EMailConfigServicePage *page;
const gchar *email_address;
@@ -462,42 +451,42 @@ mail_config_o365_backend_commit_changes (EMailConfigServiceBackend *backend)
email_address = e_mail_config_service_page_get_email_address (page);
if (email_address != NULL) {
- o365_settings = CAMEL_O365_SETTINGS (settings);
- camel_o365_settings_set_email (o365_settings, email_address);
+ m365_settings = CAMEL_M365_SETTINGS (settings);
+ camel_m365_settings_set_email (m365_settings, email_address);
}
}
static void
-e_mail_config_o365_backend_class_init (EMailConfigO365BackendClass *class)
+e_mail_config_m365_backend_class_init (EMailConfigM365BackendClass *class)
{
EMailConfigServiceBackendClass *backend_class;
backend_class = E_MAIL_CONFIG_SERVICE_BACKEND_CLASS (class);
- backend_class->backend_name = "office365";
- backend_class->new_collection = mail_config_o365_backend_new_collection;
- backend_class->insert_widgets = mail_config_o365_backend_insert_widgets;
- backend_class->setup_defaults = mail_config_o365_backend_setup_defaults;
- backend_class->auto_configure = mail_config_o365_backend_auto_configure;
- backend_class->check_complete = mail_config_o365_backend_check_complete;
- backend_class->commit_changes = mail_config_o365_backend_commit_changes;
+ backend_class->backend_name = "microsoft365";
+ backend_class->new_collection = mail_config_m365_backend_new_collection;
+ backend_class->insert_widgets = mail_config_m365_backend_insert_widgets;
+ backend_class->setup_defaults = mail_config_m365_backend_setup_defaults;
+ backend_class->auto_configure = mail_config_m365_backend_auto_configure;
+ backend_class->check_complete = mail_config_m365_backend_check_complete;
+ backend_class->commit_changes = mail_config_m365_backend_commit_changes;
}
static void
-e_mail_config_o365_backend_class_finalize (EMailConfigO365BackendClass *class)
+e_mail_config_m365_backend_class_finalize (EMailConfigM365BackendClass *class)
{
}
static void
-e_mail_config_o365_backend_init (EMailConfigO365Backend *backend)
+e_mail_config_m365_backend_init (EMailConfigM365Backend *backend)
{
- backend->priv = e_mail_config_o365_backend_get_instance_private (backend);
+ backend->priv = e_mail_config_m365_backend_get_instance_private (backend);
}
void
-e_mail_config_o365_backend_type_register (GTypeModule *type_module)
+e_mail_config_m365_backend_type_register (GTypeModule *type_module)
{
/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
* function, so we have to wrap it with a public function in
* order to register types from a separate compilation unit. */
- e_mail_config_o365_backend_register_type (type_module);
+ e_mail_config_m365_backend_register_type (type_module);
}
diff --git a/src/Microsoft365/evolution/e-mail-config-m365-backend.h
b/src/Microsoft365/evolution/e-mail-config-m365-backend.h
new file mode 100644
index 00000000..1727d0de
--- /dev/null
+++ b/src/Microsoft365/evolution/e-mail-config-m365-backend.h
@@ -0,0 +1,53 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_MAIL_CONFIG_M365_BACKEND_H
+#define E_MAIL_CONFIG_M365_BACKEND_H
+
+#include <mail/e-mail-config-service-backend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_CONFIG_M365_BACKEND \
+ (e_mail_config_m365_backend_get_type ())
+#define E_MAIL_CONFIG_M365_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_CONFIG_M365_BACKEND, EMailConfigM365Backend))
+#define E_MAIL_CONFIG_M365_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_CONFIG_M365_BACKEND, EMailConfigM365BackendClass))
+#define E_IS_MAIL_CONFIG_M365_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_CONFIG_M365_BACKEND))
+#define E_IS_MAIL_CONFIG_M365_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_CONFIG_M365_BACKEND))
+#define E_MAIL_CONFIG_M365_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_CONFIG_M365_BACKEND, EMailConfigM365BackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailConfigM365Backend EMailConfigM365Backend;
+typedef struct _EMailConfigM365BackendClass EMailConfigM365BackendClass;
+typedef struct _EMailConfigM365BackendPrivate EMailConfigM365BackendPrivate;
+
+struct _EMailConfigM365Backend {
+ EMailConfigServiceBackend parent;
+ EMailConfigM365BackendPrivate *priv;
+};
+
+struct _EMailConfigM365BackendClass {
+ EMailConfigServiceBackendClass parent_class;
+};
+
+GType e_mail_config_m365_backend_get_type
+ (void) G_GNUC_CONST;
+void e_mail_config_m365_backend_type_register
+ (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_M365_BACKEND_H */
diff --git a/src/Microsoft365/evolution/module-m365-configuration.c
b/src/Microsoft365/evolution/module-m365-configuration.c
new file mode 100644
index 00000000..f6629f1c
--- /dev/null
+++ b/src/Microsoft365/evolution/module-m365-configuration.c
@@ -0,0 +1,41 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "evolution-ews-config.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "common/camel-sasl-xoauth2-microsoft365.h"
+#include "common/e-oauth2-service-microsoft365.h"
+#include "common/e-source-m365-folder.h"
+
+#include "e-cal-config-m365.h"
+#include "e-book-config-m365.h"
+#include "e-mail-config-m365-backend.h"
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ bindtextdomain (GETTEXT_PACKAGE, M365_LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+ camel_sasl_xoauth2_microsoft365_type_register (type_module);
+ e_oauth2_service_microsoft365_type_register (type_module);
+ e_source_m365_folder_type_register (type_module);
+
+ e_cal_config_m365_type_register (type_module);
+ e_book_config_m365_type_register (type_module);
+ e_mail_config_m365_backend_type_register (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
diff --git a/src/Microsoft365/registry/CMakeLists.txt b/src/Microsoft365/registry/CMakeLists.txt
new file mode 100644
index 00000000..d7888446
--- /dev/null
+++ b/src/Microsoft365/registry/CMakeLists.txt
@@ -0,0 +1,24 @@
+set(extra_deps)
+set(sources
+ module-m365-backend.c
+ e-m365-backend.c
+ e-m365-backend.h
+ e-m365-backend-factory.c
+ e-m365-backend-factory.h
+ e-source-m365-deltas.c
+ e-source-m365-deltas.h
+)
+set(extra_defines)
+set(extra_cflags)
+set(extra_incdirs)
+set(extra_ldflags)
+
+add_simple_module_m365(module-microsoft365-backend
+ sources
+ extra_deps
+ extra_defines
+ extra_cflags
+ extra_incdirs
+ extra_ldflags
+ "${eds_moduledir}"
+)
diff --git a/src/Microsoft365/registry/e-m365-backend-factory.c
b/src/Microsoft365/registry/e-m365-backend-factory.c
new file mode 100644
index 00000000..303e0794
--- /dev/null
+++ b/src/Microsoft365/registry/e-m365-backend-factory.c
@@ -0,0 +1,78 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "evolution-ews-config.h"
+
+#include "e-m365-backend.h"
+
+#include "e-m365-backend-factory.h"
+
+G_DEFINE_DYNAMIC_TYPE (EM365BackendFactory, e_m365_backend_factory, E_TYPE_COLLECTION_BACKEND_FACTORY)
+
+static void
+m365_backend_prepare_mail_account_source (ESource *source)
+{
+ ESourceBackend *extension;
+ const gchar *extension_name;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ extension = e_source_get_extension (source, extension_name);
+ e_source_backend_set_backend_name (extension, "microsoft365");
+}
+
+static void
+m365_backend_prepare_mail_transport_source (ESource *source)
+{
+ ESourceBackend *extension;
+ const gchar *extension_name;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
+ extension = e_source_get_extension (source, extension_name);
+ e_source_backend_set_backend_name (extension, "microsoft365");
+}
+
+static void
+m365_backend_factory_prepare_mail (ECollectionBackendFactory *factory,
+ ESource *mail_account_source,
+ ESource *mail_identity_source,
+ ESource *mail_transport_source)
+{
+ /* Chain up to parent's method. */
+ E_COLLECTION_BACKEND_FACTORY_CLASS (e_m365_backend_factory_parent_class)->prepare_mail (factory,
mail_account_source, mail_identity_source, mail_transport_source);
+
+ m365_backend_prepare_mail_account_source (mail_account_source);
+ m365_backend_prepare_mail_transport_source (mail_transport_source);
+}
+
+static void
+e_m365_backend_factory_class_init (EM365BackendFactoryClass *class)
+{
+ ECollectionBackendFactoryClass *factory_class;
+
+ factory_class = E_COLLECTION_BACKEND_FACTORY_CLASS (class);
+ factory_class->factory_name = "microsoft365";
+ factory_class->backend_type = E_TYPE_M365_BACKEND;
+ factory_class->prepare_mail = m365_backend_factory_prepare_mail;
+}
+
+static void
+e_m365_backend_factory_class_finalize (EM365BackendFactoryClass *class)
+{
+}
+
+static void
+e_m365_backend_factory_init (EM365BackendFactory *factory)
+{
+}
+
+void
+e_m365_backend_factory_type_register (GTypeModule *type_module)
+{
+ /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+ * function, so we have to wrap it with a public function in
+ * order to register types from a separate compilation unit. */
+ e_m365_backend_factory_register_type (type_module);
+}
diff --git a/src/Microsoft365/registry/e-m365-backend-factory.h
b/src/Microsoft365/registry/e-m365-backend-factory.h
new file mode 100644
index 00000000..4e497cce
--- /dev/null
+++ b/src/Microsoft365/registry/e-m365-backend-factory.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_M365_BACKEND_FACTORY_H
+#define E_M365_BACKEND_FACTORY_H
+
+#include <libebackend/libebackend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_M365_BACKEND_FACTORY \
+ (e_m365_backend_factory_get_type ())
+#define E_M365_BACKEND_FACTORY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_M365_BACKEND_FACTORY, EM365BackendFactory))
+#define E_M365_BACKEND_FACTORY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_M365_BACKEND_FACTORY, EM365BackendFactoryClass))
+#define E_IS_M365_BACKEND_FACTORY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_M365_BACKEND_FACTORY))
+#define E_IS_M365_BACKEND_FACTORY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_M365_BACKEND_FACTORY))
+#define E_M365_BACKEND_FACTORY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_M365_BACKEND_FACTORY, EM365BackendFactoryClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EM365BackendFactory EM365BackendFactory;
+typedef struct _EM365BackendFactoryClass EM365BackendFactoryClass;
+typedef struct _EM365BackendFactoryPrivate EM365BackendFactoryPrivate;
+
+struct _EM365BackendFactory {
+ ECollectionBackendFactory parent;
+ EM365BackendFactoryPrivate *priv;
+};
+
+struct _EM365BackendFactoryClass {
+ ECollectionBackendFactoryClass parent_class;
+};
+
+GType e_m365_backend_factory_get_type (void) G_GNUC_CONST;
+void e_m365_backend_factory_type_register
+ (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_M365_BACKEND_FACTORY_H */
diff --git a/src/Office365/registry/e-o365-backend.c b/src/Microsoft365/registry/e-m365-backend.c
similarity index 58%
rename from src/Office365/registry/e-o365-backend.c
rename to src/Microsoft365/registry/e-m365-backend.c
index a2dc10fb..d3e080f6 100644
--- a/src/Office365/registry/e-o365-backend.c
+++ b/src/Microsoft365/registry/e-m365-backend.c
@@ -1,36 +1,25 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
#include <glib/gi18n-lib.h>
-#include "common/e-o365-connection.h"
-#include "common/e-source-o365-folder.h"
-#include "common/camel-o365-settings.h"
+#include "common/e-m365-connection.h"
+#include "common/e-source-m365-folder.h"
+#include "common/camel-m365-settings.h"
-#include "e-source-o365-deltas.h"
+#include "e-source-m365-deltas.h"
-#include "e-o365-backend.h"
+#include "e-m365-backend.h"
#define LOCK(_backend) g_mutex_lock (&_backend->priv->property_lock)
#define UNLOCK(_backend) g_mutex_unlock (&_backend->priv->property_lock)
-struct _EO365BackendPrivate {
+struct _EM365BackendPrivate {
GMutex property_lock;
GHashTable *folder_sources; /* gchar *folder_id ~> ESource * */
@@ -40,11 +29,11 @@ struct _EO365BackendPrivate {
gulong source_changed_id;
};
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (EO365Backend, e_o365_backend, E_TYPE_COLLECTION_BACKEND, 0,
- G_ADD_PRIVATE_DYNAMIC (EO365Backend))
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (EM365Backend, e_m365_backend, E_TYPE_COLLECTION_BACKEND, 0,
+ G_ADD_PRIVATE_DYNAMIC (EM365Backend))
static void
-o365_backend_claim_old_resources (ECollectionBackend *backend)
+m365_backend_claim_old_resources (ECollectionBackend *backend)
{
ESourceRegistryServer *registry;
GList *old_resources, *iter;
@@ -64,11 +53,11 @@ o365_backend_claim_old_resources (ECollectionBackend *backend)
g_clear_object (®istry);
}
-static void o365_backend_populate (ECollectionBackend *backend);
+static void m365_backend_populate (ECollectionBackend *backend);
static void
-o365_backend_source_changed_cb (ESource *source,
- EO365Backend *backend)
+m365_backend_source_changed_cb (ESource *source,
+ EM365Backend *backend)
{
if (!e_source_get_enabled (source)) {
backend->priv->need_update_folders = TRUE;
@@ -78,36 +67,36 @@ o365_backend_source_changed_cb (ESource *source,
if (!backend->priv->need_update_folders)
return;
- o365_backend_populate (E_COLLECTION_BACKEND (backend));
+ m365_backend_populate (E_COLLECTION_BACKEND (backend));
}
static void
-o365_backend_populate (ECollectionBackend *backend)
+m365_backend_populate (ECollectionBackend *backend)
{
ESource *source;
- EO365Backend *o365_backend = E_O365_BACKEND (backend);
+ EM365Backend *m365_backend = E_M365_BACKEND (backend);
source = e_backend_get_source (E_BACKEND (backend));
- o365_backend->priv->need_update_folders = TRUE;
+ m365_backend->priv->need_update_folders = TRUE;
- if (!o365_backend->priv->source_changed_id) {
- o365_backend->priv->source_changed_id = g_signal_connect (source, "changed",
- G_CALLBACK (o365_backend_source_changed_cb), o365_backend);
+ if (!m365_backend->priv->source_changed_id) {
+ m365_backend->priv->source_changed_id = g_signal_connect (source, "changed",
+ G_CALLBACK (m365_backend_source_changed_cb), m365_backend);
}
/* do not do anything, if account is disabled */
if (!e_source_get_enabled (source))
return;
- o365_backend_claim_old_resources (backend);
+ m365_backend_claim_old_resources (backend);
if (e_backend_get_online (E_BACKEND (backend)))
e_backend_schedule_authenticate (E_BACKEND (backend), NULL);
}
static void
-o365_backend_update_resource (EO365Backend *o365_backend,
+m365_backend_update_resource (EM365Backend *m365_backend,
const gchar *extension_name,
const gchar *id,
const gchar *group_id,
@@ -118,16 +107,16 @@ o365_backend_update_resource (EO365Backend *o365_backend,
ESource *source;
gboolean is_new;
- LOCK (o365_backend);
- source = g_hash_table_lookup (o365_backend->priv->folder_sources, id);
+ LOCK (m365_backend);
+ source = g_hash_table_lookup (m365_backend->priv->folder_sources, id);
if (source)
g_object_ref (source);
- UNLOCK (o365_backend);
+ UNLOCK (m365_backend);
is_new = !source;
if (is_new)
- source = e_collection_backend_new_child (E_COLLECTION_BACKEND (o365_backend), id);
+ source = e_collection_backend_new_child (E_COLLECTION_BACKEND (m365_backend), id);
if (source) {
e_source_set_display_name (source, display_name);
@@ -147,7 +136,7 @@ o365_backend_update_resource (EO365Backend *o365_backend,
gpointer extension;
extension = e_source_get_extension (source, extension_name);
- e_source_backend_set_backend_name (E_SOURCE_BACKEND (extension), "office365");
+ e_source_backend_set_backend_name (E_SOURCE_BACKEND (extension), "microsoft365");
/* Do not notify with too old reminders */
if (g_strcmp0 (extension_name, E_SOURCE_EXTENSION_CALENDAR) == 0 ||
@@ -170,12 +159,12 @@ o365_backend_update_resource (EO365Backend *o365_backend,
g_free (today);
}
- extension = e_source_get_extension (source, E_SOURCE_EXTENSION_O365_FOLDER);
- e_source_o365_folder_set_id (extension, id);
- e_source_o365_folder_set_group_id (extension, group_id);
- e_source_o365_folder_set_is_default (extension, is_default);
+ extension = e_source_get_extension (source, E_SOURCE_EXTENSION_M365_FOLDER);
+ e_source_m365_folder_set_id (extension, id);
+ e_source_m365_folder_set_group_id (extension, group_id);
+ e_source_m365_folder_set_is_default (extension, is_default);
- server = e_collection_backend_ref_server (E_COLLECTION_BACKEND (o365_backend));
+ server = e_collection_backend_ref_server (E_COLLECTION_BACKEND (m365_backend));
e_source_registry_server_add_source (server, source);
@@ -187,26 +176,26 @@ o365_backend_update_resource (EO365Backend *o365_backend,
}
static void
-o365_backend_remove_resource (EO365Backend *o365_backend,
+m365_backend_remove_resource (EM365Backend *m365_backend,
const gchar *extension_name,
const gchar *id) /* NULL to remove the "is-default" resource for the
extension_name */
{
ESource *existing_source;
- LOCK (o365_backend);
+ LOCK (m365_backend);
if (id) {
- existing_source = g_hash_table_lookup (o365_backend->priv->folder_sources, id);
+ existing_source = g_hash_table_lookup (m365_backend->priv->folder_sources, id);
} else {
GHashTableIter iter;
gpointer value;
- g_hash_table_iter_init (&iter, o365_backend->priv->folder_sources);
+ g_hash_table_iter_init (&iter, m365_backend->priv->folder_sources);
while (g_hash_table_iter_next (&iter, NULL, &value)) {
ESource *source = value;
if (value && e_source_has_extension (source, extension_name) &&
- e_source_o365_folder_get_is_default (e_source_get_extension (source,
E_SOURCE_EXTENSION_O365_FOLDER))) {
+ e_source_m365_folder_get_is_default (e_source_get_extension (source,
E_SOURCE_EXTENSION_M365_FOLDER))) {
existing_source = source;
break;
}
@@ -216,7 +205,7 @@ o365_backend_remove_resource (EO365Backend *o365_backend,
if (existing_source)
g_object_ref (existing_source);
- UNLOCK (o365_backend);
+ UNLOCK (m365_backend);
if (existing_source)
e_source_remove_sync (existing_source, NULL, NULL);
@@ -225,7 +214,7 @@ o365_backend_remove_resource (EO365Backend *o365_backend,
}
static GHashTable * /* gchar *uid ~> NULL */
-o365_backend_get_known_folder_ids (EO365Backend *o365_backend,
+m365_backend_get_known_folder_ids (EM365Backend *m365_backend,
const gchar *extension_name,
gboolean with_the_default)
{
@@ -235,30 +224,30 @@ o365_backend_get_known_folder_ids (EO365Backend *o365_backend,
ids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- LOCK (o365_backend);
+ LOCK (m365_backend);
- g_hash_table_iter_init (&iter, o365_backend->priv->folder_sources);
+ g_hash_table_iter_init (&iter, m365_backend->priv->folder_sources);
while (g_hash_table_iter_next (&iter, NULL, &value)) {
ESource *source = value;
if (source && e_source_has_extension (source, extension_name)) {
- ESourceO365Folder *o365_folder;
+ ESourceM365Folder *m365_folder;
- o365_folder = e_source_get_extension (source, E_SOURCE_EXTENSION_O365_FOLDER);
+ m365_folder = e_source_get_extension (source, E_SOURCE_EXTENSION_M365_FOLDER);
- if (with_the_default || !e_source_o365_folder_get_is_default (o365_folder))
- g_hash_table_insert (ids, e_source_o365_folder_dup_id (o365_folder), NULL);
+ if (with_the_default || !e_source_m365_folder_get_is_default (m365_folder))
+ g_hash_table_insert (ids, e_source_m365_folder_dup_id (m365_folder), NULL);
}
}
- UNLOCK (o365_backend);
+ UNLOCK (m365_backend);
return ids;
}
static void
-o365_backend_forget_folders_hash (EO365Backend *o365_backend,
+m365_backend_forget_folders_hash (EM365Backend *m365_backend,
const gchar *extension_name,
GHashTable *ids) /* gchar *id ~> NULL */
{
@@ -271,48 +260,48 @@ o365_backend_forget_folders_hash (EO365Backend *o365_backend,
const gchar *id = key;
if (id)
- o365_backend_remove_resource (o365_backend, extension_name, id);
+ m365_backend_remove_resource (m365_backend, extension_name, id);
}
}
static void
-o365_backend_forget_folders (EO365Backend *o365_backend,
+m365_backend_forget_folders (EM365Backend *m365_backend,
const gchar *extension_name,
gboolean with_the_default)
{
GHashTable *ids;
- ids = o365_backend_get_known_folder_ids (o365_backend, extension_name, with_the_default);
+ ids = m365_backend_get_known_folder_ids (m365_backend, extension_name, with_the_default);
- o365_backend_forget_folders_hash (o365_backend, extension_name, ids);
+ m365_backend_forget_folders_hash (m365_backend, extension_name, ids);
g_hash_table_destroy (ids);
}
static gboolean
-o365_backend_got_contact_folders_delta_cb (EO365Connection *cnc,
+m365_backend_got_contact_folders_delta_cb (EM365Connection *cnc,
const GSList *results, /* JsonObject * - the returned objects from
the server */
gpointer user_data,
GCancellable *cancellable,
GError **error)
{
- EO365Backend *o365_backend = user_data;
+ EM365Backend *m365_backend = user_data;
GSList *link;
- g_return_val_if_fail (E_IS_O365_BACKEND (o365_backend), FALSE);
+ g_return_val_if_fail (E_IS_M365_BACKEND (m365_backend), FALSE);
for (link = (GSList *) results; link; link = g_slist_next (link)) {
JsonObject *object = link->data;
- const gchar *id = e_o365_folder_get_id (object);
+ const gchar *id = e_m365_folder_get_id (object);
if (!id)
continue;
- if (e_o365_delta_is_removed_object (object)) {
- o365_backend_remove_resource (o365_backend, E_SOURCE_EXTENSION_ADDRESS_BOOK, id);
+ if (e_m365_delta_is_removed_object (object)) {
+ m365_backend_remove_resource (m365_backend, E_SOURCE_EXTENSION_ADDRESS_BOOK, id);
} else {
- o365_backend_update_resource (o365_backend, E_SOURCE_EXTENSION_ADDRESS_BOOK,
- id, NULL, e_o365_folder_get_display_name (object),
+ m365_backend_update_resource (m365_backend, E_SOURCE_EXTENSION_ADDRESS_BOOK,
+ id, NULL, e_m365_folder_get_display_name (object),
FALSE, NULL);
}
}
@@ -321,57 +310,57 @@ o365_backend_got_contact_folders_delta_cb (EO365Connection *cnc,
}
static void
-o365_backend_sync_contact_folders_sync (EO365Backend *o365_backend,
- EO365Connection *cnc,
+m365_backend_sync_contact_folders_sync (EM365Backend *m365_backend,
+ EM365Connection *cnc,
GCancellable *cancellable)
{
- EO365Folder *user_contacts = NULL;
- ESourceO365Deltas *o365_deltas;
+ EM365Folder *user_contacts = NULL;
+ ESourceM365Deltas *m365_deltas;
gchar *old_delta_link, *new_delta_link;
gboolean success;
GError *error = NULL;
- o365_deltas = e_source_get_extension (e_backend_get_source (E_BACKEND (o365_backend)),
E_SOURCE_EXTENSION_O365_DELTAS);
+ m365_deltas = e_source_get_extension (e_backend_get_source (E_BACKEND (m365_backend)),
E_SOURCE_EXTENSION_M365_DELTAS);
- if (e_o365_connection_get_contacts_folder_sync (cnc, NULL, NULL, NULL, &user_contacts, cancellable,
&error)) {
+ if (e_m365_connection_get_contacts_folder_sync (cnc, NULL, NULL, NULL, &user_contacts, cancellable,
&error)) {
const gchar *id, *display_name;
- id = e_o365_folder_get_id (user_contacts);
- display_name = e_o365_folder_get_display_name (user_contacts);
+ id = e_m365_folder_get_id (user_contacts);
+ display_name = e_m365_folder_get_display_name (user_contacts);
g_warn_if_fail (id != NULL);
g_warn_if_fail (display_name != NULL);
- o365_backend_update_resource (o365_backend,
+ m365_backend_update_resource (m365_backend,
E_SOURCE_EXTENSION_ADDRESS_BOOK,
id, NULL, display_name, TRUE, NULL);
json_object_unref (user_contacts);
} else if (g_error_matches (error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND) ||
g_error_matches (error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED)) {
- o365_backend_remove_resource (o365_backend, E_SOURCE_EXTENSION_ADDRESS_BOOK, NULL);
+ m365_backend_remove_resource (m365_backend, E_SOURCE_EXTENSION_ADDRESS_BOOK, NULL);
}
g_clear_error (&error);
new_delta_link = NULL;
- old_delta_link = e_source_o365_deltas_dup_contacts_link (o365_deltas);
+ old_delta_link = e_source_m365_deltas_dup_contacts_link (m365_deltas);
- success = e_o365_connection_get_folders_delta_sync (cnc, NULL, E_O365_FOLDER_KIND_CONTACTS, NULL,
old_delta_link, 0,
- o365_backend_got_contact_folders_delta_cb, o365_backend, &new_delta_link, cancellable,
&error);
+ success = e_m365_connection_get_folders_delta_sync (cnc, NULL, E_M365_FOLDER_KIND_CONTACTS, NULL,
old_delta_link, 0,
+ m365_backend_got_contact_folders_delta_cb, m365_backend, &new_delta_link, cancellable,
&error);
- if (old_delta_link && *old_delta_link && e_o365_connection_util_delta_token_failed (error)) {
+ if (old_delta_link && *old_delta_link && e_m365_connection_util_delta_token_failed (error)) {
g_clear_pointer (&old_delta_link, g_free);
g_clear_error (&error);
- o365_backend_forget_folders (o365_backend, E_SOURCE_EXTENSION_ADDRESS_BOOK, FALSE);
+ m365_backend_forget_folders (m365_backend, E_SOURCE_EXTENSION_ADDRESS_BOOK, FALSE);
- success = e_o365_connection_get_folders_delta_sync (cnc, NULL, E_O365_FOLDER_KIND_CONTACTS,
NULL, NULL, 0,
- o365_backend_got_contact_folders_delta_cb, o365_backend, &new_delta_link,
cancellable, &error);
+ success = e_m365_connection_get_folders_delta_sync (cnc, NULL, E_M365_FOLDER_KIND_CONTACTS,
NULL, NULL, 0,
+ m365_backend_got_contact_folders_delta_cb, m365_backend, &new_delta_link,
cancellable, &error);
}
if (success)
- e_source_o365_deltas_set_contacts_link (o365_deltas, new_delta_link);
+ e_source_m365_deltas_set_contacts_link (m365_deltas, new_delta_link);
g_clear_pointer (&old_delta_link, g_free);
g_clear_pointer (&new_delta_link, g_free);
@@ -379,8 +368,8 @@ o365_backend_sync_contact_folders_sync (EO365Backend *o365_backend,
}
static void
-o365_backend_sync_calendar_folders_sync (EO365Backend *o365_backend,
- EO365Connection *cnc,
+m365_backend_sync_calendar_folders_sync (EM365Backend *m365_backend,
+ EM365Connection *cnc,
GCancellable *cancellable)
{
const gchar *extension_name = E_SOURCE_EXTENSION_CALENDAR;
@@ -389,35 +378,35 @@ o365_backend_sync_calendar_folders_sync (EO365Backend *o365_backend,
GSList *groups = NULL, *link;
GError *error = NULL;
- known_ids = o365_backend_get_known_folder_ids (o365_backend, extension_name, FALSE);
+ known_ids = m365_backend_get_known_folder_ids (m365_backend, extension_name, FALSE);
- if (e_o365_connection_list_calendar_groups_sync (cnc, NULL, &groups, cancellable, &error) && groups) {
+ if (e_m365_connection_list_calendar_groups_sync (cnc, NULL, &groups, cancellable, &error) && groups) {
success = TRUE;
for (link = groups; link && success; link = g_slist_next (link)) {
- EO365CalendarGroup *group = link->data;
+ EM365CalendarGroup *group = link->data;
GSList *calendars = NULL;
if (!group)
continue;
- if (e_o365_connection_list_calendars_sync (cnc, NULL, e_o365_calendar_group_get_id
(group), NULL, &calendars, cancellable, &error)) {
+ if (e_m365_connection_list_calendars_sync (cnc, NULL, e_m365_calendar_group_get_id
(group), NULL, &calendars, cancellable, &error)) {
GSList *clink;
for (clink = calendars; clink; clink = g_slist_next (clink)) {
- EO365Calendar *calendar = clink->data;
+ EM365Calendar *calendar = clink->data;
- if (!calendar || !e_o365_calendar_get_id (calendar))
+ if (!calendar || !e_m365_calendar_get_id (calendar))
continue;
- o365_backend_update_resource (o365_backend, extension_name,
- e_o365_calendar_get_id (calendar),
- e_o365_calendar_group_get_id (group),
- e_o365_calendar_get_name (calendar),
+ m365_backend_update_resource (m365_backend, extension_name,
+ e_m365_calendar_get_id (calendar),
+ e_m365_calendar_group_get_id (group),
+ e_m365_calendar_get_name (calendar),
FALSE,
- e_o365_calendar_color_to_rgb (e_o365_calendar_get_color
(calendar)));
+ e_m365_calendar_color_to_rgb (e_m365_calendar_get_color
(calendar)));
- g_hash_table_remove (known_ids, e_o365_calendar_get_id (calendar));
+ g_hash_table_remove (known_ids, e_m365_calendar_get_id (calendar));
}
} else {
success = FALSE;
@@ -428,73 +417,73 @@ o365_backend_sync_calendar_folders_sync (EO365Backend *o365_backend,
}
if (success)
- o365_backend_forget_folders_hash (o365_backend, extension_name, known_ids);
+ m365_backend_forget_folders_hash (m365_backend, extension_name, known_ids);
g_hash_table_destroy (known_ids);
g_clear_error (&error);
}
static void
-o365_backend_sync_folders_thread (GTask *task,
+m365_backend_sync_folders_thread (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
- EO365Backend *o365_backend = source_object;
- EO365Connection *cnc = task_data;
+ EM365Backend *m365_backend = source_object;
+ EM365Connection *cnc = task_data;
ESourceCollection *collection_extension = NULL;
ESource *source;
- g_return_if_fail (E_IS_O365_BACKEND (o365_backend));
- g_return_if_fail (E_IS_O365_CONNECTION (cnc));
+ g_return_if_fail (E_IS_M365_BACKEND (m365_backend));
+ g_return_if_fail (E_IS_M365_CONNECTION (cnc));
- source = e_backend_get_source (E_BACKEND (o365_backend));
+ source = e_backend_get_source (E_BACKEND (m365_backend));
collection_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_COLLECTION);
if (e_source_collection_get_contacts_enabled (collection_extension)) {
- o365_backend_sync_contact_folders_sync (o365_backend, cnc, cancellable);
+ m365_backend_sync_contact_folders_sync (m365_backend, cnc, cancellable);
}
if (e_source_collection_get_calendar_enabled (collection_extension)) {
- o365_backend_sync_calendar_folders_sync (o365_backend, cnc, cancellable);
+ m365_backend_sync_calendar_folders_sync (m365_backend, cnc, cancellable);
}
}
static void
-o365_backend_sync_folders (EO365Backend *o365_backend,
- EO365Connection *cnc,
+m365_backend_sync_folders (EM365Backend *m365_backend,
+ EM365Connection *cnc,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
- o365_backend->priv->need_update_folders = FALSE;
+ m365_backend->priv->need_update_folders = FALSE;
- task = g_task_new (o365_backend, cancellable, callback, user_data);
+ task = g_task_new (m365_backend, cancellable, callback, user_data);
g_task_set_check_cancellable (task, TRUE);
g_task_set_task_data (task, g_object_ref (cnc), g_object_unref);
- g_task_run_in_thread (task, o365_backend_sync_folders_thread);
+ g_task_run_in_thread (task, m365_backend_sync_folders_thread);
g_object_unref (task);
}
static gchar *
-o365_backend_dup_resource_id (ECollectionBackend *backend,
+m365_backend_dup_resource_id (ECollectionBackend *backend,
ESource *child_source)
{
- ESourceO365Folder *extension;
+ ESourceM365Folder *extension;
const gchar *extension_name;
- extension_name = E_SOURCE_EXTENSION_O365_FOLDER;
+ extension_name = E_SOURCE_EXTENSION_M365_FOLDER;
extension = e_source_get_extension (child_source, extension_name);
- return e_source_o365_folder_dup_id (extension);
+ return e_source_m365_folder_dup_id (extension);
}
static void
-o365_backend_child_added (ECollectionBackend *backend,
+m365_backend_child_added (ECollectionBackend *backend,
ESource *child_source)
{
ESource *collection_source;
@@ -517,98 +506,98 @@ o365_backend_child_added (ECollectionBackend *backend,
G_BINDING_SYNC_CREATE);
}
- /* We track O365 folders in a hash table by folder ID. */
- if (e_source_has_extension (child_source, E_SOURCE_EXTENSION_O365_FOLDER)) {
- ESourceO365Folder *extension;
+ /* We track M365 folders in a hash table by folder ID. */
+ if (e_source_has_extension (child_source, E_SOURCE_EXTENSION_M365_FOLDER)) {
+ ESourceM365Folder *extension;
gchar *folder_id;
- extension = e_source_get_extension (child_source, E_SOURCE_EXTENSION_O365_FOLDER);
- folder_id = e_source_o365_folder_dup_id (extension);
+ extension = e_source_get_extension (child_source, E_SOURCE_EXTENSION_M365_FOLDER);
+ folder_id = e_source_m365_folder_dup_id (extension);
if (folder_id) {
- EO365Backend *o365_backend = E_O365_BACKEND (backend);
+ EM365Backend *m365_backend = E_M365_BACKEND (backend);
- LOCK (o365_backend);
- g_hash_table_insert (o365_backend->priv->folder_sources, folder_id, g_object_ref
(child_source));
- UNLOCK (o365_backend);
+ LOCK (m365_backend);
+ g_hash_table_insert (m365_backend->priv->folder_sources, folder_id, g_object_ref
(child_source));
+ UNLOCK (m365_backend);
}
}
/* Chain up to parent's method. */
- E_COLLECTION_BACKEND_CLASS (e_o365_backend_parent_class)->child_added (backend, child_source);
+ E_COLLECTION_BACKEND_CLASS (e_m365_backend_parent_class)->child_added (backend, child_source);
}
static void
-o365_backend_child_removed (ECollectionBackend *backend,
+m365_backend_child_removed (ECollectionBackend *backend,
ESource *child_source)
{
- /* We track O365 folders in a hash table by folder ID. */
- if (e_source_has_extension (child_source, E_SOURCE_EXTENSION_O365_FOLDER)) {
- ESourceO365Folder *extension;
+ /* We track M365 folders in a hash table by folder ID. */
+ if (e_source_has_extension (child_source, E_SOURCE_EXTENSION_M365_FOLDER)) {
+ ESourceM365Folder *extension;
const gchar *folder_id;
- extension = e_source_get_extension (child_source, E_SOURCE_EXTENSION_O365_FOLDER);
- folder_id = e_source_o365_folder_get_id (extension);
+ extension = e_source_get_extension (child_source, E_SOURCE_EXTENSION_M365_FOLDER);
+ folder_id = e_source_m365_folder_get_id (extension);
if (folder_id) {
- EO365Backend *o365_backend = E_O365_BACKEND (backend);
+ EM365Backend *m365_backend = E_M365_BACKEND (backend);
- LOCK (o365_backend);
- g_hash_table_remove (o365_backend->priv->folder_sources, folder_id);
- UNLOCK (o365_backend);
+ LOCK (m365_backend);
+ g_hash_table_remove (m365_backend->priv->folder_sources, folder_id);
+ UNLOCK (m365_backend);
}
}
/* Chain up to parent's method. */
- E_COLLECTION_BACKEND_CLASS (e_o365_backend_parent_class)->child_removed (backend, child_source);
+ E_COLLECTION_BACKEND_CLASS (e_m365_backend_parent_class)->child_removed (backend, child_source);
}
static gboolean
-o365_backend_create_resource_sync (ECollectionBackend *backend,
+m365_backend_create_resource_sync (ECollectionBackend *backend,
ESource *source,
GCancellable *cancellable,
GError **error)
{
#if 0
- EO365Connection *connection = NULL;
- O365FolderId *out_folder_id = NULL;
- EO365FolderType folder_type = E_O365_FOLDER_TYPE_UNKNOWN;
+ EM365Connection *connection = NULL;
+ M365FolderId *out_folder_id = NULL;
+ EM365FolderType folder_type = E_M365_FOLDER_TYPE_UNKNOWN;
const gchar *extension_name;
const gchar *parent_folder_id = NULL;
gchar *folder_name;
gboolean success = FALSE;
- extension_name = E_SOURCE_EXTENSION_O365_FOLDER;
+ extension_name = E_SOURCE_EXTENSION_M365_FOLDER;
if (e_source_has_extension (source, extension_name)) {
- ESourceO365Folder *extension;
+ ESourceM365Folder *extension;
/* foreign and public folders are just added */
extension = e_source_get_extension (source, extension_name);
- if (e_source_o365_folder_get_foreign (extension) ||
- e_source_o365_folder_get_public (extension))
+ if (e_source_m365_folder_get_foreign (extension) ||
+ e_source_m365_folder_get_public (extension))
success = TRUE;
}
if (!success) {
- connection = e_o365_backend_ref_connection_sync (E_O365_BACKEND (backend), NULL, NULL, NULL,
cancellable, error);
+ connection = e_m365_backend_ref_connection_sync (E_M365_BACKEND (backend), NULL, NULL, NULL,
cancellable, error);
if (connection == NULL)
return FALSE;
extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
if (e_source_has_extension (source, extension_name)) {
- folder_type = E_O365_FOLDER_TYPE_CONTACTS;
+ folder_type = E_M365_FOLDER_TYPE_CONTACTS;
parent_folder_id = "contacts";
}
extension_name = E_SOURCE_EXTENSION_CALENDAR;
if (e_source_has_extension (source, extension_name)) {
- folder_type = E_O365_FOLDER_TYPE_CALENDAR;
+ folder_type = E_M365_FOLDER_TYPE_CALENDAR;
parent_folder_id = "calendar";
}
extension_name = E_SOURCE_EXTENSION_TASK_LIST;
if (e_source_has_extension (source, extension_name)) {
- folder_type = E_O365_FOLDER_TYPE_TASKS;
+ folder_type = E_M365_FOLDER_TYPE_TASKS;
parent_folder_id = "tasks";
}
@@ -626,8 +615,8 @@ o365_backend_create_resource_sync (ECollectionBackend *backend,
folder_name = e_source_dup_display_name (source);
- success = e_o365_connection_create_folder_sync (
- connection, O365_PRIORITY_MEDIUM,
+ success = e_m365_connection_create_folder_sync (
+ connection, M365_PRIORITY_MEDIUM,
parent_folder_id, TRUE,
folder_name, folder_type,
&out_folder_id, cancellable, error);
@@ -640,17 +629,17 @@ o365_backend_create_resource_sync (ECollectionBackend *backend,
(!success && out_folder_id == NULL));
if (out_folder_id != NULL) {
- ESourceO365Folder *extension;
+ ESourceM365Folder *extension;
const gchar *extension_name;
- extension_name = E_SOURCE_EXTENSION_O365_FOLDER;
+ extension_name = E_SOURCE_EXTENSION_M365_FOLDER;
extension = e_source_get_extension (source, extension_name);
- e_source_o365_folder_set_id (
+ e_source_m365_folder_set_id (
extension, out_folder_id->id);
- e_source_o365_folder_set_change_key (
+ e_source_m365_folder_set_change_key (
extension, out_folder_id->change_key);
- e_o365_folder_id_free (out_folder_id);
+ e_m365_folder_id_free (out_folder_id);
}
}
@@ -689,44 +678,44 @@ o365_backend_create_resource_sync (ECollectionBackend *backend,
}
static gboolean
-o365_backend_delete_resource_sync (ECollectionBackend *backend,
+m365_backend_delete_resource_sync (ECollectionBackend *backend,
ESource *source,
GCancellable *cancellable,
GError **error)
{
#if 0
- EO365Connection *connection;
- ESourceO365Folder *extension;
+ EM365Connection *connection;
+ ESourceM365Folder *extension;
const gchar *extension_name;
gboolean success = FALSE;
- connection = e_o365_backend_ref_connection_sync (E_O365_BACKEND (backend), NULL, NULL, NULL,
cancellable, error);
+ connection = e_m365_backend_ref_connection_sync (E_M365_BACKEND (backend), NULL, NULL, NULL,
cancellable, error);
if (connection == NULL)
return FALSE;
- extension_name = E_SOURCE_EXTENSION_O365_FOLDER;
+ extension_name = E_SOURCE_EXTENSION_M365_FOLDER;
if (!e_source_has_extension (source, extension_name)) {
g_set_error (
error, G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
- _("Data source “%s” does not represent an Office365 folder"),
+ _("Data source “%s” does not represent a Microsoft 365 folder"),
e_source_get_display_name (source));
goto exit;
}
extension = e_source_get_extension (source, extension_name);
- if (e_source_o365_folder_get_foreign (extension) ||
- e_source_o365_folder_get_public (extension)) {
+ if (e_source_m365_folder_get_foreign (extension) ||
+ e_source_m365_folder_get_public (extension)) {
/* do not delete foreign or public folders,
* just remove them from local store */
success = TRUE;
} else {
gchar *folder_id;
- folder_id = e_source_o365_folder_dup_id (extension);
+ folder_id = e_source_m365_folder_dup_id (extension);
- success = e_o365_connection_delete_folder_sync (
- connection, O365_PRIORITY_MEDIUM, folder_id,
+ success = e_m365_connection_delete_folder_sync (
+ connection, M365_PRIORITY_MEDIUM, folder_id,
FALSE, "HardDelete", cancellable, error);
g_free (folder_id);
@@ -744,7 +733,7 @@ o365_backend_delete_resource_sync (ECollectionBackend *backend,
}
static gboolean
-o365_backend_get_destination_address (EBackend *backend,
+m365_backend_get_destination_address (EBackend *backend,
gchar **host,
guint16 *port)
{
@@ -758,29 +747,29 @@ o365_backend_get_destination_address (EBackend *backend,
}
static ESourceAuthenticationResult
-o365_backend_authenticate_sync (EBackend *backend,
+m365_backend_authenticate_sync (EBackend *backend,
const ENamedParameters *credentials,
gchar **out_certificate_pem,
GTlsCertificateFlags *out_certificate_errors,
GCancellable *cancellable,
GError **error)
{
- CamelO365Settings *o365_settings;
- EO365Connection *cnc;
+ CamelM365Settings *m365_settings;
+ EM365Connection *cnc;
ESourceAuthenticationResult result;
- g_return_val_if_fail (E_IS_O365_BACKEND (backend), E_SOURCE_AUTHENTICATION_ERROR);
+ g_return_val_if_fail (E_IS_M365_BACKEND (backend), E_SOURCE_AUTHENTICATION_ERROR);
- o365_settings = camel_o365_settings_get_from_backend (backend, NULL);
- g_return_val_if_fail (o365_settings != NULL, E_SOURCE_AUTHENTICATION_ERROR);
+ m365_settings = camel_m365_settings_get_from_backend (backend, NULL);
+ g_return_val_if_fail (m365_settings != NULL, E_SOURCE_AUTHENTICATION_ERROR);
- cnc = e_o365_connection_new (e_backend_get_source (backend), o365_settings);
+ cnc = e_m365_connection_new (e_backend_get_source (backend), m365_settings);
- result = e_o365_connection_authenticate_sync (cnc, NULL, E_O365_FOLDER_KIND_UNKNOWN, NULL, NULL,
out_certificate_pem, out_certificate_errors, cancellable, error);
+ result = e_m365_connection_authenticate_sync (cnc, NULL, E_M365_FOLDER_KIND_UNKNOWN, NULL, NULL,
out_certificate_pem, out_certificate_errors, cancellable, error);
if (result == E_SOURCE_AUTHENTICATION_ACCEPTED) {
e_collection_backend_authenticate_children (E_COLLECTION_BACKEND (backend), credentials);
- o365_backend_sync_folders (E_O365_BACKEND (backend), cnc, NULL, NULL, NULL);
+ m365_backend_sync_folders (E_M365_BACKEND (backend), cnc, NULL, NULL, NULL);
} else if (result == E_SOURCE_AUTHENTICATION_REJECTED &&
!e_named_parameters_exists (credentials, E_SOURCE_CREDENTIAL_PASSWORD)) {
result = E_SOURCE_AUTHENTICATION_REQUIRED;
@@ -792,13 +781,13 @@ o365_backend_authenticate_sync (EBackend *backend,
}
static void
-o365_backend_constructed (GObject *object)
+m365_backend_constructed (GObject *object)
{
EBackend *backend;
ESource *source;
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_o365_backend_parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_m365_backend_parent_class)->constructed (object);
backend = E_BACKEND (object);
source = e_backend_get_source (backend);
@@ -818,80 +807,80 @@ o365_backend_constructed (GObject *object)
}
static void
-o365_backend_dispose (GObject *object)
+m365_backend_dispose (GObject *object)
{
- EO365Backend *o365_backend = E_O365_BACKEND (object);
+ EM365Backend *m365_backend = E_M365_BACKEND (object);
ESource *source;
source = e_backend_get_source (E_BACKEND (object));
- if (source && o365_backend->priv->source_changed_id) {
- g_signal_handler_disconnect (source, o365_backend->priv->source_changed_id);
- o365_backend->priv->source_changed_id = 0;
+ if (source && m365_backend->priv->source_changed_id) {
+ g_signal_handler_disconnect (source, m365_backend->priv->source_changed_id);
+ m365_backend->priv->source_changed_id = 0;
}
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_o365_backend_parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_m365_backend_parent_class)->dispose (object);
}
static void
-o365_backend_finalize (GObject *object)
+m365_backend_finalize (GObject *object)
{
- EO365Backend *o365_backend = E_O365_BACKEND (object);
+ EM365Backend *m365_backend = E_M365_BACKEND (object);
- g_hash_table_destroy (o365_backend->priv->folder_sources);
- g_mutex_clear (&o365_backend->priv->property_lock);
+ g_hash_table_destroy (m365_backend->priv->folder_sources);
+ g_mutex_clear (&m365_backend->priv->property_lock);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_o365_backend_parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_m365_backend_parent_class)->finalize (object);
}
static void
-e_o365_backend_class_init (EO365BackendClass *class)
+e_m365_backend_class_init (EM365BackendClass *class)
{
GObjectClass *object_class;
EBackendClass *backend_class;
ECollectionBackendClass *collection_backend_class;
object_class = G_OBJECT_CLASS (class);
- object_class->dispose = o365_backend_dispose;
- object_class->finalize = o365_backend_finalize;
- object_class->constructed = o365_backend_constructed;
+ object_class->dispose = m365_backend_dispose;
+ object_class->finalize = m365_backend_finalize;
+ object_class->constructed = m365_backend_constructed;
collection_backend_class = E_COLLECTION_BACKEND_CLASS (class);
- collection_backend_class->populate = o365_backend_populate;
- collection_backend_class->dup_resource_id = o365_backend_dup_resource_id;
- collection_backend_class->child_added = o365_backend_child_added;
- collection_backend_class->child_removed = o365_backend_child_removed;
- collection_backend_class->create_resource_sync = o365_backend_create_resource_sync;
- collection_backend_class->delete_resource_sync = o365_backend_delete_resource_sync;
+ collection_backend_class->populate = m365_backend_populate;
+ collection_backend_class->dup_resource_id = m365_backend_dup_resource_id;
+ collection_backend_class->child_added = m365_backend_child_added;
+ collection_backend_class->child_removed = m365_backend_child_removed;
+ collection_backend_class->create_resource_sync = m365_backend_create_resource_sync;
+ collection_backend_class->delete_resource_sync = m365_backend_delete_resource_sync;
backend_class = E_BACKEND_CLASS (class);
- backend_class->get_destination_address = o365_backend_get_destination_address;
- backend_class->authenticate_sync = o365_backend_authenticate_sync;
+ backend_class->get_destination_address = m365_backend_get_destination_address;
+ backend_class->authenticate_sync = m365_backend_authenticate_sync;
- /* This generates an ESourceCamel subtype for CamelO365Settings. */
- e_source_camel_generate_subtype ("office365", CAMEL_TYPE_O365_SETTINGS);
+ /* This generates an ESourceCamel subtype for CamelM365Settings. */
+ e_source_camel_generate_subtype ("microsoft365", CAMEL_TYPE_M365_SETTINGS);
}
static void
-e_o365_backend_class_finalize (EO365BackendClass *class)
+e_m365_backend_class_finalize (EM365BackendClass *class)
{
}
static void
-e_o365_backend_init (EO365Backend *backend)
+e_m365_backend_init (EM365Backend *backend)
{
- backend->priv = e_o365_backend_get_instance_private (backend);
+ backend->priv = e_m365_backend_get_instance_private (backend);
backend->priv->folder_sources = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
g_object_unref);
g_mutex_init (&backend->priv->property_lock);
}
void
-e_o365_backend_type_register (GTypeModule *type_module)
+e_m365_backend_type_register (GTypeModule *type_module)
{
/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
* function, so we have to wrap it with a public function in
* order to register types from a separate compilation unit. */
- e_o365_backend_register_type (type_module);
+ e_m365_backend_register_type (type_module);
}
diff --git a/src/Microsoft365/registry/e-m365-backend.h b/src/Microsoft365/registry/e-m365-backend.h
new file mode 100644
index 00000000..834c28c8
--- /dev/null
+++ b/src/Microsoft365/registry/e-m365-backend.h
@@ -0,0 +1,51 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_M365_BACKEND_H
+#define E_M365_BACKEND_H
+
+#include <libebackend/libebackend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_M365_BACKEND \
+ (e_m365_backend_get_type ())
+#define E_M365_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_M365_BACKEND, EM365Backend))
+#define E_M365_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_M365_BACKEND, EM365BackendClass))
+#define E_IS_M365_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_M365_BACKEND))
+#define E_IS_M365_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_M365_BACKEND))
+#define E_M365_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_M365_BACKEND, EM365BackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EM365Backend EM365Backend;
+typedef struct _EM365BackendClass EM365BackendClass;
+typedef struct _EM365BackendPrivate EM365BackendPrivate;
+
+struct _EM365Backend {
+ ECollectionBackend parent;
+ EM365BackendPrivate *priv;
+};
+
+struct _EM365BackendClass {
+ ECollectionBackendClass parent_class;
+};
+
+GType e_m365_backend_get_type (void) G_GNUC_CONST;
+void e_m365_backend_type_register (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_M365_BACKEND_H */
diff --git a/src/Office365/registry/e-source-o365-deltas.c b/src/Microsoft365/registry/e-source-m365-deltas.c
similarity index 50%
rename from src/Office365/registry/e-source-o365-deltas.c
rename to src/Microsoft365/registry/e-source-m365-deltas.c
index 94b3cffe..f4a8e976 100644
--- a/src/Office365/registry/e-source-o365-deltas.c
+++ b/src/Microsoft365/registry/e-source-m365-deltas.c
@@ -1,25 +1,14 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2020 Red Hat (www.redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU Lesser General Public
- * License as published by the Free Software Foundation.
- *
- * 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 Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "evolution-ews-config.h"
-#include "e-source-o365-deltas.h"
+#include "e-source-m365-deltas.h"
-struct _ESourceO365DeltasPrivate {
+struct _ESourceM365DeltasPrivate {
gchar *contacts_link;
};
@@ -28,18 +17,18 @@ enum {
PROP_CONTACTS_LINK
};
-G_DEFINE_TYPE_WITH_PRIVATE (ESourceO365Deltas, e_source_o365_deltas, E_TYPE_SOURCE_EXTENSION)
+G_DEFINE_TYPE_WITH_PRIVATE (ESourceM365Deltas, e_source_m365_deltas, E_TYPE_SOURCE_EXTENSION)
static void
-source_o365_deltas_set_property (GObject *object,
+source_m365_deltas_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
case PROP_CONTACTS_LINK:
- e_source_o365_deltas_set_contacts_link (
- E_SOURCE_O365_DELTAS (object),
+ e_source_m365_deltas_set_contacts_link (
+ E_SOURCE_M365_DELTAS (object),
g_value_get_string (value));
return;
}
@@ -48,7 +37,7 @@ source_o365_deltas_set_property (GObject *object,
}
static void
-source_o365_deltas_get_property (GObject *object,
+source_m365_deltas_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
@@ -57,8 +46,8 @@ source_o365_deltas_get_property (GObject *object,
case PROP_CONTACTS_LINK:
g_value_take_string (
value,
- e_source_o365_deltas_dup_contacts_link (
- E_SOURCE_O365_DELTAS (object)));
+ e_source_m365_deltas_dup_contacts_link (
+ E_SOURCE_M365_DELTAS (object)));
return;
}
@@ -66,29 +55,29 @@ source_o365_deltas_get_property (GObject *object,
}
static void
-source_o365_deltas_finalize (GObject *object)
+source_m365_deltas_finalize (GObject *object)
{
- ESourceO365Deltas *o365_deltas = E_SOURCE_O365_DELTAS (object);
+ ESourceM365Deltas *m365_deltas = E_SOURCE_M365_DELTAS (object);
- g_free (o365_deltas->priv->contacts_link);
+ g_free (m365_deltas->priv->contacts_link);
/* Chain up to parent's method. */
- G_OBJECT_CLASS (e_source_o365_deltas_parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_source_m365_deltas_parent_class)->finalize (object);
}
static void
-e_source_o365_deltas_class_init (ESourceO365DeltasClass *class)
+e_source_m365_deltas_class_init (ESourceM365DeltasClass *class)
{
GObjectClass *object_class;
ESourceExtensionClass *extension_class;
object_class = G_OBJECT_CLASS (class);
- object_class->set_property = source_o365_deltas_set_property;
- object_class->get_property = source_o365_deltas_get_property;
- object_class->finalize = source_o365_deltas_finalize;
+ object_class->set_property = source_m365_deltas_set_property;
+ object_class->get_property = source_m365_deltas_get_property;
+ object_class->finalize = source_m365_deltas_finalize;
extension_class = E_SOURCE_EXTENSION_CLASS (class);
- extension_class->name = E_SOURCE_EXTENSION_O365_DELTAS;
+ extension_class->name = E_SOURCE_EXTENSION_M365_DELTAS;
g_object_class_install_property (
object_class,
@@ -105,38 +94,38 @@ e_source_o365_deltas_class_init (ESourceO365DeltasClass *class)
}
static void
-e_source_o365_deltas_init (ESourceO365Deltas *extension)
+e_source_m365_deltas_init (ESourceM365Deltas *extension)
{
- extension->priv = e_source_o365_deltas_get_instance_private (extension);
+ extension->priv = e_source_m365_deltas_get_instance_private (extension);
}
void
-e_source_o365_deltas_type_register (GTypeModule *type_module)
+e_source_m365_deltas_type_register (GTypeModule *type_module)
{
/* We need to ensure this is registered, because it's looked up
* by name in e_source_get_extension(). */
- g_type_ensure (E_TYPE_SOURCE_O365_DELTAS);
+ g_type_ensure (E_TYPE_SOURCE_M365_DELTAS);
}
const gchar *
-e_source_o365_deltas_get_contacts_link (ESourceO365Deltas *extension)
+e_source_m365_deltas_get_contacts_link (ESourceM365Deltas *extension)
{
- g_return_val_if_fail (E_IS_SOURCE_O365_DELTAS (extension), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_M365_DELTAS (extension), NULL);
return extension->priv->contacts_link;
}
gchar *
-e_source_o365_deltas_dup_contacts_link (ESourceO365Deltas *extension)
+e_source_m365_deltas_dup_contacts_link (ESourceM365Deltas *extension)
{
const gchar *protected;
gchar *duplicate;
- g_return_val_if_fail (E_IS_SOURCE_O365_DELTAS (extension), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_M365_DELTAS (extension), NULL);
e_source_extension_property_lock (E_SOURCE_EXTENSION (extension));
- protected = e_source_o365_deltas_get_contacts_link (extension);
+ protected = e_source_m365_deltas_get_contacts_link (extension);
duplicate = g_strdup (protected);
e_source_extension_property_unlock (E_SOURCE_EXTENSION (extension));
@@ -145,10 +134,10 @@ e_source_o365_deltas_dup_contacts_link (ESourceO365Deltas *extension)
}
void
-e_source_o365_deltas_set_contacts_link (ESourceO365Deltas *extension,
+e_source_m365_deltas_set_contacts_link (ESourceM365Deltas *extension,
const gchar *delta_link)
{
- g_return_if_fail (E_IS_SOURCE_O365_DELTAS (extension));
+ g_return_if_fail (E_IS_SOURCE_M365_DELTAS (extension));
e_source_extension_property_lock (E_SOURCE_EXTENSION (extension));
diff --git a/src/Microsoft365/registry/e-source-m365-deltas.h
b/src/Microsoft365/registry/e-source-m365-deltas.h
new file mode 100644
index 00000000..3cd9132e
--- /dev/null
+++ b/src/Microsoft365/registry/e-source-m365-deltas.h
@@ -0,0 +1,61 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef E_SOURCE_M365_DELTAS_H
+#define E_SOURCE_M365_DELTAS_H
+
+#include <libedataserver/libedataserver.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SOURCE_M365_DELTAS \
+ (e_source_m365_deltas_get_type ())
+#define E_SOURCE_M365_DELTAS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SOURCE_M365_DELTAS, ESourceM365Deltas))
+#define E_SOURCE_M365_DELTAS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SOURCE_M365_DELTAS, ESourceM365DeltasClass))
+#define E_IS_SOURCE_M365_DELTAS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SOURCE_M365_DELTAS))
+#define E_IS_SOURCE_M365_DELTAS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SOURCE_M365_DELTAS))
+#define E_SOURCE_M365_DELTAS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SOURCE_M365_DELTAS, ESourceM365DeltasClass))
+
+#define E_SOURCE_EXTENSION_M365_DELTAS "Microsoft365 Deltas"
+
+G_BEGIN_DECLS
+
+typedef struct _ESourceM365Deltas ESourceM365Deltas;
+typedef struct _ESourceM365DeltasClass ESourceM365DeltasClass;
+typedef struct _ESourceM365DeltasPrivate ESourceM365DeltasPrivate;
+
+struct _ESourceM365Deltas {
+ ESourceExtension parent;
+ ESourceM365DeltasPrivate *priv;
+};
+
+struct _ESourceM365DeltasClass {
+ ESourceExtensionClass parent_class;
+};
+
+GType e_source_m365_deltas_get_type (void) G_GNUC_CONST;
+void e_source_m365_deltas_type_register
+ (GTypeModule *type_module);
+const gchar * e_source_m365_deltas_get_contacts_link
+ (ESourceM365Deltas *extension);
+gchar * e_source_m365_deltas_dup_contacts_link
+ (ESourceM365Deltas *extension);
+void e_source_m365_deltas_set_contacts_link
+ (ESourceM365Deltas *extension,
+ const gchar *delta_link);
+
+G_END_DECLS
+
+#endif /* E_SOURCE_M365_DELTAS_H */
diff --git a/src/Microsoft365/registry/module-m365-backend.c b/src/Microsoft365/registry/module-m365-backend.c
new file mode 100644
index 00000000..2784a41d
--- /dev/null
+++ b/src/Microsoft365/registry/module-m365-backend.c
@@ -0,0 +1,39 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com)
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "evolution-ews-config.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "common/e-oauth2-service-microsoft365.h"
+#include "common/e-source-m365-folder.h"
+
+#include "e-m365-backend.h"
+#include "e-m365-backend-factory.h"
+#include "e-source-m365-deltas.h"
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ bindtextdomain (GETTEXT_PACKAGE, M365_LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+ e_oauth2_service_microsoft365_type_register (type_module);
+ e_source_m365_folder_type_register (type_module);
+
+ e_source_m365_deltas_type_register (type_module);
+ e_m365_backend_type_register (type_module);
+ e_m365_backend_factory_type_register (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
diff --git a/src/configuration/e-mail-config-ews-backend.c b/src/configuration/e-mail-config-ews-backend.c
index 8c9d081b..366e8978 100644
--- a/src/configuration/e-mail-config-ews-backend.c
+++ b/src/configuration/e-mail-config-ews-backend.c
@@ -335,13 +335,13 @@ mail_config_ews_backend_insert_widgets (EMailConfigServiceBackend *backend,
widget, "sensitive",
G_BINDING_SYNC_CREATE);
- mail_config_ews_backend_set_oauth2_tooltip (widget, OFFICE365_TENANT,
+ mail_config_ews_backend_set_oauth2_tooltip (widget, MICROSOFT365_TENANT,
/* Translators: 'Tenant' here means a term used by Microsoft to identify a company or
organization in an Office 365 world. Same for 'common', it's a default URL path.
You probably do not want to translate it. More for example here:
https://powerbi.microsoft.com/en-us/blog/what-is-a-tenant/ */
_("Default tenant is “common“"),
/* Translators: 'Tenant' here means a term used by Microsoft to identify a company or
organization in an Office 365 world.
You probably do not want to translate it. More for example here:
https://powerbi.microsoft.com/en-us/blog/what-is-a-tenant/ */
- g_strdup_printf (_("Default tenant is “%s”"), OFFICE365_TENANT));
+ g_strdup_printf (_("Default tenant is “%s”"), MICROSOFT365_TENANT));
widget = gtk_label_new_with_mnemonic (_("Application I_D:"));
gtk_widget_set_margin_left (widget, 12);
@@ -365,9 +365,9 @@ mail_config_ews_backend_insert_widgets (EMailConfigServiceBackend *backend,
widget, "sensitive",
G_BINDING_SYNC_CREATE);
- mail_config_ews_backend_set_oauth2_tooltip (widget, OFFICE365_CLIENT_ID,
+ mail_config_ews_backend_set_oauth2_tooltip (widget, MICROSOFT365_CLIENT_ID,
_("There is not set any default application ID"),
- g_strdup_printf (_("Default application ID is “%s”"), OFFICE365_CLIENT_ID));
+ g_strdup_printf (_("Default application ID is “%s”"), MICROSOFT365_CLIENT_ID));
widget = gtk_label_new_with_mnemonic (_("_Redirect URI:"));
gtk_widget_set_margin_left (widget, 12);
@@ -392,9 +392,9 @@ mail_config_ews_backend_insert_widgets (EMailConfigServiceBackend *backend,
G_BINDING_SYNC_CREATE);
markup = g_strdup_printf (_("Default redirect URI is “%s”"),
"https://login.microsoftonline.com/common/oauth2/nativeclient");
- mail_config_ews_backend_set_oauth2_tooltip (widget, OFFICE365_REDIRECT_URI,
+ mail_config_ews_backend_set_oauth2_tooltip (widget, MICROSOFT365_REDIRECT_URI,
markup,
- g_strdup_printf (_("Default redirect URI is “%s”"), OFFICE365_REDIRECT_URI));
+ g_strdup_printf (_("Default redirect URI is “%s”"), MICROSOFT365_REDIRECT_URI));
g_free (markup);
gtk_widget_show_all (GTK_WIDGET (priv->oauth2_settings_grid));
@@ -610,7 +610,7 @@ mail_config_ews_backend_check_complete (EMailConfigServiceBackend *backend)
if (camel_ews_settings_get_override_oauth2 (ews_settings)) {
client_id = camel_ews_settings_get_oauth2_client_id (ews_settings);
} else {
- client_id = OFFICE365_CLIENT_ID;
+ client_id = MICROSOFT365_CLIENT_ID;
}
correct = client_id && *client_id;
diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt
index 955668ee..94dcb0b4 100644
--- a/src/server/CMakeLists.txt
+++ b/src/server/CMakeLists.txt
@@ -3,6 +3,8 @@ glib_mkenums(e-ews-enumtypes e-ews-enums.h E_EWS_ENUMTYPES_H)
set(SOURCES
camel-ews-settings.c
camel-ews-settings.h
+ camel-sasl-xoauth2-office365.c
+ camel-sasl-xoauth2-office365.h
e-ews-calendar-utils.c
e-ews-calendar-utils.h
e-ews-camel-common.c
@@ -26,6 +28,8 @@ set(SOURCES
e-ews-oof-settings.c
e-ews-query-to-restriction.c
e-ews-query-to-restriction.h
+ e-oauth2-service-office365.c
+ e-oauth2-service-office365.h
e-soup-auth-negotiate.c
e-soup-auth-negotiate.h
e-soap-message.c
diff --git a/src/Office365/common/camel-sasl-xoauth2-office365.c b/src/server/camel-sasl-xoauth2-office365.c
similarity index 100%
rename from src/Office365/common/camel-sasl-xoauth2-office365.c
rename to src/server/camel-sasl-xoauth2-office365.c
diff --git a/src/Office365/common/camel-sasl-xoauth2-office365.h b/src/server/camel-sasl-xoauth2-office365.h
similarity index 100%
rename from src/Office365/common/camel-sasl-xoauth2-office365.h
rename to src/server/camel-sasl-xoauth2-office365.h
diff --git a/src/Office365/common/e-oauth2-service-office365.c b/src/server/e-oauth2-service-office365.c
similarity index 77%
rename from src/Office365/common/e-oauth2-service-office365.c
rename to src/server/e-oauth2-service-office365.c
index bf1a2c49..9dcfc46e 100644
--- a/src/Office365/common/e-oauth2-service-office365.c
+++ b/src/server/e-oauth2-service-office365.c
@@ -9,31 +9,16 @@
#include <glib/gi18n-lib.h>
#include <libedataserver/libedataserver.h>
-#include "camel-o365-settings.h"
+#include "server/camel-ews-settings.h"
#include "e-oauth2-service-office365.h"
/* https://portal.azure.com/
- https://docs.microsoft.com/en-us/graph/auth/
-
https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-developers-guide
https://tsmatz.wordpress.com/2016/10/07/application-permission-with-v2-endpoint-and-microsoft-graph/
*/
-#define OFFICE365_SCOPE "Calendars.ReadWrite " \
- "Calendars.ReadWrite.Shared " \
- "Contacts.ReadWrite " \
- "Contacts.ReadWrite.Shared " \
- "Mail.ReadWrite " \
- "Mail.ReadWrite.Shared " \
- "Mail.Send " \
- "Mail.Send.Shared " \
- "MailboxSettings.Read " \
- "Notes.Create " \
- "Notes.ReadWrite.All " \
- "offline_access " \
- "Tasks.ReadWrite " \
- "Tasks.ReadWrite.Shared "
+#define OFFICE365_RESOURCE "https://outlook.office.com"
struct _EOAuth2ServiceOffice365Private
{
@@ -45,8 +30,7 @@ struct _EOAuth2ServiceOffice365Private
static void e_oauth2_service_office365_oauth2_service_init (EOAuth2ServiceInterface *iface);
G_DEFINE_DYNAMIC_TYPE_EXTENDED (EOAuth2ServiceOffice365, e_oauth2_service_office365,
E_TYPE_OAUTH2_SERVICE_BASE, 0,
- G_IMPLEMENT_INTERFACE_DYNAMIC (E_TYPE_OAUTH2_SERVICE, e_oauth2_service_office365_oauth2_service_init)
- G_ADD_PRIVATE_DYNAMIC (EOAuth2ServiceOffice365))
+ G_IMPLEMENT_INTERFACE_DYNAMIC (E_TYPE_OAUTH2_SERVICE, e_oauth2_service_office365_oauth2_service_init))
static const gchar *
eos_office365_cache_string (EOAuth2ServiceOffice365 *oauth2_office365,
@@ -77,7 +61,7 @@ eos_office365_cache_string (EOAuth2ServiceOffice365 *oauth2_office365,
return cached_str;
}
-static CamelO365Settings *
+static CamelEwsSettings *
eos_office365_get_camel_settings (ESource *source)
{
ESourceCamel *extension;
@@ -87,9 +71,9 @@ eos_office365_get_camel_settings (ESource *source)
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- extension = e_source_get_extension (source, e_source_camel_get_extension_name ("office365"));
+ extension = e_source_get_extension (source, e_source_camel_get_extension_name ("ews"));
- return CAMEL_O365_SETTINGS (e_source_camel_get_settings (extension));
+ return CAMEL_EWS_SETTINGS (e_source_camel_get_settings (extension));
}
static gboolean
@@ -98,7 +82,8 @@ eos_office365_guess_can_process (EOAuth2Service *service,
const gchar *hostname)
{
return e_oauth2_services_is_supported () &&
- protocol && g_ascii_strcasecmp (protocol, "office365") == 0;
+ protocol && g_ascii_strcasecmp (protocol, "ews") == 0 &&
+ hostname && e_util_utf8_strstrcase (hostname, "outlook.office365.com");
}
static const gchar *
@@ -119,11 +104,11 @@ eos_office365_get_client_id (EOAuth2Service *service,
ESource *source)
{
EOAuth2ServiceOffice365 *oauth2_office365 = E_OAUTH2_SERVICE_OFFICE365 (service);
- CamelO365Settings *o365_settings;
+ CamelEwsSettings *ews_settings;
- o365_settings = eos_office365_get_camel_settings (source);
- if (o365_settings && camel_o365_settings_get_override_oauth2 (o365_settings)) {
- gchar *client_id = camel_o365_settings_dup_oauth2_client_id (o365_settings);
+ ews_settings = eos_office365_get_camel_settings (source);
+ if (ews_settings && camel_ews_settings_get_override_oauth2 (ews_settings)) {
+ gchar *client_id = camel_ews_settings_dup_oauth2_client_id (ews_settings);
if (client_id && !*client_id) {
g_free (client_id);
@@ -134,7 +119,7 @@ eos_office365_get_client_id (EOAuth2Service *service,
return eos_office365_cache_string (oauth2_office365, client_id);
}
- return OFFICE365_CLIENT_ID;
+ return MICROSOFT365_CLIENT_ID;
}
static const gchar *
@@ -149,29 +134,29 @@ eos_office365_get_authentication_uri (EOAuth2Service *service,
ESource *source)
{
EOAuth2ServiceOffice365 *oauth2_office365 = E_OAUTH2_SERVICE_OFFICE365 (service);
- CamelO365Settings *o365_settings;
+ CamelEwsSettings *ews_settings;
- o365_settings = eos_office365_get_camel_settings (source);
- if (o365_settings && camel_o365_settings_get_override_oauth2 (o365_settings)) {
+ ews_settings = eos_office365_get_camel_settings (source);
+ if (ews_settings && camel_ews_settings_get_override_oauth2 (ews_settings)) {
gchar *tenant;
const gchar *res;
- tenant = camel_o365_settings_dup_oauth2_tenant (o365_settings);
+ tenant = camel_ews_settings_dup_oauth2_tenant (ews_settings);
if (tenant && !*tenant) {
g_free (tenant);
tenant = NULL;
}
res = eos_office365_cache_string (oauth2_office365,
- g_strdup_printf ("https://login.microsoftonline.com/%s/oauth2/v2.0/authorize",
- tenant ? tenant : OFFICE365_TENANT));
+ g_strdup_printf ("https://login.microsoftonline.com/%s/oauth2/authorize",
+ tenant ? tenant : MICROSOFT365_TENANT));
g_free (tenant);
return res;
}
- return "https://login.microsoftonline.com/" OFFICE365_TENANT "/oauth2/v2.0/authorize";
+ return "https://login.microsoftonline.com/" MICROSOFT365_TENANT "/oauth2/authorize";
}
static const gchar *
@@ -179,29 +164,29 @@ eos_office365_get_refresh_uri (EOAuth2Service *service,
ESource *source)
{
EOAuth2ServiceOffice365 *oauth2_office365 = E_OAUTH2_SERVICE_OFFICE365 (service);
- CamelO365Settings *o365_settings;
+ CamelEwsSettings *ews_settings;
- o365_settings = eos_office365_get_camel_settings (source);
- if (o365_settings && camel_o365_settings_get_override_oauth2 (o365_settings)) {
+ ews_settings = eos_office365_get_camel_settings (source);
+ if (ews_settings && camel_ews_settings_get_override_oauth2 (ews_settings)) {
gchar *tenant;
const gchar *res;
- tenant = camel_o365_settings_dup_oauth2_tenant (o365_settings);
+ tenant = camel_ews_settings_dup_oauth2_tenant (ews_settings);
if (tenant && !*tenant) {
g_free (tenant);
tenant = NULL;
}
res = eos_office365_cache_string (oauth2_office365,
- g_strdup_printf ("https://login.microsoftonline.com/%s/oauth2/v2.0/token",
- tenant ? tenant : OFFICE365_TENANT));
+ g_strdup_printf ("https://login.microsoftonline.com/%s/oauth2/token",
+ tenant ? tenant : MICROSOFT365_TENANT));
g_free (tenant);
return res;
}
- return "https://login.microsoftonline.com/" OFFICE365_TENANT "/oauth2/v2.0/token";
+ return "https://login.microsoftonline.com/" MICROSOFT365_TENANT "/oauth2/token";
}
static const gchar *
@@ -209,14 +194,14 @@ eos_office365_get_redirect_uri (EOAuth2Service *service,
ESource *source)
{
EOAuth2ServiceOffice365 *oauth2_office365 = E_OAUTH2_SERVICE_OFFICE365 (service);
- CamelO365Settings *o365_settings;
+ CamelEwsSettings *ews_settings;
const gchar *res;
- o365_settings = eos_office365_get_camel_settings (source);
- if (o365_settings && camel_o365_settings_get_override_oauth2 (o365_settings)) {
+ ews_settings = eos_office365_get_camel_settings (source);
+ if (ews_settings && camel_ews_settings_get_override_oauth2 (ews_settings)) {
gchar *redirect_uri;
- redirect_uri = camel_o365_settings_dup_oauth2_redirect_uri (o365_settings);
+ redirect_uri = camel_ews_settings_dup_oauth2_redirect_uri (ews_settings);
if (redirect_uri && !*redirect_uri) {
g_free (redirect_uri);
@@ -227,7 +212,7 @@ eos_office365_get_redirect_uri (EOAuth2Service *service,
return eos_office365_cache_string (oauth2_office365, redirect_uri);
}
- res = OFFICE365_REDIRECT_URI;
+ res = MICROSOFT365_REDIRECT_URI;
if (res && *res)
return res;
@@ -241,9 +226,9 @@ eos_office365_prepare_authentication_uri_query (EOAuth2Service *service,
{
g_return_if_fail (uri_query != NULL);
- e_oauth2_service_util_set_to_form (uri_query, "response_type", "code");
- e_oauth2_service_util_set_to_form (uri_query, "scope", OFFICE365_SCOPE);
e_oauth2_service_util_set_to_form (uri_query, "response_mode", "query");
+ e_oauth2_service_util_set_to_form (uri_query, "prompt", "login");
+ e_oauth2_service_util_set_to_form (uri_query, "resource", OFFICE365_RESOURCE);
}
static gboolean
@@ -310,7 +295,7 @@ eos_office365_prepare_refresh_token_form (EOAuth2Service *service,
{
g_return_if_fail (form != NULL);
- e_oauth2_service_util_set_to_form (form, "scope", OFFICE365_SCOPE);
+ e_oauth2_service_util_set_to_form (form, "resource", OFFICE365_RESOURCE);
e_oauth2_service_util_set_to_form (form, "redirect_uri", e_oauth2_service_get_redirect_uri (service,
source));
}
@@ -349,6 +334,8 @@ e_oauth2_service_office365_class_init (EOAuth2ServiceOffice365Class *klass)
{
GObjectClass *object_class;
+ g_type_class_add_private (klass, sizeof (EOAuth2ServiceOffice365Private));
+
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = eos_office365_finalize;
}
@@ -361,7 +348,7 @@ e_oauth2_service_office365_class_finalize (EOAuth2ServiceOffice365Class *klass)
static void
e_oauth2_service_office365_init (EOAuth2ServiceOffice365 *oauth2_office365)
{
- oauth2_office365->priv = e_oauth2_service_office365_get_instance_private (oauth2_office365);
+ oauth2_office365->priv = G_TYPE_INSTANCE_GET_PRIVATE (oauth2_office365,
E_TYPE_OAUTH2_SERVICE_OFFICE365, EOAuth2ServiceOffice365Private);
g_mutex_init (&oauth2_office365->priv->string_cache_lock);
oauth2_office365->priv->string_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
diff --git a/src/Office365/common/e-oauth2-service-office365.h b/src/server/e-oauth2-service-office365.h
similarity index 100%
rename from src/Office365/common/e-oauth2-service-office365.h
rename to src/server/e-oauth2-service-office365.h
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]