aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/notifications.vala
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui/notifications.vala')
-rw-r--r--main/src/ui/notifications.vala14
1 files changed, 14 insertions, 0 deletions
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;