session packet are not mendatory during login. Send it only when requested by server. Fixes #5088

This commit is contained in:
Yann Leboulanger 2009-07-13 18:32:16 +02:00
parent c4a720aa89
commit 53c31a53b6
1 changed files with 7 additions and 3 deletions

View File

@ -504,9 +504,13 @@ class NonBlockingBind(PlugIn):
jid = JID(resp.getTag('bind').getTagData('jid'))
self._owner.User = jid.getNode()
self._owner.Resource = jid.getResource()
self._owner.SendAndWaitForResponse(Protocol('iq', typ='set',
payload=[Node('session', attrs={'xmlns':NS_SESSION})]),
func=self._on_session)
if self.session == -1: #Server don't want us to initialize a session
log.info('No session required.')
self.on_bound('ok')
else:
self._owner.SendAndWaitForResponse(Protocol('iq', typ='set',
payload=[Node('session', attrs={'xmlns':NS_SESSION})]),
func=self._on_session)
return
if resp:
log.error('Binding failed: %s.' % resp.getTag('error'))