From f42499acdb014c125b936bc8baad4c9b19b0f125 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 9 Nov 2014 14:03:01 +0100 Subject: [PATCH] warn user when custom hostname is wrong. Fixes #7489 --- src/common/connection.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index c28c75d66..47b0fb5e0 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -1135,10 +1135,20 @@ class Connection(CommonConnection, ConnectionHandlers): else: use_custom = gajim.config.get_per('accounts', self.name, 'use_custom_host') - custom_h = gajim.config.get_per('accounts', self.name, - 'custom_host') - custom_p = gajim.config.get_per('accounts', self.name, - 'custom_port') + if use_custom: + custom_h = gajim.config.get_per('accounts', self.name, + 'custom_host') + custom_p = gajim.config.get_per('accounts', self.name, + 'custom_port') + try: + helpers.idn_to_ascii(custom_h) + except Exception: + gajim.nec.push_incoming_event(InformationEvent(None, + conn=self, level='error', + pri_txt=_('Wrong Custom Hostname'), + sec_txt='Wrong custom hostname "%s". Ignoring it.' \ + % custom_h)) + use_custom = False # create connection if it doesn't already exist self.connected = 1