diff --git a/src/chat_control.py b/src/chat_control.py index 8e65afe954fd6f3eb0009b34df4407f06efcc752..b31ec65fb1385ea86887589c0cd13531861bd162 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1153,6 +1153,7 @@ def __init__(self, parent_win, contact, acct, session, resource = None): self.print_esession_details() # Enable encryption if needed + self.no_autonegotiation = False e2e_is_active = self.session and self.session.enable_encryption self.gpg_is_active = False gpg_pref = gajim.config.get_per('contacts', contact.jid, @@ -2324,22 +2325,18 @@ def _on_message_tv_buffer_changed(self, textbuffer): self.account, 'autonegotiate_esessions') and \ gajim.config.get_per('contacts', self.contact.jid, 'autonegotiate_esessions') - want_e2e = not e2e_is_active and not self.gpg_is_active \ and e2e_pref - already_negotiating = bool(self.session and \ - self.session.status) - # XXX: Once we have fallback to disco, remove # notexistant check - can_e2e = gajim.HAVE_PYCRYPTO and gajim.capscache. \ - is_supported(self.contact, NS_ESESSION) and \ - not gajim.capscache.is_supported(self.contact, - 'notexistant') - - if want_e2e and not already_negotiating and can_e2e: + if want_e2e and not self.no_autonegotiation \ + and gajim.HAVE_PYCRYPTO \ + and gajim.capscache.is_supported(self.contact, + NS_ESESSION) and not gajim.capscache.is_supported( + self.contact, 'notexistant'): self.begin_e2e_negotiation() + self.no_autonegotiation = True else: self.send_chatstate('active', self.contact) diff --git a/src/gajim.py b/src/gajim.py index 73f76d7d1407339a3d531b5cff43a0f35ce0d852..dd9c73752aa357278f86490a821eba5b331fded9 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -816,6 +816,9 @@ def handle_event_notify(self, account, array): for sess in conn.get_sessions(ji): if (ji+'/'+resource) != str(sess.jid): continue + ctrl = sess.control + if ctrl: + ctrl.no_autonegotiation = False if sess.enable_encryption: sess.terminate_e2e() conn.delete_session(jid,