[Twisted-Python] t.w jabber client question

Daryl Herzmann akrherz at iastate.edu
Thu Apr 20 16:04:57 EDT 2006


I am getting my feet wet with Twisted Words Jabber and have hit a wall. 
Here is my code:

from twisted.words.protocols.jabber import client, jid
from twisted.words.xish import domish
from twisted.internet import reactor

def sendMessage(factory, body):
     message = domish.Element(("jabber:client","message"))
     message['to']   = "me at myserver.com"
     message.addElement('body', content = body)
     message.addElement('subject', content ="Test")

     # What goes here?

myJID = jid.JID('guest at myserver.com/twisted_words')
factory = client.basicClientFactory(myJID, "password")
reactor.connectTCP('myserver.com',5222, factory)
reactor.callLater(5, sendMessage, factory, "Hi there" )

So my question is how to send a message?  I can't seem to figure it out...


More information about the Twisted-Python mailing list