Commit ad53f214 authored by Philipp Hörist's avatar Philipp Hörist

Client: Raise notification on SASL errors

parent 25494124
......@@ -36,6 +36,7 @@ from gajim.common.helpers import get_custom_host
from gajim.common.helpers import get_user_proxy
from gajim.common.helpers import warn_about_plain_connection
from gajim.common.helpers import get_resource
from gajim.common.i18n import _
from gajim.common.connection_handlers import ConnectionHandlers
from gajim.common.connection_handlers_events import OurShowEvent
......@@ -198,7 +199,7 @@ class Client(ConnectionHandlers):
log.info('Disconnect %s', self._account)
self._set_state(ClientState.DISCONNECTED)
domain, error, _text = self._client.get_error()
domain, error, text = self._client.get_error()
if domain == StreamError.BAD_CERTIFICATE:
self._ssl_errors = self._client.peer_certificate[1]
self.get_module('Chatstate').enabled = False
......@@ -226,6 +227,13 @@ class Client(ConnectionHandlers):
app.nec.push_incoming_event(NetworkEvent(
'password-required', conn=self, on_password=_on_password))
app.nec.push_incoming_event(
NetworkEvent('simple-notification',
account=self._account,
type_='connection-failed',
title=_('Authentication failed'),
text=text or error))
if self._reconnect:
self._after_disconnect()
self._schedule_reconnect()
......
......@@ -61,6 +61,7 @@ class Notification(EventHelper):
self.register_events([
('notification', ged.GUI2, self._nec_notification),
('simple-notification', ged.GUI2, self._on_notification),
('our-show', ged.GUI2, self._nec_our_status),
])
......@@ -114,6 +115,13 @@ class Notification(EventHelper):
except Exception:
pass
def _on_notification(self, event):
self.popup(event.type_,
None,
event.account,
title=event.title,
text=event.text)
def _on_event_removed(self, event_list):
for event in event_list:
if event.type_ == 'gc-invitation':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment