[evolution-data-server/account-mgmt] online-accounts: Consolidate OAuth configuration.



commit b0efefbdfc956414830615962031a9485db72d38
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed May 30 07:44:03 2012 -0400

    online-accounts: Consolidate OAuth configuration.

 modules/online-accounts/module-online-accounts.c |   43 +++++++++++-----------
 1 files changed, 21 insertions(+), 22 deletions(-)
---
diff --git a/modules/online-accounts/module-online-accounts.c b/modules/online-accounts/module-online-accounts.c
index 9c0100f..fc165e8 100644
--- a/modules/online-accounts/module-online-accounts.c
+++ b/modules/online-accounts/module-online-accounts.c
@@ -179,7 +179,6 @@ online_accounts_new_source (EOnlineAccounts *extension)
 	return source;
 }
 
-/* Helper for online_accounts_config_collection() */
 static void
 online_accounts_config_exchange (EOnlineAccounts *extension,
                                  ESource *source,
@@ -240,7 +239,25 @@ online_accounts_config_exchange (EOnlineAccounts *extension,
 #endif /* HAVE_GOA_PASSWORD_BASED */
 }
 
-/* Helper for online_accounts_config_collection() */
+static void
+online_accounts_config_oauth (EOnlineAccounts *extension,
+                              ESource *source,
+                              GoaObject *goa_object)
+{
+	ESourceExtension *source_extension;
+	const gchar *extension_name;
+
+	if (goa_object_peek_oauth_based (goa_object) == NULL)
+		return;
+
+	extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
+	source_extension = e_source_get_extension (source, extension_name);
+
+	e_source_authentication_set_method (
+		E_SOURCE_AUTHENTICATION (source_extension),
+		CAMEL_OAUTH_MECHANISM_NAME);
+}
+
 static void
 online_accounts_config_password (EOnlineAccounts *extension,
                                  ESource *source,
@@ -404,16 +421,7 @@ online_accounts_config_mail_account (EOnlineAccounts *extension,
                                      ESource *source,
                                      GoaObject *goa_object)
 {
-	ESourceExtension *source_extension;
-	const gchar *extension_name;
-
-	extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
-	source_extension = e_source_get_extension (source, extension_name);
-
-	if (goa_object_peek_oauth_based (goa_object) != NULL)
-		e_source_authentication_set_method (
-			E_SOURCE_AUTHENTICATION (source_extension),
-			CAMEL_OAUTH_MECHANISM_NAME);
+	online_accounts_config_oauth (extension, source, goa_object);
 
 	/* XXX Need to defer the network security settings to the
 	 *     provider-specific module since "imap-use-tls" tells
@@ -449,16 +457,7 @@ online_accounts_config_mail_transport (EOnlineAccounts *extension,
                                        ESource *source,
                                        GoaObject *goa_object)
 {
-	ESourceExtension *source_extension;
-	const gchar *extension_name;
-
-	extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
-	source_extension = e_source_get_extension (source, extension_name);
-
-	if (goa_object_peek_oauth_based (goa_object) != NULL)
-		e_source_authentication_set_method (
-			E_SOURCE_AUTHENTICATION (source_extension),
-			CAMEL_OAUTH_MECHANISM_NAME);
+	online_accounts_config_oauth (extension, source, goa_object);
 
 	/* XXX Need to defer the network security settings to the
 	 *     provider-specific module since "smtp-use-tls" tells



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