[epiphany] ephy-embed-single: add a function to update the form auth cache with a new entry
- From: Xan Lopez <xan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [epiphany] ephy-embed-single: add a function to update the form auth cache with a new entry
- Date: Tue, 15 Dec 2009 11:20:13 +0000 (UTC)
commit efb097c929407bb264b90d31feadac34c31a85e7
Author: Xan Lopez <xan gnome org>
Date: Tue Dec 15 12:17:25 2009 +0100
ephy-embed-single: add a function to update the form auth cache with a new entry
embed/ephy-embed-single.c | 53 ++++++++++++++++++++++++++++++++++----------
embed/ephy-embed-single.h | 6 +++++
2 files changed, 47 insertions(+), 12 deletions(-)
---
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index 12e3c88..5e7f6a2 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -143,7 +143,6 @@ get_attr_cb (GnomeKeyringResult result,
{
int i = 0;
GnomeKeyringAttribute *attribute;
- EphyEmbedSinglePrivate *priv = single->priv;
char *server = NULL, *username = NULL;
if (result != GNOME_KEYRING_RESULT_OK)
@@ -171,21 +170,11 @@ get_attr_cb (GnomeKeyringResult result,
* the time */
const char *form_username, *form_password;
GHashTable *t;
- GSList *l;
- EphyEmbedSingleFormAuthData *form_data;
SoupURI *uri = soup_uri_new (server);
t = soup_form_decode (uri->query);
form_username = g_hash_table_lookup (t, FORM_USERNAME_KEY);
form_password = g_hash_table_lookup (t, FORM_PASSWORD_KEY);
-
- form_data = form_auth_data_new (form_username, form_password, username);
- l = g_hash_table_lookup (priv->form_auth_data,
- uri->host);
- l = g_slist_append (l, form_data);
- g_hash_table_replace (priv->form_auth_data,
- g_strdup (uri->host),
- l);
-
+ ephy_embed_single_add_form_auth (single, uri->host, form_username, form_password, username);
soup_uri_free (uri);
g_hash_table_destroy (t);
}
@@ -627,3 +616,43 @@ ephy_embed_single_get_form_auth (EphyEmbedSingle *single,
return g_hash_table_lookup (priv->form_auth_data, uri);
}
+
+/**
+ * ephy_embed_single_add_form_auth:
+ * @single: an #EphyEmbedSingle
+ * @uri: URI of the page
+ * @form_username: name of the username input field
+ * @form_password: name of the password input field
+ * @username: username
+ *
+ * Adds a new entry to the local cache of form auth data stored in
+ * @single.
+ *
+ **/
+void
+ephy_embed_single_add_form_auth (EphyEmbedSingle *single,
+ const char *uri,
+ const char *form_username,
+ const char *form_password,
+ const char *username)
+{
+ EphyEmbedSingleFormAuthData *form_data;
+ EphyEmbedSinglePrivate *priv;
+ GSList *l;
+
+ g_return_if_fail (EPHY_IS_EMBED_SINGLE (single));
+ g_return_if_fail (uri);
+ g_return_if_fail (form_username);
+ g_return_if_fail (form_password);
+ g_return_if_fail (username);
+
+ priv = single->priv;
+
+ form_data = form_auth_data_new (form_username, form_password, username);
+ l = g_hash_table_lookup (priv->form_auth_data,
+ uri);
+ l = g_slist_append (l, form_data);
+ g_hash_table_replace (priv->form_auth_data,
+ g_strdup (uri),
+ l);
+}
diff --git a/embed/ephy-embed-single.h b/embed/ephy-embed-single.h
index 6b7f36c..3210105 100644
--- a/embed/ephy-embed-single.h
+++ b/embed/ephy-embed-single.h
@@ -100,6 +100,12 @@ gboolean ephy_embed_single_get_network_status (EphyEmbedSingle *single);
GSList * ephy_embed_single_get_form_auth (EphyEmbedSingle *single,
const char *uri);
+void ephy_embed_single_add_form_auth (EphyEmbedSingle *single,
+ const char *uri,
+ const char *form_username,
+ const char *form_password,
+ const char *username);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]