Add session_bind_event threading event.
This commit is contained in:
parent
46f49c7a12
commit
a347cf625a
@ -16,6 +16,7 @@ from __future__ import with_statement, unicode_literals
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
import threading
|
||||||
|
|
||||||
import sleekxmpp
|
import sleekxmpp
|
||||||
from sleekxmpp import plugins, features, roster
|
from sleekxmpp import plugins, features, roster
|
||||||
@ -69,8 +70,11 @@ class BaseXMPP(XMLStream):
|
|||||||
|
|
||||||
#: The JabberID (JID) used by this connection.
|
#: The JabberID (JID) used by this connection.
|
||||||
self.boundjid = JID(jid)
|
self.boundjid = JID(jid)
|
||||||
|
|
||||||
self._expected_server_name = self.boundjid.host
|
self._expected_server_name = self.boundjid.host
|
||||||
|
|
||||||
|
self.session_bind_event = threading.Event()
|
||||||
|
|
||||||
#: A dictionary mapping plugin names to plugins.
|
#: A dictionary mapping plugin names to plugins.
|
||||||
self.plugin = PluginManager(self)
|
self.plugin = PluginManager(self)
|
||||||
|
|
||||||
@ -655,6 +659,7 @@ class BaseXMPP(XMLStream):
|
|||||||
def _handle_disconnected(self, event):
|
def _handle_disconnected(self, event):
|
||||||
"""When disconnected, reset the roster"""
|
"""When disconnected, reset the roster"""
|
||||||
self.roster.reset()
|
self.roster.reset()
|
||||||
|
self.session_bind_event.clear()
|
||||||
|
|
||||||
def _handle_stream_error(self, error):
|
def _handle_stream_error(self, error):
|
||||||
self.event('stream_error', error)
|
self.event('stream_error', error)
|
||||||
|
@ -156,7 +156,9 @@ class ComponentXMPP(BaseXMPP):
|
|||||||
|
|
||||||
:param xml: The reply handshake stanza.
|
:param xml: The reply handshake stanza.
|
||||||
"""
|
"""
|
||||||
|
self.session_bind_event.set()
|
||||||
self.session_started_event.set()
|
self.session_started_event.set()
|
||||||
|
self.event("session_bind", self.xmpp.boundjid.full, direct=True)
|
||||||
self.event("session_start")
|
self.event("session_start")
|
||||||
|
|
||||||
def _handle_probe(self, presence):
|
def _handle_probe(self, presence):
|
||||||
|
@ -50,7 +50,8 @@ class FeatureBind(BasePlugin):
|
|||||||
|
|
||||||
self.xmpp.set_jid(response['bind']['jid'])
|
self.xmpp.set_jid(response['bind']['jid'])
|
||||||
self.xmpp.bound = True
|
self.xmpp.bound = True
|
||||||
self.xmpp.event('session_bind', self.xmpp.boundjid, direct=True)
|
self.xmpp.event('session_bind', self.xmpp.boundjid.full, direct=True)
|
||||||
|
self.xmpp.session_bind_event.set()
|
||||||
|
|
||||||
self.xmpp.features.add('bind')
|
self.xmpp.features.add('bind')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user