Commit d111a415 authored by Yann Leboulanger's avatar Yann Leboulanger

show error message when we try to connect anonymously to a server that doesn't...

show error message when we try to connect anonymously to a server that doesn't support anonymous connection. Fixes #8138
parent 30e4e2aa
......@@ -2838,6 +2838,12 @@ class Connection(CommonConnection, ConnectionHandlers):
self.connection.send(iq)
def get_password(self, callback, type_):
if gajim.config.get_per('accounts', self.name, 'anonymous_auth') and \
type_ != 'ANONYMOUS':
gajim.nec.push_incoming_event(NonAnonymousServerErrorEvent(None,
conn=self))
self._on_disconnected()
return
self.pasword_callback = (callback, type_)
if type_ == 'X-MESSENGER-OAUTH2':
client_id = gajim.config.get_per('accounts', self.name,
......
......@@ -1922,6 +1922,10 @@ class PrivacyListActiveDefaultEvent(nec.NetworkIncomingEvent):
name = 'privacy-list-active-default'
base_network_events = []
class NonAnonymousServerErrorEvent(nec.NetworkIncomingEvent):
name = 'non-anonymous-server-error'
base_network_events = []
class VcardReceivedEvent(nec.NetworkIncomingEvent):
name = 'vcard-received'
base_network_events = []
......
......@@ -1372,6 +1372,13 @@ class Interface:
self.instances[account]['online_dialog']['ssl_error'].set_title(
_('SSL Certificate Verification for %s') % account)
def handle_event_non_anonymous_server(self, obj):
account = obj.conn.name
server = gajim.config.get_per('accounts', account, 'hostname')
dialogs.ErrorDialog(_('Non Anonymous Server'), sectext='Server "%s"'
'does not support anonymous connection' % server,
transient_for=self.roster.window)
def handle_event_fingerprint_error(self, obj):
# ('FINGERPRINT_ERROR', account, (new_fingerprint,))
account = obj.conn.name
......@@ -1568,6 +1575,7 @@ class Interface:
[self.handle_event_roster_item_exchange],
'signed-in': [self.handle_event_signed_in],
'ssl-error': [self.handle_event_ssl_error],
'non-anonymous-server-error': [self.handle_event_non_anonymous_server],
'stream-conflict-received': [self.handle_event_resource_conflict],
'subscribe-presence-received': [
self.handle_event_subscribe_presence],
......
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