a fix for autonegotiation after esessions were disabled

This commit is contained in:
Brendan Taylor 2008-12-13 18:10:37 +00:00
parent d0c3b6fd44
commit aeff9046ab
5 changed files with 14 additions and 16 deletions

View File

@ -1059,6 +1059,8 @@ class ChatControlBase(MessageControl):
self.msg_textview.set_sensitive(False)
self.msg_textview.set_editable(False)
self.conv_textview.tv.grab_focus()
self.no_autonegotiation = False
# FIXME: Set sensitivity for toolbar
################################################################################

View File

@ -1294,11 +1294,11 @@ class ConnectionHandlersBase:
except KeyError:
return None
def terminate_sessions(self):
def terminate_sessions(self, send_termination = False):
'''send termination messages and delete all active sessions'''
for jid in self.sessions:
for thread_id in self.sessions[jid]:
self.sessions[jid][thread_id].terminate()
self.sessions[jid][thread_id].terminate(send_termination)
self.sessions = {}

View File

@ -133,10 +133,10 @@ class StanzaSession(object):
self.status = None
self.negotiated = {}
def terminate(self):
def terminate(self, send_termination = True):
# only send termination message if we've sent a message and think they
# 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):
msg = xmpp.Message()
feature = msg.NT.feature

View File

@ -842,20 +842,17 @@ class Interface:
# lost they'll be not decryptable (note that
# this contradicts XEP-0201 - trying to get that
# in the XEP, though)
#
# FIXME: This *REALLY* are TOO many leves of
# indentation! We even need to introduce
# a temp var here to make it somehow fit!
# there won't be any sessions here if the contact terminated
# their sessions before going offline (which we do)
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.control:
sess.control.no_autonegotiation = False
if sess.enable_encryption:
sess.terminate_e2e()
conn.delete_session(jid,
sess.thread_id)
conn.delete_session(jid, sess.thread_id)
self.roster.chg_contact_status(contact1, array[1], status_message,
account)

View File

@ -46,15 +46,14 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
def detach_from_control(self):
if self.control:
self.control.no_autonegotiation = False
self.control.set_session(None)
def acknowledge_termination(self):
self.detach_from_control()
stanza_session.EncryptedStanzaSession.acknowledge_termination(self)
def terminate(self):
stanza_session.EncryptedStanzaSession.terminate(self)
def terminate(self, send_termination = True):
stanza_session.EncryptedStanzaSession.terminate(self, send_termination)
self.detach_from_control()
def get_chatstate(self, msg, msgtxt):