mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +00:00
Save the stream ID when the stream starts.
This commit is contained in:
parent
5be5b8c02b
commit
e83fae3a6f
2 changed files with 14 additions and 1 deletions
|
@ -138,6 +138,17 @@ class BaseXMPP(XMLStream):
|
||||||
register_stanza_plugin(Message, Nick)
|
register_stanza_plugin(Message, Nick)
|
||||||
register_stanza_plugin(Message, HTMLIM)
|
register_stanza_plugin(Message, HTMLIM)
|
||||||
|
|
||||||
|
def start_stream_handler(self, xml):
|
||||||
|
"""
|
||||||
|
Save the stream ID once the streams have been established.
|
||||||
|
|
||||||
|
Overrides XMLStream.start_stream_handler.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
xml -- The incoming stream's root element.
|
||||||
|
"""
|
||||||
|
self.stream_id = xml.get('id', '')
|
||||||
|
|
||||||
def process(self, *args, **kwargs):
|
def process(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Overrides XMLStream.process.
|
Overrides XMLStream.process.
|
||||||
|
|
|
@ -115,11 +115,13 @@ class ComponentXMPP(BaseXMPP):
|
||||||
Once the streams are established, attempt to handshake
|
Once the streams are established, attempt to handshake
|
||||||
with the server to be accepted as a component.
|
with the server to be accepted as a component.
|
||||||
|
|
||||||
Overrides XMLStream.start_stream_handler.
|
Overrides BaseXMPP.start_stream_handler.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
xml -- The incoming stream's root element.
|
xml -- The incoming stream's root element.
|
||||||
"""
|
"""
|
||||||
|
BaseXMPP.start_stream_handler(self, xml)
|
||||||
|
|
||||||
# Construct a hash of the stream ID and the component secret.
|
# Construct a hash of the stream ID and the component secret.
|
||||||
sid = xml.get('id', '')
|
sid = xml.get('id', '')
|
||||||
pre_hash = '%s%s' % (sid, self.secret)
|
pre_hash = '%s%s' % (sid, self.secret)
|
||||||
|
|
Loading…
Reference in a new issue