Author: bct
Date: 2008-12-13 19:10:37 +0100 (Sat, 13 Dec 2008)
New Revision: 10842
Modified:
trunk/src/chat_control.py
trunk/src/common/connection_handlers.py
trunk/src/common/stanza_session.py
trunk/src/gajim.py
trunk/src/session.py
Log:
a fix for autonegotiation after esessions were disabled
Modified: trunk/src/chat_control.py
===================================================================
--- trunk/src/chat_control.py 2008-12-13 16:55:21 UTC (rev 10841)
+++ trunk/src/chat_control.py 2008-12-13 18:10:37 UTC (rev 10842)
@@ -1059,6 +1059,8 @@
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
################################################################################
Modified: trunk/src/common/connection_handlers.py
===================================================================
--- trunk/src/common/connection_handlers.py 2008-12-13 16:55:21 UTC (rev 10841)
+++ trunk/src/common/connection_handlers.py 2008-12-13 18:10:37 UTC (rev 10842)
@@ -1294,11 +1294,11 @@
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 = {}
Modified: trunk/src/common/stanza_session.py
===================================================================
--- trunk/src/common/stanza_session.py 2008-12-13 16:55:21 UTC (rev 10841)
+++ trunk/src/common/stanza_session.py 2008-12-13 18:10:37 UTC (rev 10842)
@@ -133,10 +133,10 @@
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
Modified: trunk/src/gajim.py
===================================================================
--- trunk/src/gajim.py 2008-12-13 16:55:21 UTC (rev 10841)
+++ trunk/src/gajim.py 2008-12-13 18:10:37 UTC (rev 10842)
@@ -842,20 +842,17 @@
# 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)
Modified: trunk/src/session.py
===================================================================
--- trunk/src/session.py 2008-12-13 16:55:21 UTC (rev 10841)
+++ trunk/src/session.py 2008-12-13 18:10:37 UTC (rev 10842)
@@ -46,15 +46,14 @@
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):