aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-account-widget-skype.c
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-03-10 14:15:48 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-04-08 18:41:28 +0800
commitbb66582df14423af0b700a25f3137e13fc438e26 (patch)
treecef9dea14aa627e5794fa1bab711f5ba9046ec09 /libempathy-gtk/empathy-account-widget-skype.c
parentad08eb40c760496a80dc305c8c20b04010d9ecd2 (diff)
downloadgsoc2013-empathy-bb66582df14423af0b700a25f3137e13fc438e26.tar
gsoc2013-empathy-bb66582df14423af0b700a25f3137e13fc438e26.tar.gz
gsoc2013-empathy-bb66582df14423af0b700a25f3137e13fc438e26.tar.bz2
gsoc2013-empathy-bb66582df14423af0b700a25f3137e13fc438e26.tar.lz
gsoc2013-empathy-bb66582df14423af0b700a25f3137e13fc438e26.tar.xz
gsoc2013-empathy-bb66582df14423af0b700a25f3137e13fc438e26.tar.zst
gsoc2013-empathy-bb66582df14423af0b700a25f3137e13fc438e26.zip
Set a fake password if we know the password is saved
Diffstat (limited to 'libempathy-gtk/empathy-account-widget-skype.c')
-rw-r--r--libempathy-gtk/empathy-account-widget-skype.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-account-widget-skype.c b/libempathy-gtk/empathy-account-widget-skype.c
index dbe4ff69e..1cb6156da 100644
--- a/libempathy-gtk/empathy-account-widget-skype.c
+++ b/libempathy-gtk/empathy-account-widget-skype.c
@@ -147,7 +147,7 @@ auth_observer_observe_channels (TpSimpleObserver *auth_observer,
GHashTable *props;
GStrv available_mechanisms;
GtkWidget *password_entry = user_data;
- const char *password;
+ const char *password = NULL;
/* we only do this for Psyke */
if (tp_strdiff (
@@ -171,7 +171,9 @@ auth_observer_observe_channels (TpSimpleObserver *auth_observer,
goto except;
/* do we have a password */
- password = gtk_entry_get_text (GTK_ENTRY (password_entry));
+ if (g_object_get_data (G_OBJECT (password_entry), "fake-password") == NULL)
+ password = gtk_entry_get_text (GTK_ENTRY (password_entry));
+
if (tp_str_empty (password))
goto except;
@@ -352,6 +354,34 @@ account_widget_skype_set_value (EmpathyAccountWidget *self,
}
static void
+account_widget_build_skype_get_password_saved_cb (TpProxy *account,
+ const GValue *value,
+ const GError *in_error,
+ gpointer user_data,
+ GObject *password_entry)
+{
+ gboolean password_saved;
+
+ if (in_error != NULL)
+ {
+ DEBUG ("Failed to get PasswordSaved: %s", in_error->message);
+ return;
+ }
+
+ g_return_if_fail (G_VALUE_HOLDS_BOOLEAN (value));
+
+ password_saved = g_value_get_boolean (value);
+
+ DEBUG ("PasswordSaved: %s", password_saved ? "yes" : "no");
+
+ if (password_saved)
+ gtk_entry_set_text (GTK_ENTRY (password_entry), "xxxxxxxx");
+
+ g_object_set_data (password_entry, "fake-password",
+ GUINT_TO_POINTER (password_saved));
+}
+
+static void
account_widget_build_skype_get_privacy_settings_cb (TpProxy *cm,
GHashTable *props,
const GError *in_error,
@@ -621,6 +651,7 @@ empathy_account_widget_build_skype (EmpathyAccountWidget *self,
const char *filename)
{
EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ TpAccount *account = empathy_account_settings_get_account (priv->settings);
GtkWidget *password_entry;
if (priv->simple || priv->creating_account)
@@ -651,8 +682,6 @@ empathy_account_widget_build_skype (EmpathyAccountWidget *self,
}
else
{
- TpAccount *account =
- empathy_account_settings_get_account (priv->settings);
GtkWidget *edit_privacy_settings_button, *skype_info;
self->ui_details->gui = empathy_builder_get_file (filename,
@@ -693,6 +722,17 @@ empathy_account_widget_build_skype (EmpathyAccountWidget *self,
* tie the lifetime of the observer to the lifetime of the widget */
g_object_set_data_full (G_OBJECT (self->ui_details->widget), "auth-observer",
auth_observer_new (password_entry), g_object_unref);
+
+ /* find out if we know the password */
+ if (tp_proxy_has_interface_by_id (account,
+ EMP_IFACE_QUARK_ACCOUNT_INTERFACE_EXTERNAL_PASSWORD_STORAGE))
+ {
+ tp_cli_dbus_properties_call_get (account, -1,
+ EMP_IFACE_ACCOUNT_INTERFACE_EXTERNAL_PASSWORD_STORAGE,
+ "PasswordSaved",
+ account_widget_build_skype_get_password_saved_cb,
+ NULL, NULL, G_OBJECT (password_entry));
+ }
}
gboolean