[gnome-online-accounts] live: Implement is_identity_node



commit d0d55a546d9286cc558251df24945ec15d9d00d2
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Oct 6 19:35:38 2012 +0200

    live: Implement is_identity_node
    
    Currently, this is broken. The element does not show up in
    webkit_dom_document_get_elements_by_tag_name but can be seen in the
    inspector. Needs further investigation.
    
    Fixes: https://bugzilla.gnome.org/681729

 src/goabackend/goawindowsliveprovider.c |   34 +++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/src/goabackend/goawindowsliveprovider.c b/src/goabackend/goawindowsliveprovider.c
index 7e27cfa..7844d11 100644
--- a/src/goabackend/goawindowsliveprovider.c
+++ b/src/goabackend/goawindowsliveprovider.c
@@ -256,6 +256,39 @@ is_deny_node (GoaOAuth2Provider *provider, WebKitDOMNode *node)
   return ret;
 }
 
+static gboolean
+is_identity_node (GoaOAuth2Provider *provider, WebKitDOMHTMLInputElement *element)
+{
+  gboolean ret;
+  gchar *element_type;
+  gchar *name;
+
+  element_type = NULL;
+  name = NULL;
+
+  ret = FALSE;
+
+  /* FIXME: This does not show up in
+   *        webkit_dom_document_get_elements_by_tag_name, but can be
+   *        seen in the inspector. Needs further investigation.
+   */
+
+  g_object_get (element, "type", &element_type, NULL);
+  if (g_strcmp0 (element_type, "email") != 0)
+    goto out;
+
+  name = webkit_dom_html_input_element_get_name (element);
+  if (g_strcmp0 (name, "login") != 0)
+    goto out;
+
+  ret = TRUE;
+
+ out:
+  g_free (element_type);
+  g_free (name);
+  return ret;
+}
+
 /* ---------------------------------------------------------------------------------------------------- */
 
 static gboolean
@@ -417,5 +450,6 @@ goa_windows_live_provider_class_init (GoaWindowsLiveProviderClass *klass)
   oauth2_class->get_authentication_cookie = get_authentication_cookie;
   oauth2_class->get_identity_sync        = get_identity_sync;
   oauth2_class->is_deny_node             = is_deny_node;
+  oauth2_class->is_identity_node         = is_identity_node;
   oauth2_class->add_account_key_values   = add_account_key_values;
 }



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