aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-auth-client.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-11-02 21:48:23 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-11-23 20:33:58 +0800
commit9389308505f9c90ba5a1ce0974ef7d870af7c7e6 (patch)
tree246d2a809fc15245350d5f1032bdda9a7b6073f8 /src/empathy-auth-client.c
parent7f75f25ac7e93e198e23421298b619e6b92992da (diff)
downloadgsoc2013-empathy-9389308505f9c90ba5a1ce0974ef7d870af7c7e6.tar
gsoc2013-empathy-9389308505f9c90ba5a1ce0974ef7d870af7c7e6.tar.gz
gsoc2013-empathy-9389308505f9c90ba5a1ce0974ef7d870af7c7e6.tar.bz2
gsoc2013-empathy-9389308505f9c90ba5a1ce0974ef7d870af7c7e6.tar.lz
gsoc2013-empathy-9389308505f9c90ba5a1ce0974ef7d870af7c7e6.tar.xz
gsoc2013-empathy-9389308505f9c90ba5a1ce0974ef7d870af7c7e6.tar.zst
gsoc2013-empathy-9389308505f9c90ba5a1ce0974ef7d870af7c7e6.zip
Allow user to try another password if auth failed
https://bugzilla.gnome.org/show_bug.cgi?id=661640
Diffstat (limited to 'src/empathy-auth-client.c')
-rw-r--r--src/empathy-auth-client.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/empathy-auth-client.c b/src/empathy-auth-client.c
index bb7446847..5b3e48ce8 100644
--- a/src/empathy-auth-client.c
+++ b/src/empathy-auth-client.c
@@ -36,6 +36,7 @@
#include <libempathy/empathy-tls-verifier.h>
#include <libempathy/empathy-utils.h>
+#include <libempathy-gtk/empathy-bad-password-dialog.h>
#include <libempathy-gtk/empathy-password-dialog.h>
#include <libempathy-gtk/empathy-tls-dialog.h>
#include <libempathy-gtk/empathy-ui-utils.h>
@@ -235,6 +236,38 @@ auth_factory_new_sasl_handler_cb (EmpathyAuthFactory *factory,
}
}
+static void
+retry_account_cb (GtkWidget *dialog,
+ TpAccount *account,
+ const gchar *password,
+ EmpathyAuthFactory *factory)
+{
+ DEBUG ("Try reconnecting to %s", tp_account_get_path_suffix (account));
+
+ empathy_auth_factory_save_retry_password (factory, account, password);
+
+ tp_account_reconnect_async (account, NULL, NULL);
+}
+
+static void
+auth_factory_auth_passsword_failed (EmpathyAuthFactory *factory,
+ TpAccount *account,
+ const gchar *password,
+ gpointer user_data)
+{
+ GtkWidget *dialog;
+
+ DEBUG ("Authentification on %s failed, popup password dialog",
+ tp_account_get_path_suffix (account));
+
+ dialog = empathy_bad_password_dialog_new (account, password);
+
+ tp_g_signal_connect_object (dialog, "retry",
+ G_CALLBACK (retry_account_cb), factory, 0);
+
+ gtk_widget_show (dialog);
+}
+
int
main (int argc,
char **argv)
@@ -294,6 +327,9 @@ main (int argc,
g_signal_connect (factory, "new-server-sasl-handler",
G_CALLBACK (auth_factory_new_sasl_handler_cb), NULL);
+ g_signal_connect (factory, "auth-password-failed",
+ G_CALLBACK (auth_factory_auth_passsword_failed), NULL);
+
if (!empathy_auth_factory_register (factory, &error))
{
g_critical ("Failed to register the auth factory: %s\n", error->message);