[evolution-data-server] CamelService: Add "password" property.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] CamelService: Add "password" property.
- Date: Mon, 26 Sep 2011 13:45:34 +0000 (UTC)
commit 20ab2930ea6cd22e2f8be0f8426ceee5c2783b9c
Author: Matthew Barnes <mbarnes redhat com>
Date: Sun Sep 25 15:40:05 2011 -0400
CamelService: Add "password" property.
This is meant to be an alternative to caching passwords in CamelURLs.
camel/camel-service.c | 69 ++++++++++++++++++++++++++
camel/camel-service.h | 3 +
docs/reference/camel/camel-sections.txt | 3 +-
docs/reference/camel/tmpl/camel-service.sgml | 23 +++++++++
4 files changed, 97 insertions(+), 1 deletions(-)
---
diff --git a/camel/camel-service.c b/camel/camel-service.c
index a366ee9..01f501f 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -60,6 +60,7 @@ struct _CamelServicePrivate {
gchar *user_data_dir;
gchar *user_cache_dir;
gchar *uid;
+ gchar *password;
GCancellable *connect_op;
CamelServiceConnectionStatus status;
@@ -75,6 +76,7 @@ struct _AsyncContext {
enum {
PROP_0,
PROP_DISPLAY_NAME,
+ PROP_PASSWORD,
PROP_PROVIDER,
PROP_SESSION,
PROP_SETTINGS,
@@ -236,6 +238,12 @@ service_set_property (GObject *object,
g_value_get_string (value));
return;
+ case PROP_PASSWORD:
+ camel_service_set_password (
+ CAMEL_SERVICE (object),
+ g_value_get_string (value));
+ return;
+
case PROP_PROVIDER:
service_set_provider (
CAMEL_SERVICE (object),
@@ -283,6 +291,12 @@ service_get_property (GObject *object,
CAMEL_SERVICE (object)));
return;
+ case PROP_PASSWORD:
+ g_value_set_string (
+ value, camel_service_get_password (
+ CAMEL_SERVICE (object)));
+ return;
+
case PROP_PROVIDER:
g_value_set_pointer (
value, camel_service_get_provider (
@@ -357,6 +371,7 @@ service_finalize (GObject *object)
g_free (priv->user_data_dir);
g_free (priv->user_cache_dir);
g_free (priv->uid);
+ g_free (priv->password);
g_static_rec_mutex_free (&priv->connect_lock);
g_static_mutex_free (&priv->connect_op_lock);
@@ -609,6 +624,18 @@ camel_service_class_init (CamelServiceClass *class)
g_object_class_install_property (
object_class,
+ PROP_PASSWORD,
+ g_param_spec_string (
+ "password",
+ "Password",
+ "The password for the service",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
PROP_PROVIDER,
g_param_spec_pointer (
"provider",
@@ -774,6 +801,48 @@ camel_service_set_display_name (CamelService *service,
}
/**
+ * camel_service_get_password:
+ * @service: a #CamelService
+ *
+ * Returns the password for @service. Some SASL mechanisms use this
+ * when attempting to authenticate.
+ *
+ * Returns: the password for @service
+ *
+ * Since: 3.4
+ **/
+const gchar *
+camel_service_get_password (CamelService *service)
+{
+ g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
+
+ return service->priv->password;
+}
+
+/**
+ * camel_service_set_password:
+ * @service: a #CamelService
+ * @password: the password for @service
+ *
+ * Sets the password for @service. Use this function to cache the password
+ * in memory after obtaining it through camel_session_get_password(). Some
+ * SASL mechanisms use this when attempting to authenticate.
+ *
+ * Since: 3.4
+ **/
+void
+camel_service_set_password (CamelService *service,
+ const gchar *password)
+{
+ g_return_if_fail (CAMEL_IS_SERVICE (service));
+
+ g_free (service->priv->password);
+ service->priv->password = g_strdup (password);
+
+ g_object_notify (G_OBJECT (service), "password");
+}
+
+/**
* camel_service_get_user_data_dir:
* @service: a #CamelService
*
diff --git a/camel/camel-service.h b/camel/camel-service.h
index 0784dde..c072998 100644
--- a/camel/camel-service.h
+++ b/camel/camel-service.h
@@ -148,6 +148,9 @@ GQuark camel_service_error_quark (void) G_GNUC_CONST;
const gchar * camel_service_get_display_name (CamelService *service);
void camel_service_set_display_name (CamelService *service,
const gchar *display_name);
+const gchar * camel_service_get_password (CamelService *service);
+void camel_service_set_password (CamelService *service,
+ const gchar *password);
const gchar * camel_service_get_user_data_dir (CamelService *service);
const gchar * camel_service_get_user_cache_dir
(CamelService *service);
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 14d69f3..a2b9899 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -1954,6 +1954,8 @@ CamelServiceConnectionStatus
CamelServiceAuthType
camel_service_get_display_name
camel_service_set_display_name
+camel_service_get_password
+camel_service_set_password
camel_service_get_user_data_dir
camel_service_get_name
camel_service_get_provider
@@ -2184,7 +2186,6 @@ CAMEL_STORE_INFO_FOLDER_UNKNOWN
CamelStoreSummaryFlags
camel_store_summary_new
camel_store_summary_set_filename
-camel_store_summary_set_uri_base
camel_store_summary_load
camel_store_summary_save
camel_store_summary_header_load
diff --git a/docs/reference/camel/tmpl/camel-service.sgml b/docs/reference/camel/tmpl/camel-service.sgml
index db5c5c7..f9d6c93 100644
--- a/docs/reference/camel/tmpl/camel-service.sgml
+++ b/docs/reference/camel/tmpl/camel-service.sgml
@@ -31,6 +31,11 @@ CamelService
</para>
+<!-- ##### ARG CamelService:password ##### -->
+<para>
+
+</para>
+
<!-- ##### ARG CamelService:provider ##### -->
<para>
@@ -112,6 +117,24 @@ CamelService
@display_name:
+<!-- ##### FUNCTION camel_service_get_password ##### -->
+<para>
+
+</para>
+
+ service:
+ Returns:
+
+
+<!-- ##### FUNCTION camel_service_set_password ##### -->
+<para>
+
+</para>
+
+ service:
+ password:
+
+
<!-- ##### FUNCTION camel_service_get_user_data_dir ##### -->
<para>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]