diff options
Diffstat (limited to 'src/empathy-auth-helper.c')
-rw-r--r-- | src/empathy-auth-helper.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/empathy-auth-helper.c b/src/empathy-auth-helper.c index 6cbffea94..065fc8ded 100644 --- a/src/empathy-auth-helper.c +++ b/src/empathy-auth-helper.c @@ -32,6 +32,7 @@ #include <libempathy/empathy-server-tls-handler.h> #include <libempathy/empathy-tls-verifier.h> +#include <libempathy-gtk/empathy-tls-dialog.h> #include <libempathy-gtk/empathy-ui-utils.h> #include <gnutls/gnutls.h> @@ -39,6 +40,45 @@ #include <extensions/extensions.h> static void +tls_dialog_response_cb (GtkDialog *dialog, + gint response_id, + gpointer user_data) +{ + EmpathyTLSCertificate *certificate = NULL; + EmpTLSCertificateRejectReason reason = 0; + EmpathyTLSDialog *tls_dialog = EMPATHY_TLS_DIALOG (dialog); + + DEBUG ("Response %d", response_id); + + g_object_get (tls_dialog, + "certificate", &certificate, + "reason", &reason, + NULL); + + gtk_widget_destroy (GTK_WIDGET (dialog)); + + if (response_id == GTK_RESPONSE_YES) + empathy_tls_certificate_accept (certificate); + else + empathy_tls_certificate_reject (certificate, reason, TRUE); + + g_object_unref (certificate); +} + +static void +display_interactive_dialog (EmpathyTLSCertificate *certificate, + EmpTLSCertificateRejectReason reason) +{ + GtkWidget *tls_dialog; + + tls_dialog = empathy_tls_dialog_new (certificate, reason); + g_signal_connect (tls_dialog, "response", + G_CALLBACK (tls_dialog_response_cb), NULL); + + gtk_widget_show (tls_dialog); +} + +static void verifier_verify_cb (GObject *source, GAsyncResult *result, gpointer user_data) @@ -58,7 +98,7 @@ verifier_verify_cb (GObject *source, if (error != NULL) { DEBUG ("Error: %s", error->message); - empathy_tls_certificate_reject (certificate, reason, FALSE); + display_interactive_dialog (certificate, reason); g_error_free (error); } |