diff --git a/sleekxmpp/component_example.py b/sleekxmpp/component_example.py index 37b7e96..f24216c 100644 --- a/sleekxmpp/component_example.py +++ b/sleekxmpp/component_example.py @@ -17,7 +17,6 @@ class Example(sleekxmpp.componentxmpp.ComponentXMPP): pass def message(self, event): - print event self.sendMessage("%s/%s" % (event['jid'], event['resource']), "Thanks for sending me, \"%s\"." % event['message'], mtype=event['type']) if __name__ == '__main__': diff --git a/sleekxmpp/componentxmpp.py b/sleekxmpp/componentxmpp.py index 28b5817..7f95241 100755 --- a/sleekxmpp/componentxmpp.py +++ b/sleekxmpp/componentxmpp.py @@ -39,7 +39,7 @@ import random import copy from . import plugins from . import stanza -import sha +import hashlib srvsupport = True try: import dns.resolver @@ -96,7 +96,7 @@ class ComponentXMPP(basexmpp, XMLStream): def start_stream_handler(self, xml): sid = xml.get('id', '') handshake = ET.Element('{jabber:component:accept}handshake') - handshake.text = sha.new(u"%s%s" % (sid, self.secret)).hexdigest().lower() + handshake.text = hashlib.sha1.new(b"%s%s" % (sid, self.secret)).hexdigest().lower() self.send(handshake) def _handleHandshake(self, xml):