Author: bct Date: 2008-05-25 23:28:32 +0200 (Sun, 25 May 2008) New Revision: 9696
Modified: trunk/src/common/connection_handlers.py trunk/src/common/stanza_session.py Log: try not to send session termination messages to non-XEP-0201 clients
Modified: trunk/src/common/connection_handlers.py =================================================================== --- trunk/src/common/connection_handlers.py 2008-05-23 23:27:08 UTC (rev 9695) +++ trunk/src/common/connection_handlers.py 2008-05-25 21:28:32 UTC (rev 9696) @@ -1752,6 +1752,8 @@ if thread_id and not session.received_thread_id: session.received_thread_id = True
+ session.last_receive = time_time() + # check if the message is a XEP-0020 feature negotiation request if msg.getTag('feature', namespace=common.xmpp.NS_FEATURE): if gajim.HAVE_PYCRYPTO:
Modified: trunk/src/common/stanza_session.py =================================================================== --- trunk/src/common/stanza_session.py 2008-05-23 23:27:08 UTC (rev 9695) +++ trunk/src/common/stanza_session.py 2008-05-25 21:28:32 UTC (rev 9696) @@ -35,6 +35,7 @@ self.loggable = True
self.last_send = 0 + self.last_receive = 0 self.status = None self.negotiated = {}
@@ -110,17 +111,19 @@ self.negotiated = {}
def terminate(self): - msg = xmpp.Message() - feature = msg.NT.feature - feature.setNamespace(xmpp.NS_FEATURE) + # only send termination message if we think they might have XEP-0201 support + if self.received_thread_id or self.last_receive == 0: + msg = xmpp.Message() + feature = msg.NT.feature + feature.setNamespace(xmpp.NS_FEATURE)
- x = xmpp.DataForm(typ='submit') - x.addChild(node=xmpp.DataField(name='FORM_TYPE', value='urn:xmpp:ssn')) - x.addChild(node=xmpp.DataField(name='terminate', value='1')) + x = xmpp.DataForm(typ='submit') + x.addChild(node=xmpp.DataField(name='FORM_TYPE', value='urn:xmpp:ssn')) + x.addChild(node=xmpp.DataField(name='terminate', value='1'))
- feature.addChild(node=x) + feature.addChild(node=x)
- self.send(msg) + self.send(msg)
self.status = None