[evolution-kolab/account-mgmt] KolabMailAccess: Implement ESourceAuthenticator.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/account-mgmt] KolabMailAccess: Implement ESourceAuthenticator.
- Date: Fri, 29 Jun 2012 14:20:14 +0000 (UTC)
commit ce25dfae2e857c55f9f24057f018f00ecd0832d2
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Jun 29 10:18:49 2012 -0400
KolabMailAccess: Implement ESourceAuthenticator.
KolabMailAccess will be the ESourceAuthenticator passed to
e_source_registry_authenticate_sync(). Although the try_password_sync()
implementation is merely a placeholder for now. That's Christian's job
to fix. :)
src/libekolab/kolab-mail-access.c | 51 ++++++++++++++++++++++++++++++++++++-
1 files changed, 50 insertions(+), 1 deletions(-)
---
diff --git a/src/libekolab/kolab-mail-access.c b/src/libekolab/kolab-mail-access.c
index b74405d..9cc2a04 100644
--- a/src/libekolab/kolab-mail-access.c
+++ b/src/libekolab/kolab-mail-access.c
@@ -70,7 +70,15 @@ struct _KolabMailAccessPrivate
#define KOLAB_MAIL_ACCESS_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), KOLAB_TYPE_MAIL_ACCESS, KolabMailAccessPrivate))
-G_DEFINE_TYPE (KolabMailAccess, kolab_mail_access, G_TYPE_OBJECT)
+/* 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))
/*----------------------------------------------------------------------------*/
/* object state transition */
@@ -95,6 +103,47 @@ kolab_mail_access_state_free (KolabMailAccessState *state)
}
/*----------------------------------------------------------------------------*/
+/* authentication attempts */
+
+static ESourceAuthenticationResult
+kolab_mail_access_try_password_sync (ESourceAuthenticator *authenticator,
+ const GString *password,
+ GCancellable *cancellable,
+ GError **error)
+{
+ /* 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.
+ *
+ * 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.
+ */
+
+ return E_SOURCE_AUTHENTICATION_ACCEPTED;
+}
+
+static void
+kolab_mail_access_authenticator_init (ESourceAuthenticatorInterface *interface)
+{
+ interface->try_password_sync = kolab_mail_access_try_password_sync;
+}
+
+/*----------------------------------------------------------------------------*/
/* object/class init */
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]