From 3bb01de1201501d759c6aadb08ecd9ccf0bdc47c Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 18 Apr 2021 21:15:22 +0200 Subject: stanza: add a Handshake class and use it in componentxmpp --- slixmpp/componentxmpp.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'slixmpp/componentxmpp.py') 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. -- cgit v1.2.3