changeset d1ba8ee33b46 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=d1ba8ee33b46
description: change the insecure connection dialog behaviour. Fixes #7019
diffstat:
src/common/config.py | 2 +-
src/common/connection.py | 8 +++++++-
src/dialogs.py | 7 ++++++-
src/gui_interface.py | 15 ++++++++++-----
4 files changed, 24 insertions(+), 8 deletions(-)
diffs (109 lines):
diff -r 586991e434e6 -r d1ba8ee33b46 src/common/config.py
--- a/src/common/config.py Sun Oct 30 13:27:32 2011 +0100
+++ b/src/common/config.py Mon Oct 31 09:47:01 2011 +0100
@@ -323,7 +323,7 @@
'enable_esessions': [opt_bool, True, _('Enable ESessions
encryption for this account.')],
'autonegotiate_esessions': [opt_bool, True, _('Should
Gajim automatically start an encrypted session when possible?')],
'connection_types': [ opt_str, 'tls ssl plain', _('Ordered
list (space separated) of connection type to try. Can contain tls, ssl or
plain')],
- 'warn_when_plaintext_connection': [ opt_bool, True,
_('Show a warning dialog before sending password on an plaintext connection.')
],
+ 'action_when_plaintext_connection': [ opt_str, 'warn',
_('Show a warning dialog before sending password on an plaintext connection.
Can be \'warn\', \'connect\', \'disconnect\'') ],
'warn_when_insecure_ssl_connection': [ opt_bool, True,
_('Show a warning dialog before using standard SSL library.') ],
'warn_when_insecure_password': [ opt_bool, True, _('Show a
warning dialog before sending PLAIN password over a plain connection.') ],
'ssl_fingerprint_sha1': [ opt_str, '', '', True ],
diff -r 586991e434e6 -r d1ba8ee33b46 src/common/connection.py
--- a/src/common/connection.py Sun Oct 30 13:27:32 2011 +0100
+++ b/src/common/connection.py Mon Oct 31 09:47:01 2011 +0100
@@ -1254,10 +1254,16 @@
return
con.RegisterDisconnectHandler(self._on_disconnected)
if _con_type == 'plain' and gajim.config.get_per('accounts', self.name,
- 'warn_when_plaintext_connection'):
+ 'action_when_plaintext_connection') == 'warn':
gajim.nec.push_incoming_event(PlainConnectionEvent(None, conn=self,
xmpp_client=con))
return True
+ if _con_type == 'plain' and gajim.config.get_per('accounts', self.name,
+ 'action_when_plaintext_connection') == 'disconnect':
+ self.disconnect(on_purpose=True)
+ gajim.nec.push_incoming_event(OurShowEvent(None, conn=self,
+ show='offline'))
+ return False
if _con_type in ('tls', 'ssl') and con.Connection.ssl_lib !=
'PYOPENSSL' \
and gajim.config.get_per('accounts', self.name,
'warn_when_insecure_ssl_connection') and \
diff -r 586991e434e6 -r d1ba8ee33b46 src/dialogs.py
--- a/src/dialogs.py Sun Oct 30 13:27:32 2011 +0100
+++ b/src/dialogs.py Mon Oct 31 09:47:01 2011 +0100
@@ -1722,7 +1722,8 @@
"""
def __init__(self, pritext, sectext='', checktext1='', checktext2='',
- on_response_ok=None, on_response_cancel=None, is_modal=True):
+ tooltip1='', tooltip2='', on_response_ok=None, on_response_cancel=None,
+ is_modal=True):
self.user_response_ok = on_response_ok
self.user_response_cancel = on_response_cancel
@@ -1741,11 +1742,15 @@
if checktext1:
self.checkbutton1 = gtk.CheckButton(checktext1)
+ if tooltip1:
+ self.checkbutton1.set_tooltip_text(tooltip1)
self.vbox.pack_start(self.checkbutton1, expand=False, fill=True)
else:
self.checkbutton1 = None
if checktext2:
self.checkbutton2 = gtk.CheckButton(checktext2)
+ if tooltip2:
+ self.checkbutton2.set_tooltip_text(tooltip2)
self.vbox.pack_start(self.checkbutton2, expand=False, fill=True)
else:
self.checkbutton2 = None
diff -r 586991e434e6 -r d1ba8ee33b46 src/gui_interface.py
--- a/src/gui_interface.py Sun Oct 30 13:27:32 2011 +0100
+++ b/src/gui_interface.py Mon Oct 31 09:47:01 2011 +0100
@@ -1249,6 +1249,9 @@
# ('PLAIN_CONNECTION', account, (connection))
def on_ok(is_checked):
if not is_checked[0]:
+ if is_checked[1]:
+ gajim.config.set_per('accounts', obj.conn.name,
+ 'action_when_plaintext_connection', 'disconnect')
on_cancel()
return
# On cancel call del self.instances, so don't call it another time
@@ -1257,7 +1260,7 @@
['plain_connection']
if is_checked[1]:
gajim.config.set_per('accounts', obj.conn.name,
- 'warn_when_plaintext_connection', False)
+ 'action_when_plaintext_connection', 'connect')
obj.conn.connection_accepted(obj.xmpp_client, 'plain')
def on_cancel():
@@ -1270,18 +1273,20 @@
pritext = _('Insecure connection')
sectext = _('You are about to connect to the account %(account)s '
'(%(server)s) with an insecure connection. This means all your '
- 'conversations will be exchanged unencrypted. Are you sure you '
- 'want to do that?') % {'account': obj.conn.name,
+ 'conversations will be exchanged unencrypted. This type of '
+ 'connection is really discouraged.\nAre you sure you want to do '
+ 'that?') % {'account': obj.conn.name,
'server': gajim.get_hostname_from_account(obj.conn.name)}
checktext1 = _('Yes, I really want to connect insecurely')
+ tooltip1 = _('Gajim will NOT connect unless you check this box')
checktext2 = _('_Do not ask me again')
if 'plain_connection' in
self.instances[obj.conn.name]['online_dialog']:
self.instances[obj.conn.name]['online_dialog']['plain_connection'].\
destroy()
self.instances[obj.conn.name]['online_dialog']['plain_connection'] = \
dialogs.ConfirmationDialogDoubleCheck(pritext, sectext, checktext1,
- checktext2, on_response_ok=on_ok, on_response_cancel=on_cancel,
- is_modal=False)
+ checktext2, tooltip1=tooltip1, on_response_ok=on_ok,
+ on_response_cancel=on_cancel, is_modal=False)
def handle_event_insecure_ssl_connection(self, obj):
# ('INSECURE_SSL_CONNECTION', account, (connection, connection_type))
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits