a fix for autonegotiation after esessions were disabled
This commit is contained in:
parent
d0c3b6fd44
commit
aeff9046ab
5 changed files with 14 additions and 16 deletions
|
@ -1059,6 +1059,8 @@ class ChatControlBase(MessageControl):
|
||||||
self.msg_textview.set_sensitive(False)
|
self.msg_textview.set_sensitive(False)
|
||||||
self.msg_textview.set_editable(False)
|
self.msg_textview.set_editable(False)
|
||||||
self.conv_textview.tv.grab_focus()
|
self.conv_textview.tv.grab_focus()
|
||||||
|
|
||||||
|
self.no_autonegotiation = False
|
||||||
# FIXME: Set sensitivity for toolbar
|
# FIXME: Set sensitivity for toolbar
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
|
@ -1294,11 +1294,11 @@ class ConnectionHandlersBase:
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def terminate_sessions(self):
|
def terminate_sessions(self, send_termination = False):
|
||||||
'''send termination messages and delete all active sessions'''
|
'''send termination messages and delete all active sessions'''
|
||||||
for jid in self.sessions:
|
for jid in self.sessions:
|
||||||
for thread_id in self.sessions[jid]:
|
for thread_id in self.sessions[jid]:
|
||||||
self.sessions[jid][thread_id].terminate()
|
self.sessions[jid][thread_id].terminate(send_termination)
|
||||||
|
|
||||||
self.sessions = {}
|
self.sessions = {}
|
||||||
|
|
||||||
|
|
|
@ -133,10 +133,10 @@ class StanzaSession(object):
|
||||||
self.status = None
|
self.status = None
|
||||||
self.negotiated = {}
|
self.negotiated = {}
|
||||||
|
|
||||||
def terminate(self):
|
def terminate(self, send_termination = True):
|
||||||
# only send termination message if we've sent a message and think they
|
# only send termination message if we've sent a message and think they
|
||||||
# have XEP-0201 support
|
# have XEP-0201 support
|
||||||
if self.last_send > 0 and \
|
if send_termination and self.last_send > 0 and \
|
||||||
(self.received_thread_id or self.last_receive == 0):
|
(self.received_thread_id or self.last_receive == 0):
|
||||||
msg = xmpp.Message()
|
msg = xmpp.Message()
|
||||||
feature = msg.NT.feature
|
feature = msg.NT.feature
|
||||||
|
|
15
src/gajim.py
15
src/gajim.py
|
@ -842,20 +842,17 @@ class Interface:
|
||||||
# lost they'll be not decryptable (note that
|
# lost they'll be not decryptable (note that
|
||||||
# this contradicts XEP-0201 - trying to get that
|
# this contradicts XEP-0201 - trying to get that
|
||||||
# in the XEP, though)
|
# in the XEP, though)
|
||||||
#
|
|
||||||
# FIXME: This *REALLY* are TOO many leves of
|
# there won't be any sessions here if the contact terminated
|
||||||
# indentation! We even need to introduce
|
# their sessions before going offline (which we do)
|
||||||
# a temp var here to make it somehow fit!
|
|
||||||
for sess in conn.get_sessions(ji):
|
for sess in conn.get_sessions(ji):
|
||||||
if (ji+'/'+resource) != str(sess.jid):
|
if (ji+'/'+resource) != str(sess.jid):
|
||||||
continue
|
continue
|
||||||
ctrl = sess.control
|
if sess.control:
|
||||||
if ctrl:
|
sess.control.no_autonegotiation = False
|
||||||
ctrl.no_autonegotiation = False
|
|
||||||
if sess.enable_encryption:
|
if sess.enable_encryption:
|
||||||
sess.terminate_e2e()
|
sess.terminate_e2e()
|
||||||
conn.delete_session(jid,
|
conn.delete_session(jid, sess.thread_id)
|
||||||
sess.thread_id)
|
|
||||||
|
|
||||||
self.roster.chg_contact_status(contact1, array[1], status_message,
|
self.roster.chg_contact_status(contact1, array[1], status_message,
|
||||||
account)
|
account)
|
||||||
|
|
|
@ -46,15 +46,14 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
|
||||||
|
|
||||||
def detach_from_control(self):
|
def detach_from_control(self):
|
||||||
if self.control:
|
if self.control:
|
||||||
self.control.no_autonegotiation = False
|
|
||||||
self.control.set_session(None)
|
self.control.set_session(None)
|
||||||
|
|
||||||
def acknowledge_termination(self):
|
def acknowledge_termination(self):
|
||||||
self.detach_from_control()
|
self.detach_from_control()
|
||||||
stanza_session.EncryptedStanzaSession.acknowledge_termination(self)
|
stanza_session.EncryptedStanzaSession.acknowledge_termination(self)
|
||||||
|
|
||||||
def terminate(self):
|
def terminate(self, send_termination = True):
|
||||||
stanza_session.EncryptedStanzaSession.terminate(self)
|
stanza_session.EncryptedStanzaSession.terminate(self, send_termination)
|
||||||
self.detach_from_control()
|
self.detach_from_control()
|
||||||
|
|
||||||
def get_chatstate(self, msg, msgtxt):
|
def get_chatstate(self, msg, msgtxt):
|
||||||
|
|
Loading…
Add table
Reference in a new issue