fixed 2.6 compatibility for componentxmpp

This commit is contained in:
Nathan Fritz 2010-01-27 15:09:23 -08:00
parent 65dd83d4e1
commit a4ec7413e4

View file

@ -76,7 +76,10 @@ class ComponentXMPP(basexmpp, XMLStream):
def start_stream_handler(self, xml): def start_stream_handler(self, xml):
sid = xml.get('id', '') sid = xml.get('id', '')
handshake = ET.Element('{jabber:component:accept}handshake') handshake = ET.Element('{jabber:component:accept}handshake')
handshake.text = hashlib.sha1(bytes("%s%s" % (sid, self.secret), 'utf-8')).hexdigest().lower() if sys.version_info < (3,0):
handshake.text = hashlib.sha1("%s%s" % (sid, self.secret)).hexdigest().lower()
else:
handshake.text = hashlib.sha1(bytes("%s%s" % (sid, self.secret), 'utf-8')).hexdigest().lower()
self.sendXML(handshake) self.sendXML(handshake)
def _handleHandshake(self, xml): def _handleHandshake(self, xml):