tcp.im hints

Untitled markpasc post:

Hint for Radio IM: deHTMLize an item with string.htmlToEmail.

A few hints and tips regarding coding and decoding in tcp.im:

Both AIM and Jabber have the ability to send HTML messages on the network, as do many of the other IM systems. (All that I know of can send formatted text, I don't know that they are all HTML as opposed to, say, RTF.) However, they are almost completely different. AIM sends half-assed, crappy HTML without close tags, inconsistent capatalization, etc. Jabber strictly requires compliant XHTML, or you'll ruin the whole connection.

The only solution I could find was to make tcp.im.send only send text; if you try to send HTML, it will actually encode it such that the receiver will see the HTML. Thus, tcp.im can't actually send HTML over the wire. However, the highly beneficial side-effect of this is that it is perfectly possible to reliably send HTML messages, as long as the user manually types the HTML, and that HTML need not be compliant with anything (even in Jabber), because the IM network just sees < (encoded entities). The blog poster and the manila poster both use this to their advantage. Work with this, not against this; do not try to use the IM system's HTML capabilities from within tcp.im.

You can use the drivers directly if you need to for some application.

The corresponding philosophy on the receiving end is to try to receive exactly what the user typed (except that whitespace may be altered by the transport, as AIM does), without any formatting.

This information will be particularly importent to anybody wanting to write a driver for a new IM network, but it will matter to tcp.im developers, so they know what they are getting and what they are not.

So, as markpasc suggest, string.htmlToEmail is a good way to convert any HTML you might want to send into pure text, which you can ship around however you like.

This post may later be altered to just point at the appropriate documentation.