tags:

views:

57

answers:

1

I'm trying to send XHTML (a hyperlink) over Jabber (to Google Talk) using xmpppy, but can't find a good working example... I tried with this:

http://intertwingly.net/blog/2007/08/09/Sending-XHTML-over-Jabber

But didn't work... any ideas??

Thanks in advance!

M

A: 

Heres a nugget I use to construct a XHTML message (thanks to Thomas Perl / Jabberbot.py)

    html_message = "<b>Test!</b>"

    plain_message = re.sub(r'<[^>]+>', '', html_message)
    message = xmpp.protocol.Message(body=plain_message)
    html = xmpp.Node('html', {'xmlns': 'http://jabber.org/protocol/xhtml-im'})
    html.addChild(node=xmpp.simplexml.XML2Node("<body xmlns='http://www.w3.org/1999/xhtml'&gt;" + html_message.encode('utf-8') + "</body>")) 
    message.addChild(node=html)
Andrew Williams