[evolution-kolab/experimental: 6/6] KolabMailAccess: Remove ESourceAuthenticator interface.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/experimental: 6/6] KolabMailAccess: Remove ESourceAuthenticator interface.
- Date: Fri, 31 Aug 2012 14:50:43 +0000 (UTC)
commit 3e673b831952ae345f906481d6dc4d0ababf470b
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Aug 31 10:11:47 2012 -0400
KolabMailAccess: Remove ESourceAuthenticator interface.
CamelIMAPXServer already knows how to verify passwords (by logging
into the IMAP server), so we can just rely on that and remove the
try_password() stub from KolabMailAccess.
src/addressbook/e-book-backend-kolab.c | 39 ----------------
src/calendar/e-cal-backend-kolab.c | 39 ----------------
src/libekolab/kolab-mail-access.c | 75 +-------------------------------
3 files changed, 1 insertions(+), 152 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-kolab.c b/src/addressbook/e-book-backend-kolab.c
index a333dc8..6043487 100644
--- a/src/addressbook/e-book-backend-kolab.c
+++ b/src/addressbook/e-book-backend-kolab.c
@@ -237,7 +237,6 @@ book_backend_kolab_open (EBookBackendSync *backend,
{
EBookBackendKolab *self = NULL;
EBookBackendKolabPrivate *priv = NULL;
- ESourceRegistry *registry = NULL;
ESource *esource = NULL;
ESourceKolabFolder *extension = NULL;
CamelKolabIMAPXSettings *kolab_settings = NULL;
@@ -252,7 +251,6 @@ book_backend_kolab_open (EBookBackendSync *backend,
gchar *user_at_server = NULL;
gchar *tmp_key = NULL;
gboolean online = FALSE;
- gboolean auth_required = FALSE;
gboolean ok = FALSE;
GError *tmp_err = NULL;
@@ -267,8 +265,6 @@ book_backend_kolab_open (EBookBackendSync *backend,
g_mutex_lock (&koma_objects_lock);
- registry = e_book_backend_get_registry (E_BOOK_BACKEND (backend));
-
esource = e_backend_get_source (E_BACKEND (backend));
if (! E_IS_SOURCE (esource)) {
tmp_err = e_data_book_create_error (E_DATA_BOOK_STATUS_OTHER_ERROR,
@@ -300,8 +296,6 @@ book_backend_kolab_open (EBookBackendSync *backend,
(gpointer *) &tmp_koma);
if (ok) {
- gchar *passwd = NULL;
-
/* There already is a KoMA instance for user_at_server.
* Use it and return
*/
@@ -313,18 +307,6 @@ book_backend_kolab_open (EBookBackendSync *backend,
NULL,
foldername,
&sync_value);
- /* We may find that we do not yet have a password set.
- * In case we're requested to go online, we will need
- * one, so we need to get authentication data first.
- */
- passwd = g_strdup (kolab_settings_handler_get_char_field (ksettings,
- KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_PASSWORD,
- NULL));
- if (passwd == NULL) {
- auth_required = TRUE;
- goto exit;
- }
- g_free (passwd);
(void) kolab_util_backend_deploy_mode_by_backend (priv->book_koma,
online,
@@ -388,15 +370,6 @@ book_backend_kolab_open (EBookBackendSync *backend,
if (! ok)
goto exit;
- /* If we are here (just created a fresh KolabMailAccess),
- * we did not yet receive authentication data. Though we
- * do not need it if we want to stay in offline mode, once
- * we're asked to go online, we'll need the credentials
- * (password in our case) anyway, so we can just request
- * it once the book gets opened.
- */
- auth_required = TRUE;
-
exit:
if (ksettings != NULL)
@@ -418,18 +391,6 @@ book_backend_kolab_open (EBookBackendSync *backend,
return;
}
- /* authenticate now if required */
- if (auth_required) {
- ESourceAuthenticator *authenticator;
-
- authenticator = E_SOURCE_AUTHENTICATOR (priv->book_koma);
-
- ok = e_source_registry_authenticate_sync (
- registry, esource, authenticator, cancellable, error);
- if (!ok)
- return;
- }
-
/* all good, notify that we're open for business */
ok = book_backend_kolab_notify_opened (self, &tmp_err);
if (! ok) {
diff --git a/src/calendar/e-cal-backend-kolab.c b/src/calendar/e-cal-backend-kolab.c
index 9b3109b..0bc65bd 100644
--- a/src/calendar/e-cal-backend-kolab.c
+++ b/src/calendar/e-cal-backend-kolab.c
@@ -261,7 +261,6 @@ cal_backend_kolab_open (ECalBackendSync *backend,
{
ECalBackendKolab *self = NULL;
ECalBackendKolabPrivate *priv = NULL;
- ESourceRegistry *registry = NULL;
ESource *esource = NULL;
ESourceKolabFolder *extension = NULL;
CamelKolabIMAPXSettings *kolab_settings = NULL;
@@ -279,7 +278,6 @@ cal_backend_kolab_open (ECalBackendSync *backend,
gchar *user_at_server = NULL;
gchar *tmp_key = NULL;
gboolean online = FALSE;
- gboolean auth_required = FALSE;
gboolean ok = FALSE;
GError *tmp_err = NULL;
@@ -294,8 +292,6 @@ cal_backend_kolab_open (ECalBackendSync *backend,
g_mutex_lock (&koma_objects_lock);
- registry = e_cal_backend_get_registry (E_CAL_BACKEND (backend));
-
icalkind = e_cal_backend_get_kind (E_CAL_BACKEND (backend));
/* TODO: this has to be set according to the get_kind() method */
switch (icalkind) {
@@ -360,8 +356,6 @@ cal_backend_kolab_open (ECalBackendSync *backend,
(gpointer *) &tmp_koma);
if (ok) {
- gchar *passwd = NULL;
-
/* There already is a KoMA instance for user_at_server.
* Use it and return
*/
@@ -373,18 +367,6 @@ cal_backend_kolab_open (ECalBackendSync *backend,
NULL,
foldername,
&sync_value);
- /* We may find that we do not yet have a password set.
- * In case we're requested to go online, we will need
- * one, so we need to get authentication data first.
- */
- passwd = g_strdup (kolab_settings_handler_get_char_field (ksettings,
- KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_PASSWORD,
- NULL));
- if (passwd == NULL) {
- auth_required = TRUE;
- goto exit;
- }
- g_free (passwd);
(void) kolab_util_backend_deploy_mode_by_backend (priv->cal_koma,
online,
@@ -454,15 +436,6 @@ cal_backend_kolab_open (ECalBackendSync *backend,
*/
priv->user_email = g_strdup (user_at_server);
- /* If we are here (just created a fresh KolabMailAccess),
- * we did not yet receive authentication data. Though we
- * do not need it if we want to stay in offline mode, once
- * we're asked to go online, we'll need the credentials
- * (password in our case) anyway, so we can just request
- * it once the book gets opened.
- */
- auth_required = TRUE;
-
exit:
if (ksettings != NULL)
@@ -484,18 +457,6 @@ cal_backend_kolab_open (ECalBackendSync *backend,
return;
}
- /* authenticate now if required */
- if (auth_required) {
- ESourceAuthenticator *authenticator;
-
- authenticator = E_SOURCE_AUTHENTICATOR (priv->cal_koma);
-
- ok = e_source_registry_authenticate_sync (
- registry, esource, authenticator, cancellable, error);
- if (!ok)
- return;
- }
-
/* all good, notify that we're open for business */
ok = cal_backend_kolab_notify_opened (self, &tmp_err);
if (! ok) {
diff --git a/src/libekolab/kolab-mail-access.c b/src/libekolab/kolab-mail-access.c
index 64e2651..fa86a74 100644
--- a/src/libekolab/kolab-mail-access.c
+++ b/src/libekolab/kolab-mail-access.c
@@ -70,15 +70,7 @@ struct _KolabMailAccessPrivate
#define KOLAB_MAIL_ACCESS_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), KOLAB_TYPE_MAIL_ACCESS, KolabMailAccessPrivate))
-/* forward declarations */
-static void
-kolab_mail_access_authenticator_init (ESourceAuthenticatorInterface *interface);
-
-G_DEFINE_TYPE_WITH_CODE (
- KolabMailAccess, kolab_mail_access, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (
- E_TYPE_SOURCE_AUTHENTICATOR,
- kolab_mail_access_authenticator_init))
+G_DEFINE_TYPE (KolabMailAccess, kolab_mail_access, G_TYPE_OBJECT)
/*----------------------------------------------------------------------------*/
/* object state transition */
@@ -103,71 +95,6 @@ mail_access_state_free (KolabMailAccessState *state)
}
/*----------------------------------------------------------------------------*/
-/* authentication attempts */
-
-static ESourceAuthenticationResult
-mail_access_try_password_sync (ESourceAuthenticator *authenticator,
- const GString *password,
- GCancellable *cancellable,
- GError **error)
-{
- KolabMailAccessPrivate *priv;
- ESourceAuthenticationResult result;
- gboolean success;
-
- /* FIXME This needs to test the provided password and return:
- *
- * E_SOURCE_AUTHENTICATION_ACCEPTED if the password is valid.
- * Returning this will cause the in-progress call to
- * e_source_registry_authenticate_sync() to return TRUE.
- *
- * E_SOURCE_AUTHENTICATION_REJECTED if the password is invalid.
- * Returning this will (re)prompt the user for a password. The
- * in-progress call to e_source_registry_authenticate_sync()
- * will remain in-progress.
- *
- * E_SOURCE_AUTHENTICATION_ERROR if communication with the
- * server fails or if the server itself reports an error.
- * Be sure to set the GError! Returning this will cause the
- * in-progress call to e_source_registry_authenticate_sync()
- * to return FALSE and relay the GError back to the caller.
- *
- * For IMAP, should be able to test the password by simply
- * connecting and authenticating to the server. For now,
- * we blindly accept whatever password we're given and let
- * it fail later if the password is invalid.
- *
- * This is broken behavior.
- */
-
- priv = KOLAB_MAIL_ACCESS_PRIVATE (authenticator);
-
- if (priv->ksettings != NULL)
- kolab_settings_handler_set_char_field (
- priv->ksettings,
- KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_PASSWORD,
- g_strdup (password->str), NULL);
-
- success = kolab_mail_access_set_opmode (
- KOLAB_MAIL_ACCESS (authenticator),
- KOLAB_MAIL_ACCESS_OPMODE_ONLINE,
- cancellable, error);
-
- if (success)
- result = E_SOURCE_AUTHENTICATION_ACCEPTED;
- else
- result = E_SOURCE_AUTHENTICATION_ERROR;
-
- return result;
-}
-
-static void
-kolab_mail_access_authenticator_init (ESourceAuthenticatorInterface *interface)
-{
- interface->try_password_sync = mail_access_try_password_sync;
-}
-
-/*----------------------------------------------------------------------------*/
/* object/class init */
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]