[evolution-data-server/meego-eds: 47/47] Add API to fetch password from session.
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/meego-eds: 47/47] Add API to fetch password from session.
- Date: Wed, 15 Jun 2011 10:57:14 +0000 (UTC)
commit ac665cacdead7bc29ad82adb2cdf775d18047db9
Author: Srinivasa Ragavan <srini linux intel com>
Date: Wed Jun 15 04:37:57 2011 +0300
Add API to fetch password from session.
mail/daemon/e-mail-data-session.c | 17 ++++
mail/daemon/e-mail-data-session.xml | 4 +
mail/libegdbus/e-gdbus-emailsession.c | 134 +++++++++++++++++++++++++++++++++
mail/libegdbus/e-gdbus-emailsession.h | 30 +++++++
4 files changed, 185 insertions(+), 0 deletions(-)
---
diff --git a/mail/daemon/e-mail-data-session.c b/mail/daemon/e-mail-data-session.c
index 00913d8..847b76c 100644
--- a/mail/daemon/e-mail-data-session.c
+++ b/mail/daemon/e-mail-data-session.c
@@ -338,6 +338,22 @@ impl_Mail_getFolderFromUri (EGdbusSessionCS *object, GDBusMethodInvocation *invo
}
static gboolean
+impl_Mail_findPassword (EGdbusSessionCS *object, GDBusMethodInvocation *invocation, const char *key, EMailDataSession *msession)
+{
+ EMailDataSessionPrivate *priv = DATA_SESSION_PRIVATE(msession);
+ char *password;
+
+ ipc(printf("Finding Password for: %s\n", key));
+ password = e_passwords_get_password ("Mail", key);
+
+ egdbus_session_cs_complete_find_password (object, invocation, password);
+ g_free (password);
+
+ return TRUE;
+}
+
+
+static gboolean
impl_Mail_addPassword (EGdbusSessionCS *object, GDBusMethodInvocation *invocation, const char *key, const char *password, gboolean remember, EMailDataSession *msession)
{
EMailDataSessionPrivate *priv = DATA_SESSION_PRIVATE(msession);
@@ -499,6 +515,7 @@ e_mail_data_session_init (EMailDataSession *self)
g_signal_connect (priv->gdbus_object, "handle-get-local-folder", G_CALLBACK (impl_Mail_getLocalFolder), self);
g_signal_connect (priv->gdbus_object, "handle-get-folder-from-uri", G_CALLBACK (impl_Mail_getFolderFromUri), self);
g_signal_connect (priv->gdbus_object, "handle-add-password", G_CALLBACK (impl_Mail_addPassword), self);
+ g_signal_connect (priv->gdbus_object, "handle-find-password", G_CALLBACK (impl_Mail_findPassword), self);
g_signal_connect (priv->gdbus_object, "handle-send-receive", G_CALLBACK (impl_Mail_sendReceive), self);
g_signal_connect (priv->gdbus_object, "handle-fetch-account", G_CALLBACK (impl_Mail_fetchAccount), self);
g_signal_connect (priv->gdbus_object, "handle-fetch-old-messages", G_CALLBACK (impl_Mail_fetchOldMessages), self);
diff --git a/mail/daemon/e-mail-data-session.xml b/mail/daemon/e-mail-data-session.xml
index 731fe7e..476ca05 100644
--- a/mail/daemon/e-mail-data-session.xml
+++ b/mail/daemon/e-mail-data-session.xml
@@ -27,6 +27,10 @@
<arg name="password" type="s" direction="in"/>
<arg name="remember" type="b" direction="in"/>
</method>
+ <method name="findPassword">
+ <arg name="key" type="s" direction="in"/>
+ <arg name="password" type="s" direction="out"/>
+ </method>
<!--
FolderType should be a string "inbox" "draft" "outbox" "sent" "templates"
diff --git a/mail/libegdbus/e-gdbus-emailsession.c b/mail/libegdbus/e-gdbus-emailsession.c
index f08755f..7af0eb5 100644
--- a/mail/libegdbus/e-gdbus-emailsession.c
+++ b/mail/libegdbus/e-gdbus-emailsession.c
@@ -458,6 +458,52 @@ static const _ExtendedGDBusMethodInfo _egdbus_session_cs_method_info_add_passwor
"handle-add-password"
};
+static const _ExtendedGDBusArgInfo _egdbus_session_cs_method_info_find_password_IN_ARG_key =
+{
+ {
+ -1,
+ "key",
+ "s",
+ NULL
+ },
+ FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _egdbus_session_cs_method_info_find_password_IN_ARG_pointers[] =
+{
+ &_egdbus_session_cs_method_info_find_password_IN_ARG_key,
+ NULL
+};
+
+static const _ExtendedGDBusArgInfo _egdbus_session_cs_method_info_find_password_OUT_ARG_password =
+{
+ {
+ -1,
+ "password",
+ "s",
+ NULL
+ },
+ FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _egdbus_session_cs_method_info_find_password_OUT_ARG_pointers[] =
+{
+ &_egdbus_session_cs_method_info_find_password_OUT_ARG_password,
+ NULL
+};
+
+static const _ExtendedGDBusMethodInfo _egdbus_session_cs_method_info_find_password =
+{
+ {
+ -1,
+ "findPassword",
+ (GDBusArgInfo **) &_egdbus_session_cs_method_info_find_password_IN_ARG_pointers,
+ (GDBusArgInfo **) &_egdbus_session_cs_method_info_find_password_OUT_ARG_pointers,
+ NULL
+ },
+ "handle-find-password"
+};
+
static const _ExtendedGDBusArgInfo _egdbus_session_cs_method_info_get_local_folder_IN_ARG_type =
{
{
@@ -666,6 +712,7 @@ static const _ExtendedGDBusMethodInfo * const _egdbus_session_cs_method_info_poi
&_egdbus_session_cs_method_info_get_store,
&_egdbus_session_cs_method_info_get_local_store,
&_egdbus_session_cs_method_info_add_password,
+ &_egdbus_session_cs_method_info_find_password,
&_egdbus_session_cs_method_info_get_local_folder,
&_egdbus_session_cs_method_info_get_folder_from_uri,
&_egdbus_session_cs_method_info_send_receive,
@@ -902,6 +949,17 @@ egdbus_session_cs_default_init (EGdbusSessionCSIface *iface)
4,
G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
+ g_signal_new ("handle-find-password",
+ G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EGdbusSessionCSIface, handle_find_password),
+ g_signal_accumulator_true_handled,
+ NULL,
+ _cclosure_marshal_generic,
+ G_TYPE_BOOLEAN,
+ 2,
+ G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
+
g_signal_new ("handle-get-local-folder",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
@@ -1263,6 +1321,71 @@ _out:
}
void
+egdbus_session_cs_call_find_password (
+ EGdbusSessionCS *proxy,
+ const gchar *key,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_dbus_proxy_call (G_DBUS_PROXY (proxy),
+ "findPassword",
+ g_variant_new ("(s)",
+ key),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ cancellable,
+ callback,
+ user_data);
+}
+
+gboolean
+egdbus_session_cs_call_find_password_finish (
+ EGdbusSessionCS *proxy,
+ gchar **out_password,
+ GAsyncResult *res,
+ GError **error)
+{
+ GVariant *_ret;
+ _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
+ if (_ret == NULL)
+ goto _out;
+ g_variant_get (_ret,
+ "(s)",
+ out_password);
+ g_variant_unref (_ret);
+_out:
+ return _ret != NULL;
+}
+
+gboolean
+egdbus_session_cs_call_find_password_sync (
+ EGdbusSessionCS *proxy,
+ const gchar *key,
+ gchar **out_password,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GVariant *_ret;
+ _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
+ "findPassword",
+ g_variant_new ("(s)",
+ key),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ cancellable,
+ error);
+ if (_ret == NULL)
+ goto _out;
+ g_variant_get (_ret,
+ "(s)",
+ out_password);
+ g_variant_unref (_ret);
+_out:
+ return _ret != NULL;
+}
+
+void
egdbus_session_cs_call_get_local_folder (
EGdbusSessionCS *proxy,
const gchar *type,
@@ -1668,6 +1791,17 @@ egdbus_session_cs_complete_add_password (
}
void
+egdbus_session_cs_complete_find_password (
+ EGdbusSessionCS *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *password)
+{
+ g_dbus_method_invocation_return_value (invocation,
+ g_variant_new ("(s)",
+ password));
+}
+
+void
egdbus_session_cs_complete_get_local_folder (
EGdbusSessionCS *object,
GDBusMethodInvocation *invocation,
diff --git a/mail/libegdbus/e-gdbus-emailsession.h b/mail/libegdbus/e-gdbus-emailsession.h
index c2e1760..f9175ba 100644
--- a/mail/libegdbus/e-gdbus-emailsession.h
+++ b/mail/libegdbus/e-gdbus-emailsession.h
@@ -49,6 +49,11 @@ struct _EGdbusSessionCSIface
const gchar *password,
gboolean remember);
+ gboolean (*handle_find_password) (
+ EGdbusSessionCS *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *key);
+
gboolean (*handle_get_local_folder) (
EGdbusSessionCS *object,
GDBusMethodInvocation *invocation,
@@ -123,6 +128,11 @@ void egdbus_session_cs_complete_add_password (
EGdbusSessionCS *object,
GDBusMethodInvocation *invocation);
+void egdbus_session_cs_complete_find_password (
+ EGdbusSessionCS *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *password);
+
void egdbus_session_cs_complete_get_local_folder (
EGdbusSessionCS *object,
GDBusMethodInvocation *invocation,
@@ -237,6 +247,26 @@ gboolean egdbus_session_cs_call_add_password_sync (
GCancellable *cancellable,
GError **error);
+void egdbus_session_cs_call_find_password (
+ EGdbusSessionCS *proxy,
+ const gchar *key,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean egdbus_session_cs_call_find_password_finish (
+ EGdbusSessionCS *proxy,
+ gchar **out_password,
+ GAsyncResult *res,
+ GError **error);
+
+gboolean egdbus_session_cs_call_find_password_sync (
+ EGdbusSessionCS *proxy,
+ const gchar *key,
+ gchar **out_password,
+ GCancellable *cancellable,
+ GError **error);
+
void egdbus_session_cs_call_get_local_folder (
EGdbusSessionCS *proxy,
const gchar *type,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]