[evolution-data-server] Add OAuth2 authentication for Outlook.com IMAP and SMTP



commit 3885a543c549e40d36f59b0538d3ae90d386fd37
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jan 24 09:09:00 2018 +0100

    Add OAuth2 authentication for Outlook.com IMAP and SMTP
    
    It looks like the IMAP accepts an @outlook.com address, while
    SMTP accepts only the primary address of the Microsoft account,
    which not necessarily is the same @outlook.com address.

 CMakeLists.txt                                     |   12 ++
 config.h.in                                        |    6 +
 docs/reference/camel/camel-docs.sgml.in            |    1 +
 .../evolution-data-server-docs.sgml.in             |    1 +
 po/POTFILES.in                                     |    2 +
 src/camel/CMakeLists.txt                           |    2 +
 src/camel/camel-sasl-xoauth2-outlook.c             |   44 +++++
 src/camel/camel-sasl-xoauth2-outlook.h             |   63 +++++++
 src/camel/camel-sasl.c                             |    2 +
 src/camel/camel.h                                  |    1 +
 src/libedataserver/CMakeLists.txt                  |    2 +
 src/libedataserver/e-oauth2-service-outlook.c      |  186 ++++++++++++++++++++
 src/libedataserver/e-oauth2-service-outlook.h      |   62 +++++++
 src/libedataserver/e-oauth2-services.c             |    2 +
 src/libedataserver/libedataserver.h                |    1 +
 15 files changed, 387 insertions(+), 0 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a6d583b..803e3f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -402,6 +402,18 @@ if(ENABLE_OAUTH2)
        if(WITH_GOOGLE_CLIENT_SECRET STREQUAL "")
                set(WITH_GOOGLE_CLIENT_SECRET "mtfUe5W8Aal9DcgVipOY1T9G")
        endif(WITH_GOOGLE_CLIENT_SECRET STREQUAL "")
+
+       add_printable_variable(WITH_OUTLOOK_CLIENT_ID "Outlook.com OAuth 2.0 client id" "")
+       add_printable_variable(WITH_OUTLOOK_CLIENT_SECRET "Outlook.com OAuth 2.0 client secret" "")
+
+       if(WITH_OUTLOOK_CLIENT_ID STREQUAL "")
+               set(WITH_OUTLOOK_CLIENT_ID "cc6e0693-0e26-4220-8322-9d363e308fc6")
+       endif(WITH_OUTLOOK_CLIENT_ID STREQUAL "")
+
+       # Outlook.com requires client secret only for Web applications
+       #if(WITH_OUTLOOK_CLIENT_SECRET STREQUAL "")
+       #       set(WITH_OUTLOOK_CLIENT_SECRET "")
+       #endif(WITH_OUTLOOK_CLIENT_SECRET STREQUAL "")
 endif(ENABLE_OAUTH2)
 
 # ******************************************
diff --git a/config.h.in b/config.h.in
index 8c41fa5..46fcd72 100644
--- a/config.h.in
+++ b/config.h.in
@@ -36,6 +36,12 @@
 /* Define Google OAuth 2.0 Client Secret to use */
 #define GOOGLE_CLIENT_SECRET "@WITH_GOOGLE_CLIENT_SECRET@"
 
+/* Define Outlook.com OAuth 2.0 Client ID to use */
+#define OUTLOOK_CLIENT_ID "@WITH_OUTLOOK_CLIENT_ID@"
+
+/* Define Outlook.com OAuth 2.0 Client Secret to use */
+#define OUTLOOK_CLIENT_SECRET "@WITH_OUTLOOK_CLIENT_SECRET@"
+
 /* Path to a sendmail binary, or equivalent */
 #define SENDMAIL_PATH "@SENDMAIL_PATH@"
 
diff --git a/docs/reference/camel/camel-docs.sgml.in b/docs/reference/camel/camel-docs.sgml.in
index 1e7d67a..431553d 100644
--- a/docs/reference/camel/camel-docs.sgml.in
+++ b/docs/reference/camel/camel-docs.sgml.in
@@ -151,6 +151,7 @@
       <xi:include href="xml/camel-sasl-popb4smtp.xml"/>
       <xi:include href="xml/camel-sasl-xoauth2.xml"/>
       <xi:include href="xml/camel-sasl-xoauth2-google.xml"/>
+      <xi:include href="xml/camel-sasl-xoauth2-outlook.xml"/>
     </chapter>
 
     <chapter id="MIME">
diff --git a/docs/reference/evolution-data-server/evolution-data-server-docs.sgml.in 
b/docs/reference/evolution-data-server/evolution-data-server-docs.sgml.in
index 2ce2b79..0fc86bb 100644
--- a/docs/reference/evolution-data-server/evolution-data-server-docs.sgml.in
+++ b/docs/reference/evolution-data-server/evolution-data-server-docs.sgml.in
@@ -253,6 +253,7 @@
       <xi:include href="xml/e-oauth2-services.xml"/>
       <xi:include href="xml/e-oauth2-service-base.xml"/>
       <xi:include href="xml/e-oauth2-service-google.xml"/>
+      <xi:include href="xml/e-oauth2-service-outlook.xml"/>
     </chapter>
 
     <chapter>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index f0e768f..c298760 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -115,6 +115,7 @@ src/camel/camel-sasl-plain.c
 src/camel/camel-sasl-popb4smtp.c
 src/camel/camel-sasl-xoauth2.c
 src/camel/camel-sasl-xoauth2-google.c
+src/camel/camel-sasl-xoauth2-outlook.c
 src/camel/camel-search-private.c
 src/camel/camel-service.c
 src/camel/camel-session.c
@@ -194,6 +195,7 @@ src/libedataserver/e-categories.c
 src/libedataserver/e-client.c
 src/libedataserver/e-oauth2-service.c
 src/libedataserver/e-oauth2-service-google.c
+src/libedataserver/e-oauth2-service-outlook.c
 src/libedataserver/e-soup-session.c
 src/libedataserver/e-source.c
 src/libedataserver/e-source-credentials-provider-impl.c
diff --git a/src/camel/CMakeLists.txt b/src/camel/CMakeLists.txt
index a9f50d4..743f129 100644
--- a/src/camel/CMakeLists.txt
+++ b/src/camel/CMakeLists.txt
@@ -91,6 +91,7 @@ set(SOURCES
        camel-sasl-popb4smtp.c
        camel-sasl-xoauth2.c
        camel-sasl-xoauth2-google.c
+       camel-sasl-xoauth2-outlook.c
        camel-sasl.c
        camel-search-private.c
        camel-search-sql-sexp.c
@@ -230,6 +231,7 @@ set(HEADERS
        camel-sasl-popb4smtp.h
        camel-sasl-xoauth2.h
        camel-sasl-xoauth2-google.h
+       camel-sasl-xoauth2-outlook.h
        camel-sasl.h
        camel-search-private.h
        camel-search-sql-sexp.h
diff --git a/src/camel/camel-sasl-xoauth2-outlook.c b/src/camel/camel-sasl-xoauth2-outlook.c
new file mode 100644
index 0000000..ce2cd51
--- /dev/null
+++ b/src/camel/camel-sasl-xoauth2-outlook.c
@@ -0,0 +1,44 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * This library is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This library 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 Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "evolution-data-server-config.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "camel-sasl-xoauth2-outlook.h"
+
+static CamelServiceAuthType sasl_xoauth2_outlook_auth_type = {
+       N_("OAuth2 (Outlook)"),
+       N_("This option will use an OAuth 2.0 "
+          "access token to connect to the Outlook.com server"),
+       "Outlook",
+       FALSE
+};
+
+G_DEFINE_TYPE (CamelSaslXOAuth2Outlook, camel_sasl_xoauth2_outlook, CAMEL_TYPE_SASL_XOAUTH2)
+
+static void
+camel_sasl_xoauth2_outlook_class_init (CamelSaslXOAuth2OutlookClass *klass)
+{
+       CamelSaslClass *sasl_class;
+
+       sasl_class = CAMEL_SASL_CLASS (klass);
+       sasl_class->auth_type = &sasl_xoauth2_outlook_auth_type;
+}
+
+static void
+camel_sasl_xoauth2_outlook_init (CamelSaslXOAuth2Outlook *sasl)
+{
+}
diff --git a/src/camel/camel-sasl-xoauth2-outlook.h b/src/camel/camel-sasl-xoauth2-outlook.h
new file mode 100644
index 0000000..6ab1949
--- /dev/null
+++ b/src/camel/camel-sasl-xoauth2-outlook.h
@@ -0,0 +1,63 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * This library is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This library 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 Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
+#error "Only <camel/camel.h> can be included directly."
+#endif
+
+#ifndef CAMEL_SASL_XOAUTH2_OUTLOOK_H
+#define CAMEL_SASL_XOAUTH2_OUTLOOK_H
+
+#include <camel/camel-sasl-xoauth2.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_SASL_XOAUTH2_OUTLOOK \
+       (camel_sasl_xoauth2_outlook_get_type ())
+#define CAMEL_SASL_XOAUTH2_OUTLOOK(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), CAMEL_TYPE_SASL_XOAUTH2_OUTLOOK, CamelSaslXOAuth2Outlook))
+#define CAMEL_SASL_XOAUTH2_OUTLOOK_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_CAST \
+       ((cls), CAMEL_TYPE_SASL_XOAUTH2_OUTLOOK, CamelSaslXOAuth2OutlookClass))
+#define CAMEL_IS_SASL_XOAUTH2_OUTLOOK(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), CAMEL_TYPE_SASL_XOAUTH2_OUTLOOK))
+#define CAMEL_IS_SASL_XOAUTH2_OUTLOOK_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_TYPE \
+       ((cls), CAMEL_TYPE_SASL_XOAUTH2_OUTLOOK))
+#define CAMEL_SASL_XOAUTH2_OUTLOOK_GET_CLASS(obj) \
+       (G_TYPE_INSTANCE_GET_CLASS \
+       ((obj), CAMEL_TYPE_SASL_XOAUTH2_OUTLOOK, CamelSaslXOAuth2OutlookClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelSaslXOAuth2Outlook CamelSaslXOAuth2Outlook;
+typedef struct _CamelSaslXOAuth2OutlookClass CamelSaslXOAuth2OutlookClass;
+typedef struct _CamelSaslXOAuth2OutlookPrivate CamelSaslXOAuth2OutlookPrivate;
+
+struct _CamelSaslXOAuth2Outlook {
+       CamelSaslXOAuth2 parent;
+       CamelSaslXOAuth2OutlookPrivate *priv;
+};
+
+struct _CamelSaslXOAuth2OutlookClass {
+       CamelSaslXOAuth2Class parent_class;
+};
+
+GType          camel_sasl_xoauth2_outlook_get_type     (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* CAMEL_SASL_XOAUTH2_OUTLOOK_H */
diff --git a/src/camel/camel-sasl.c b/src/camel/camel-sasl.c
index c59e4ae..6c0dd9b 100644
--- a/src/camel/camel-sasl.c
+++ b/src/camel/camel-sasl.c
@@ -33,6 +33,7 @@
 #include "camel-sasl-popb4smtp.h"
 #include "camel-sasl-xoauth2.h"
 #include "camel-sasl-xoauth2-google.h"
+#include "camel-sasl-xoauth2-outlook.h"
 #include "camel-sasl.h"
 #include "camel-service.h"
 
@@ -133,6 +134,7 @@ sasl_build_class_table (void)
        g_type_ensure (CAMEL_TYPE_SASL_POPB4SMTP);
        g_type_ensure (CAMEL_TYPE_SASL_XOAUTH2);
        g_type_ensure (CAMEL_TYPE_SASL_XOAUTH2_GOOGLE);
+       g_type_ensure (CAMEL_TYPE_SASL_XOAUTH2_OUTLOOK);
 
        class_table = g_hash_table_new_full (
                (GHashFunc) g_str_hash,
diff --git a/src/camel/camel.h b/src/camel/camel.h
index 758e766..7c44683 100644
--- a/src/camel/camel.h
+++ b/src/camel/camel.h
@@ -110,6 +110,7 @@
 #include <camel/camel-sasl-popb4smtp.h>
 #include <camel/camel-sasl-xoauth2.h>
 #include <camel/camel-sasl-xoauth2-google.h>
+#include <camel/camel-sasl-xoauth2-outlook.h>
 #include <camel/camel-service.h>
 #include <camel/camel-session.h>
 #include <camel/camel-settings.h>
diff --git a/src/libedataserver/CMakeLists.txt b/src/libedataserver/CMakeLists.txt
index a16c433..62f10f7 100644
--- a/src/libedataserver/CMakeLists.txt
+++ b/src/libedataserver/CMakeLists.txt
@@ -68,6 +68,7 @@ set(SOURCES
        e-oauth2-service.c
        e-oauth2-service-base.c
        e-oauth2-service-google.c
+       e-oauth2-service-outlook.c
        e-oauth2-services.c
        e-operation-pool.c
        e-proxy.c
@@ -156,6 +157,7 @@ set(HEADERS
        e-oauth2-service.h
        e-oauth2-service-base.h
        e-oauth2-service-google.h
+       e-oauth2-service-outlook.h
        e-oauth2-services.h
        e-operation-pool.h
        e-proxy.h
diff --git a/src/libedataserver/e-oauth2-service-outlook.c b/src/libedataserver/e-oauth2-service-outlook.c
new file mode 100644
index 0000000..765681a
--- /dev/null
+++ b/src/libedataserver/e-oauth2-service-outlook.c
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2018 Red Hat, Inc. (www.redhat.com)
+ *
+ * This library is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This library 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 Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "evolution-data-server-config.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "e-oauth2-service.h"
+#include "e-oauth2-service-base.h"
+
+#include "e-oauth2-service-outlook.h"
+
+/* https://apps.dev.microsoft.com/
+   https://msdn.microsoft.com/en-us/library/office/dn631845.aspx
+   https://www.limilabs.com/blog/oauth2-outlook-com-imap-installed-applications
+*/
+
+#define OUTLOOK_SCOPE "wl.offline_access wl.emails wl.imap"
+
+/* Forward Declarations */
+static void e_oauth2_service_outlook_oauth2_service_init (EOAuth2ServiceInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EOAuth2ServiceOutlook, e_oauth2_service_outlook, E_TYPE_OAUTH2_SERVICE_BASE,
+       G_IMPLEMENT_INTERFACE (E_TYPE_OAUTH2_SERVICE, e_oauth2_service_outlook_oauth2_service_init))
+
+static gboolean
+eos_outlook_guess_can_process (EOAuth2Service *service,
+                              const gchar *protocol,
+                              const gchar *hostname)
+{
+       return hostname && e_util_utf8_strstrcase (hostname, ".outlook.com");
+}
+
+static const gchar *
+eos_outlook_get_name (EOAuth2Service *service)
+{
+       return "Outlook";
+}
+
+static const gchar *
+eos_outlook_get_display_name (EOAuth2Service *service)
+{
+       /* Translators: This is a user-visible string, display name of an OAuth2 service. */
+       return C_("OAuth2Service", "Outlook");
+}
+
+static const gchar *
+eos_outlook_get_client_id (EOAuth2Service *service)
+{
+       return OUTLOOK_CLIENT_ID;
+}
+
+static const gchar *
+eos_outlook_get_client_secret (EOAuth2Service *service)
+{
+       const gchar *secret = OUTLOOK_CLIENT_SECRET;
+
+       if (secret && !*secret)
+               return NULL;
+
+       return secret;
+}
+
+static const gchar *
+eos_outlook_get_authentication_uri (EOAuth2Service *service)
+{
+       return "https://login.live.com/oauth20_authorize.srf";;
+}
+
+static const gchar *
+eos_outlook_get_refresh_uri (EOAuth2Service *service)
+{
+       return "https://login.live.com/oauth20_token.srf";;
+}
+
+static const gchar *
+eos_outlook_get_redirect_uri (EOAuth2Service *service)
+{
+       return "https://login.live.com/oauth20_desktop.srf";;
+}
+
+static void
+eos_outlook_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_mode", "query");
+       e_oauth2_service_util_set_to_form (uri_query, "scope", OUTLOOK_SCOPE);
+}
+
+static gboolean
+eos_outlook_extract_authorization_code (EOAuth2Service *service,
+                                       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;
+                       }
+
+                       g_hash_table_unref (uri_query);
+               }
+       }
+
+       soup_uri_free (suri);
+
+       return known;
+}
+
+static void
+eos_outlook_prepare_refresh_token_form (EOAuth2Service *service,
+                                       const gchar *refresh_token,
+                                       GHashTable *form)
+{
+       g_return_if_fail (form != NULL);
+
+       e_oauth2_service_util_set_to_form (form, "scope", OUTLOOK_SCOPE);
+       e_oauth2_service_util_set_to_form (form, "redirect_uri", e_oauth2_service_get_redirect_uri (service));
+}
+
+static void
+e_oauth2_service_outlook_oauth2_service_init (EOAuth2ServiceInterface *iface)
+{
+       iface->guess_can_process = eos_outlook_guess_can_process;
+       iface->get_name = eos_outlook_get_name;
+       iface->get_display_name = eos_outlook_get_display_name;
+       iface->get_client_id = eos_outlook_get_client_id;
+       iface->get_client_secret = eos_outlook_get_client_secret;
+       iface->get_authentication_uri = eos_outlook_get_authentication_uri;
+       iface->get_refresh_uri = eos_outlook_get_refresh_uri;
+       iface->get_redirect_uri = eos_outlook_get_redirect_uri;
+       iface->prepare_authentication_uri_query = eos_outlook_prepare_authentication_uri_query;
+       iface->extract_authorization_code = eos_outlook_extract_authorization_code;
+       iface->prepare_refresh_token_form = eos_outlook_prepare_refresh_token_form;
+}
+
+static void
+e_oauth2_service_outlook_class_init (EOAuth2ServiceOutlookClass *klass)
+{
+}
+
+static void
+e_oauth2_service_outlook_init (EOAuth2ServiceOutlook *oauth2_outlook)
+{
+}
diff --git a/src/libedataserver/e-oauth2-service-outlook.h b/src/libedataserver/e-oauth2-service-outlook.h
new file mode 100644
index 0000000..8ac8d97
--- /dev/null
+++ b/src/libedataserver/e-oauth2-service-outlook.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2018 Red Hat, Inc. (www.redhat.com)
+ *
+ * This library is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This library 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 Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__LIBEDATASERVER_H_INSIDE__) && !defined (LIBEDATASERVER_COMPILATION)
+#error "Only <libedataserver/libedataserver.h> should be included directly."
+#endif
+
+#ifndef E_OAUTH2_SERVICE_OUTLOOK_H
+#define E_OAUTH2_SERVICE_OUTLOOK_H
+
+#include <libedataserver/e-oauth2-service-base.h>
+
+/* Standard GObject macros */
+#define E_TYPE_OAUTH2_SERVICE_OUTLOOK \
+       (e_oauth2_service_outlook_get_type ())
+#define E_OAUTH2_SERVICE_OUTLOOK(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), E_TYPE_OAUTH2_SERVICE_OUTLOOK, EOAuth2ServiceOutlook))
+#define E_OAUTH2_SERVICE_OUTLOOK_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_CAST \
+       ((cls), E_TYPE_OAUTH2_SERVICE_OUTLOOK, EOAuth2ServiceOutlookClass))
+#define E_IS_OAUTH2_SERVICE_OUTLOOK(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), E_TYPE_OAUTH2_SERVICE_OUTLOOK))
+#define E_IS_OAUTH2_SERVICE_OUTLOOK_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_TYPE \
+       ((cls), E_TYPE_OAUTH2_SERVICE_OUTLOOK))
+#define E_OAUTH2_SERVICE_OUTLOOK_GET_CLASS(obj) \
+       (G_TYPE_INSTANCE_GET_CLASS \
+       ((obj), E_TYPE_OAUTH2_SERVICE_OUTLOOK, EOAuth2ServiceOutlookClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EOAuth2ServiceOutlook EOAuth2ServiceOutlook;
+typedef struct _EOAuth2ServiceOutlookClass EOAuth2ServiceOutlookClass;
+
+struct _EOAuth2ServiceOutlook {
+       EOAuth2ServiceBase parent;
+};
+
+struct _EOAuth2ServiceOutlookClass {
+       EOAuth2ServiceBaseClass parent_class;
+};
+
+GType          e_oauth2_service_outlook_get_type       (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* E_OAUTH2_SERVICE_OUTLOOK_H */
diff --git a/src/libedataserver/e-oauth2-services.c b/src/libedataserver/e-oauth2-services.c
index 48df4a2..678a3ba 100644
--- a/src/libedataserver/e-oauth2-services.c
+++ b/src/libedataserver/e-oauth2-services.c
@@ -36,6 +36,7 @@
 
 /* Known built-in implementations */
 #include "e-oauth2-service-google.h"
+#include "e-oauth2-service-outlook.h"
 
 #include "e-oauth2-services.h"
 
@@ -135,6 +136,7 @@ e_oauth2_services_class_init (EOAuth2ServicesClass *klass)
 
        /* Ensure built-in service types are registered */
        g_type_ensure (E_TYPE_OAUTH2_SERVICE_GOOGLE);
+       g_type_ensure (E_TYPE_OAUTH2_SERVICE_OUTLOOK);
 }
 
 static void
diff --git a/src/libedataserver/libedataserver.h b/src/libedataserver/libedataserver.h
index 062c345..3f0b492 100644
--- a/src/libedataserver/libedataserver.h
+++ b/src/libedataserver/libedataserver.h
@@ -42,6 +42,7 @@
 #include <libedataserver/e-oauth2-service.h>
 #include <libedataserver/e-oauth2-service-base.h>
 #include <libedataserver/e-oauth2-service-google.h>
+#include <libedataserver/e-oauth2-service-outlook.h>
 #include <libedataserver/e-oauth2-services.h>
 #include <libedataserver/e-operation-pool.h>
 #include <libedataserver/e-proxy.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]