show error message when we try to connect anonymously to a server that doesn't support anonymous connection. Fixes #8138

This commit is contained in:
Yann Leboulanger 2015-08-31 13:47:18 +02:00
parent 1f19e8c43d
commit 1eba16df6e
3 changed files with 18 additions and 0 deletions

View File

@ -2860,6 +2860,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,

View File

@ -1924,6 +1924,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 = []

View File

@ -1376,6 +1376,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_sha1,new_fingerprint_sha256,))
account = obj.conn.name
@ -1579,6 +1586,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],