[evolution-kolab] KolabMailImapClient: added API for retrieving password



commit 3b262640163feb289e0b298a262c88709b239381
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Tue Sep 11 17:33:19 2012 +0200

    KolabMailImapClient: added API for retrieving password
    
    * added function to retrieve the password used for
      IMAP authentication from the CamelService we own
      (CamelKolabIMAPXStore)

 src/libekolab/kolab-mail-imap-client.c |   27 +++++++++++++++++++++++++++
 src/libekolab/kolab-mail-imap-client.h |    3 +++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/libekolab/kolab-mail-imap-client.c b/src/libekolab/kolab-mail-imap-client.c
index 880ff8b..6564e63 100644
--- a/src/libekolab/kolab-mail-imap-client.c
+++ b/src/libekolab/kolab-mail-imap-client.c
@@ -1392,6 +1392,33 @@ kolab_mail_imap_client_go_offline (KolabMailImapClient *self,
 }
 
 /*----------------------------------------------------------------------------*/
+/* password handling */
+
+const gchar*
+kolab_mail_imap_client_get_password (KolabMailImapClient *self)
+{
+	KolabMailImapClientPrivate *priv = NULL;
+	const gchar *passwd = NULL;
+	
+	g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
+
+	priv = KOLAB_MAIL_IMAP_CLIENT_PRIVATE (self);
+
+	/* If we successfully authenticated before, our CamelService
+	 * will know the password which was used for authentication.
+	 * When starting in offline mode, no password may be known,
+	 * so we may return NULL here. We need the password outside
+	 * Camel for the (X)FB triggers only, which are not sent unless
+	 * we went online, so no trouble to be expected here.
+	 */
+	
+	g_return_val_if_fail (priv->store != NULL, NULL);
+	passwd = camel_service_get_password (CAMEL_SERVICE (priv->store));
+
+	return passwd;
+}
+
+/*----------------------------------------------------------------------------*/
 /* folders */
 
 GList*
diff --git a/src/libekolab/kolab-mail-imap-client.h b/src/libekolab/kolab-mail-imap-client.h
index 2e781da..9826cf3 100644
--- a/src/libekolab/kolab-mail-imap-client.h
+++ b/src/libekolab/kolab-mail-imap-client.h
@@ -131,6 +131,9 @@ kolab_mail_imap_client_go_offline (KolabMailImapClient *self,
                                    GCancellable *cancellable,
                                    GError **err);
 
+const gchar*
+kolab_mail_imap_client_get_password (KolabMailImapClient *self);
+
 GList*
 kolab_mail_imap_client_query_foldernames (KolabMailImapClient *self,
                                           GCancellable *cancellable,



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