Commit 8b2c84df authored by Srinivasa Ragavan's avatar Srinivasa Ragavan

Add API to fetch password from session.

parent be27b2f3
......@@ -337,6 +337,22 @@ impl_Mail_getFolderFromUri (EGdbusSessionCS *object, GDBusMethodInvocation *invo
return TRUE;
}
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)
{
......@@ -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);
......
......@@ -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"
......
......@@ -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,
......@@ -1262,6 +1320,71 @@ _out:
return _ret != NULL;
}
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,
......@@ -1667,6 +1790,17 @@ egdbus_session_cs_complete_add_password (
g_variant_new ("()"));
}
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,
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment