i have a class MyJabber which init a basic jabber account that print the incoming messages to stdout + put them into a queue.
The code that add the client to the reactor is this:
def addReactor(self):
print 'inside AddReactor'
factory = client.basicClientFactory(self.jid, self.option['jabber']['password'])
print "factory initialized"
factory.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, self.authd)
print 'factory bootsraped'
reactor.connectTCP(self.option['jabber']['server'], 5222, factory)
it's called in this way:
jabber = MyJabber(options, to_irc)
jabber.addReactor()
reactor.run()
When i launch the app i see the 'print' of addReactor but after that nothing anymore. i see via 'tcpdump' that something is trying to connect to 'jabber.org' but nothing related to the authd def:
def authd(self, xmlstream):
global thexmlstream
thexmlstream = xmlstream
# need to send presence so clients know we're
# actually online.
print 'Initializing...'
presence = domish.Element(('jabber:client', 'presence'))
presence.addElement('status').addContent('Online')
xmlstream.send(presence)
# add a callback for the messages
print 'Add gotMessaged callback'
xmlstream.addObserver('/message', gotMessage)
print 'Add * callback'
xmlstream.addObserver('/*', gotSomething)
This doesn't seem to really be a question about how to "init twisted reactor". Rather, it seems to be more about how to use Twisted Words' XMPP support to send and respond to XMPP messages.
You can find a couple examples which do this in the Twisted Words examples directory:
http://twistedmatrix.com/documents/current/words/examples/
Try
xmpp_client.py
andjabber_client.py
.