| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: (C) 2020 Red Hat (www.redhat.com) |
| 3 |
* SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
*/ |
| 5 |
|
| 6 |
#include "evolution-ews-config.h" |
| 7 |
|
| 8 |
#include "e-m365-backend.h" |
| 9 |
|
| 10 |
#include "e-m365-backend-factory.h" |
| 11 |
|
| 12 |
G_DEFINE_DYNAMIC_TYPE (EM365BackendFactory, e_m365_backend_factory, E_TYPE_COLLECTION_BACKEND_FACTORY) |
| 13 |
|
| 14 |
static void |
| 15 |
m365_backend_prepare_mail_account_source (ESource *source) |
| 16 |
{ |
| 17 |
ESourceBackend *extension; |
| 18 |
const gchar *extension_name; |
| 19 |
|
| 20 |
extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT; |
| 21 |
extension = e_source_get_extension (source, extension_name); |
| 22 |
e_source_backend_set_backend_name (extension, "microsoft365"); |
| 23 |
} |
| 24 |
|
| 25 |
static void |
| 26 |
m365_backend_prepare_mail_transport_source (ESource *source) |
| 27 |
{ |
| 28 |
ESourceBackend *extension; |
| 29 |
const gchar *extension_name; |
| 30 |
|
| 31 |
extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT; |
| 32 |
extension = e_source_get_extension (source, extension_name); |
| 33 |
e_source_backend_set_backend_name (extension, "microsoft365"); |
| 34 |
} |
| 35 |
|
| 36 |
static void |
| 37 |
m365_backend_factory_prepare_mail (ECollectionBackendFactory *factory, |
| 38 |
ESource *mail_account_source, |
| 39 |
ESource *mail_identity_source, |
| 40 |
ESource *mail_transport_source) |
| 41 |
{ |
| 42 |
/* Chain up to parent's method. */ |
| 43 |
E_COLLECTION_BACKEND_FACTORY_CLASS (e_m365_backend_factory_parent_class)->prepare_mail (factory, mail_account_source, mail_identity_source, mail_transport_source); |
| 44 |
|
| 45 |
m365_backend_prepare_mail_account_source (mail_account_source); |
| 46 |
m365_backend_prepare_mail_transport_source (mail_transport_source); |
| 47 |
} |
| 48 |
|
| 49 |
static void |
| 50 |
e_m365_backend_factory_class_init (EM365BackendFactoryClass *class) |
| 51 |
{ |
| 52 |
ECollectionBackendFactoryClass *factory_class; |
| 53 |
|
| 54 |
factory_class = E_COLLECTION_BACKEND_FACTORY_CLASS (class); |
| 55 |
factory_class->factory_name = "microsoft365"; |
| 56 |
factory_class->backend_type = E_TYPE_M365_BACKEND; |
| 57 |
factory_class->prepare_mail = m365_backend_factory_prepare_mail; |
| 58 |
} |
| 59 |
|
| 60 |
static void |
| 61 |
e_m365_backend_factory_class_finalize (EM365BackendFactoryClass *class) |
| 62 |
{ |
| 63 |
} |
| 64 |
|
| 65 |
static void |
| 66 |
e_m365_backend_factory_init (EM365BackendFactory *factory) |
| 67 |
{ |
| 68 |
} |
| 69 |
|
| 70 |
void |
| 71 |
e_m365_backend_factory_type_register (GTypeModule *type_module) |
| 72 |
{ |
| 73 |
/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration |
| 74 |
* function, so we have to wrap it with a public function in |
| 75 |
* order to register types from a separate compilation unit. */ |
| 76 |
e_m365_backend_factory_register_type (type_module); |
| 77 |
} |