From a8cc94c188c085e8788e072017ef21d7b7812a55 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Thu, 4 Jan 2018 21:13:44 +0100 Subject: Show error on invalid TLS certificate --- main/src/ui/manage_accounts/dialog.vala | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'main/src/ui') diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala index dd2383a2..b157a936 100644 --- a/main/src/ui/manage_accounts/dialog.vala +++ b/main/src/ui/manage_accounts/dialog.vala @@ -171,7 +171,7 @@ public class Dialog : Gtk.Dialog { } } - private bool on_active_switch_state_changed(bool state) { + private bool change_account_state(bool state) { selected_account.enabled = state; if (state) { if (selected_account.enabled) account_disabled(selected_account); @@ -189,7 +189,7 @@ public class Dialog : Gtk.Dialog { } private void populate_grid_data(Account account) { - active_switch.state_set.disconnect(on_active_switch_state_changed); + active_switch.state_set.disconnect(change_account_state); Util.image_set_from_scaled_pixbuf(image, (new AvatarGenerator(50, 50, image.scale_factor)).draw_account(stream_interactor, account)); active_switch.set_active(account.enabled); @@ -201,7 +201,7 @@ public class Dialog : Gtk.Dialog { update_status_label(account); - active_switch.state_set.connect(on_active_switch_state_changed); + active_switch.state_set.connect(change_account_state); foreach(Plugins.AccountSettingsWidget widget in plugin_widgets) { widget.set_account(account); @@ -216,8 +216,11 @@ public class Dialog : Gtk.Dialog { state_label.get_style_context().add_class("is_error"); if (error.source == ConnectionManager.ConnectionError.Source.SASL || - (error.flag != null && error.flag.reconnection_recomendation == Xmpp.StreamError.Flag.Reconnect.NEVER)) { + error.source == ConnectionManager.ConnectionError.Source.TLS || + error.reconnect_recomendation == ConnectionManager.ConnectionError.Reconnect.NEVER) { + active_switch.state_set.disconnect(change_account_state); active_switch.active = false; + active_switch.state_set.connect(change_account_state); } } else { @@ -238,6 +241,8 @@ public class Dialog : Gtk.Dialog { switch (error.source) { case ConnectionManager.ConnectionError.Source.SASL: return _("Wrong password"); + case ConnectionManager.ConnectionError.Source.TLS: + return _("Invalid TLS certificate"); } if (error.identifier != null) { return _("Error") + ": " + error.identifier; -- cgit v1.2.3-70-g09d2