diff options
author | fiaxh <git@mx.ax.lt> | 2018-09-15 16:11:05 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2018-09-15 16:19:47 +0200 |
commit | 6d947c42b5e573cb350a1354a47a3a806a22cbb2 (patch) | |
tree | 610471569b55880d563ca86db5041f11ec0022ce /main | |
parent | bf2c78d1b720fff381b2a5a86bb154cffc0d7814 (diff) | |
download | dino-6d947c42b5e573cb350a1354a47a3a806a22cbb2.tar.gz dino-6d947c42b5e573cb350a1354a47a3a806a22cbb2.zip |
Notification on TLS error/wrong password, log TLS cert issues, don't make account with connection error appear disabled in accounts dialog
Diffstat (limited to 'main')
-rw-r--r-- | main/src/ui/manage_accounts/dialog.vala | 9 | ||||
-rw-r--r-- | main/src/ui/notifications.vala | 14 |
2 files changed, 14 insertions, 9 deletions
diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala index 5706fc8c..1a370349 100644 --- a/main/src/ui/manage_accounts/dialog.vala +++ b/main/src/ui/manage_accounts/dialog.vala @@ -215,15 +215,6 @@ public class Dialog : Gtk.Dialog { if (error != null) { state_label.label = get_connection_error_description(error); state_label.get_style_context().add_class("is_error"); - - if (error.source == ConnectionManager.ConnectionError.Source.SASL || - 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 { ConnectionManager.ConnectionState state = stream_interactor.connection_manager.get_state(account); switch (state) { diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala index f7540a4d..b0a4fe1b 100644 --- a/main/src/ui/notifications.vala +++ b/main/src/ui/notifications.vala @@ -43,6 +43,7 @@ public class Notifications : Object { public void start() { stream_interactor.get_module(NotificationEvents.IDENTITY).notify_message.connect(notify_message); stream_interactor.get_module(NotificationEvents.IDENTITY).notify_subscription_request.connect(notify_subscription_request); + stream_interactor.get_module(NotificationEvents.IDENTITY).notify_connection_error.connect(notify_connection_error); } private void notify_message(Entities.Message message, Conversation conversation) { @@ -79,6 +80,19 @@ public class Notifications : Object { active_ids.add(conversation.id.to_string() + "-subscription"); } + private void notify_connection_error(Account account, ConnectionManager.ConnectionError error) { + Notification notification = new Notification(_("Failed connecting to %s").printf(account.bare_jid.domainpart)); + switch (error.source) { + case ConnectionManager.ConnectionError.Source.SASL: + notification.set_body("Wrong password"); + break; + case ConnectionManager.ConnectionError.Source.TLS: + notification.set_body("Invalid TLS certificate"); + break; + } + window.get_application().send_notification(account.id.to_string() + "-connection-error", notification); + } + private Icon get_pixbuf_icon(Cairo.ImageSurface surface) throws Error { Gdk.Pixbuf avatar = Gdk.pixbuf_get_from_surface(surface, 0, 0, surface.get_width(), surface.get_height()); uint8[] buffer; |