[Twisted-Python] t.w jabber client question

Daryl Herzmann akrherz at iastate.edu
Thu Apr 20 14:04:57 MDT 2006


Hi,

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?
     #factory.please_sendme_to_server(message)

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" )
reactor.run()

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

TIA,
   daryl




More information about the Twisted-Python mailing list