merged realtime cancellation patch
This commit is contained in:
parent
88f017a20d
commit
b8882ba48e
|
@ -1464,6 +1464,9 @@ class ChatControl(ChatControlBase):
|
|||
self.mouse_over_in_last_30_secs = False
|
||||
self.kbd_activity_in_last_30_secs = False
|
||||
|
||||
def on_cancel_session_negotiation(self):
|
||||
msg = _('Session negotiation cancelled')
|
||||
ChatControlBase.print_conversation_line(self, msg, 'status', '', None)
|
||||
|
||||
# print esession settings to textview
|
||||
def print_esession_details(self):
|
||||
|
@ -2164,9 +2167,7 @@ class ChatControl(ChatControlBase):
|
|||
if self.session and self.session.enable_encryption:
|
||||
self.session.terminate_e2e()
|
||||
|
||||
msg = _('Encryption disabled')
|
||||
ChatControlBase.print_conversation_line(self, msg,
|
||||
'status', '', None)
|
||||
self.print_esession_details()
|
||||
|
||||
jid = str(self.session.jid)
|
||||
|
||||
|
|
|
@ -72,8 +72,7 @@ class StanzaSession(object):
|
|||
'''A negotiation has been cancelled, so reset this session to its default state.'''
|
||||
|
||||
if hasattr(self, 'control'):
|
||||
msg = _('Session negotiation cancelled')
|
||||
self.control.print_conversation_line(self, msg, 'status', '', None)
|
||||
self.control.on_cancel_session_negotiation()
|
||||
|
||||
self.status = None
|
||||
self.negotiated = {}
|
||||
|
@ -903,3 +902,9 @@ otherwise, list the fields we haven't implemented'''
|
|||
no_log_for = no_log_for.split()
|
||||
|
||||
return self.loggable and account not in no_log_for and self.jid not in no_log_for
|
||||
|
||||
def cancelled_negotiation(self):
|
||||
StanzaSession.cancelled_negotiation(self)
|
||||
self.enable_encryption = False
|
||||
|
||||
self.km_o = ''
|
||||
|
|
25
src/gajim.py
25
src/gajim.py
|
@ -1902,8 +1902,6 @@ class Interface:
|
|||
jid, session, form = data
|
||||
|
||||
if form.getField('accept') and not form['accept'] in ('1', 'true'):
|
||||
dialogs.InformationDialog(_('Session negotiation cancelled'),
|
||||
_('The client at %s cancelled the session negotiation.') % (jid))
|
||||
session.cancelled_negotiation()
|
||||
return
|
||||
|
||||
|
@ -2018,23 +2016,26 @@ class Interface:
|
|||
except exceptions.Cancelled:
|
||||
# user cancelled the negotiation
|
||||
|
||||
session.cancelled_negotiation()
|
||||
session.reject_negotiation()
|
||||
|
||||
return
|
||||
|
||||
if form.getField('terminate'):
|
||||
if form.getField('terminate').getValue() in ('1', 'true'):
|
||||
session.acknowledge_termination()
|
||||
if form.getField('terminate') and\
|
||||
form.getField('terminate').getValue() in ('1', 'true'):
|
||||
was_encrypted = session.enable_encryption
|
||||
ctrl = session.control
|
||||
|
||||
gajim.connections[account].delete_session(str(jid), session.thread_id)
|
||||
session.acknowledge_termination()
|
||||
gajim.connections[account].delete_session(str(jid), session.thread_id)
|
||||
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(str(jid), account)
|
||||
if ctrl:
|
||||
new_sess = gajim.connections[account].make_new_session(str(jid))
|
||||
ctrl.set_session(new_sess)
|
||||
|
||||
if ctrl:
|
||||
new_sess = gajim.connections[account].make_new_session(str(jid))
|
||||
ctrl.set_session(new_sess)
|
||||
if was_encrypted:
|
||||
ctrl.print_esession_details()
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
# non-esession negotiation. this isn't very useful, but i'm keeping it around
|
||||
# to test my test suite.
|
||||
|
|
|
@ -19,7 +19,7 @@ def show_sas_dialog(session, jid, sas, on_success):
|
|||
on_success(checked)
|
||||
|
||||
def failure_cb():
|
||||
session.cancelled_negotiation()
|
||||
session.reject_negotiation()
|
||||
|
||||
dialogs.ConfirmationDialogCheck(_('''OK to continue with negotiation?'''),
|
||||
_('''You've begun an encrypted session with %s, but it can't be guaranteed that you're talking directly to the person you think you are.
|
||||
|
|
Loading…
Reference in New Issue