brought components over to python 3.x

This commit is contained in:
Nathan Fritz 2009-08-31 23:02:19 +00:00
parent 05c9ea5c1d
commit 436841fa6f
2 changed files with 2 additions and 3 deletions

View file

@ -17,7 +17,6 @@ class Example(sleekxmpp.componentxmpp.ComponentXMPP):
pass pass
def message(self, event): def message(self, event):
print event
self.sendMessage("%s/%s" % (event['jid'], event['resource']), "Thanks for sending me, \"%s\"." % event['message'], mtype=event['type']) self.sendMessage("%s/%s" % (event['jid'], event['resource']), "Thanks for sending me, \"%s\"." % event['message'], mtype=event['type'])
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -39,7 +39,7 @@ import random
import copy import copy
from . import plugins from . import plugins
from . import stanza from . import stanza
import sha import hashlib
srvsupport = True srvsupport = True
try: try:
import dns.resolver import dns.resolver
@ -96,7 +96,7 @@ 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 = 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) self.send(handshake)
def _handleHandshake(self, xml): def _handleHandshake(self, xml):