Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Taylor <bct@diffeq.com>2008-12-13 21:10:37 +0300
committerBrendan Taylor <bct@diffeq.com>2008-12-13 21:10:37 +0300
commitaeff9046abd8c5c612476406abe84663f9d073e0 (patch)
treea3d1d1893fa2595eb48cfd150d38c8e5bf05cd92
parentd0c3b6fd440f523ba6a213e674420060cf413e08 (diff)
a fix for autonegotiation after esessions were disabled
-rw-r--r--src/chat_control.py2
-rw-r--r--src/common/connection_handlers.py4
-rw-r--r--src/common/stanza_session.py4
-rwxr-xr-xsrc/gajim.py15
-rw-r--r--src/session.py5
5 files changed, 14 insertions, 16 deletions
diff --git a/src/chat_control.py b/src/chat_control.py
index e7ad80d41..4d5f3c35d 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -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
################################################################################
diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py
index 2531d2670..4e5c21b0d 100644
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -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 = {}
diff --git a/src/common/stanza_session.py b/src/common/stanza_session.py
index 9f92c2f17..d0b0f57fc 100644
--- a/src/common/stanza_session.py
+++ b/src/common/stanza_session.py
@@ -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
diff --git a/src/gajim.py b/src/gajim.py
index cd4a9a354..5190b8b06 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -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)
diff --git a/src/session.py b/src/session.py
index ed56aa322..1e7fe91eb 100644
--- a/src/session.py
+++ b/src/session.py
@@ -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):