Sending XHTML over Jabber using xmpppy
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/Se开发者_运维问答nding-XHTML-over-Jabber
But didn't work... any ideas??
Thanks in advance!
M
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'>" + html_message.encode('utf-8') + "</body>"))
message.addChild(node=html)
精彩评论