diff options
author | mathieui <mathieui@mathieui.net> | 2021-04-18 21:15:22 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2021-04-18 21:15:22 +0200 |
commit | 3bb01de1201501d759c6aadb08ecd9ccf0bdc47c (patch) | |
tree | 5533bf97fa8a453562ad9977f4c89985d787340d /slixmpp/componentxmpp.py | |
parent | 7057773d1878d1b7c2780425d07889d6e5be4082 (diff) | |
download | slixmpp-3bb01de1201501d759c6aadb08ecd9ccf0bdc47c.tar.gz slixmpp-3bb01de1201501d759c6aadb08ecd9ccf0bdc47c.tar.bz2 slixmpp-3bb01de1201501d759c6aadb08ecd9ccf0bdc47c.tar.xz slixmpp-3bb01de1201501d759c6aadb08ecd9ccf0bdc47c.zip |
stanza: add a Handshake class and use it in componentxmpp
Diffstat (limited to 'slixmpp/componentxmpp.py')
-rw-r--r-- | slixmpp/componentxmpp.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/slixmpp/componentxmpp.py b/slixmpp/componentxmpp.py index 3a16f942..8927712e 100644 --- a/slixmpp/componentxmpp.py +++ b/slixmpp/componentxmpp.py @@ -10,6 +10,7 @@ import logging import hashlib from slixmpp.basexmpp import BaseXMPP +from slixmpp.stanza import Handshake from slixmpp.xmlstream import XMLStream from slixmpp.xmlstream import ET from slixmpp.xmlstream.matcher import MatchXPath @@ -123,9 +124,10 @@ class ComponentXMPP(BaseXMPP): sid = xml.get('id', '') pre_hash = bytes('%s%s' % (sid, self.secret), 'utf-8') - handshake = ET.Element('{jabber:component:accept}handshake') - handshake.text = hashlib.sha1(pre_hash).hexdigest().lower() - self.send_xml(handshake) + handshake = Handshake() + handshake['value'] = hashlib.sha1(pre_hash).hexdigest().lower() + + self.send(handshake) def _handle_handshake(self, xml): """The handshake has been accepted. |