Skip to content
Snippets Groups Projects
Commit df5200b3 authored by Brendan Taylor's avatar Brendan Taylor
Browse files

try not to send session termination messages to non-XEP-0201 clients

parent f7874d29
No related branches found
No related tags found
No related merge requests found
......@@ -1752,6 +1752,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
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:
......
......@@ -35,6 +35,7 @@ class StanzaSession(object):
self.loggable = True
self.last_send = 0
self.last_receive = 0
self.status = None
self.negotiated = {}
......@@ -110,17 +111,19 @@ class StanzaSession(object):
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment