-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow HTML formatted messages #63
Comments
PyXMPP2 doesn't have any dedicated XHTML-IM support yet, but you can add the XHTML code to the Message stanza as an XMLPayload object. Like this: from pyxmpp2.etree import ElementTree
from pyxmpp2.message import Message
from pyxmpp2.stanzapayload import XMLPayload
message = Message(to_jid=recipient, stanza_type='chat', body='bold italic')
formatted = ElementTree.XML('''<html xmlns="http://jabber.org/protocol/xhtml-im">
<body xmlns="http://www.w3.org/1999/xhtml">
<p>
<span style="font-weight: bold;" >bold <em>italic</em>
</span>
</p>
</body>
</html>''')
message.add_payload(XMLPayload(formatted)) Dedicated support for XHTML-IM may be added to PyXMPP2 some day, but it is not high priority (much more important things are still missing). |
Hi! I am having a similar issue here, but on the other way. |
@wschoenell How dos it mess with the message parser? Any XMPP message must be a well-formed XML element and as such is available through the PyXMPP2 API without any data loss. |
Hi... I'm sorry... I was using the wrong jabber list to do the tests. The one that I was using had a malformed XML stream. |
I have tried to send a message containing bold text. Unfortunaly the API does not allow to pass html tags unmodified.
A Jabber message with format looks this:
The text was updated successfully, but these errors were encountered: