RE: Email library/API



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

> So?  If you want that sort of functionality, there is nothing you
can
> do.

Well, you have two choices, you either display the text/plain part of
the message and just leave the html/rtf part as an attachment or you
convert everything to HTML before you display it and this brings other
advantages - e.g. if someone sends you an ascii mail with a picture
attached, you convert the text to html before displaying it and then
you can trivially display the picture attachment inline.
Converting ascii to html is a particularly easy operation if you make
use of the HTML tag "<pre>" as you don't have to worry about
formatting. The function that my mailer uses to convert text to html
is below.

/*
   text_to_html - Convert ASCII text to HTML "on-the-fly"
  
  	INPUTS:
			*html_text		-	Destination for HTML source (must be malloc()'d to
correct length first)
			*text			-	ASCII text to be converted
  	RETURNS:
*/
void text_to_html( gchar *html_text, gchar *text )
{
	gchar *src = text;
	gchar *dst = html_text;
	*html_text = 0;

	while( *src ) {
		switch( *src ) {
			case '<':
					strcpy( dst, "&lt;" );
					dst += 4;
					break;
			break;
			case '&':
				strcpy( dst, "&amp;" );
				dst += 5;
			break;
			default:
				*dst++ = *src;
			break;
		}
		src++;
	}
	strcpy( dst, "\0" );
	return;
}

> If someone sends you an Adobe Premiere film, and you want to see it
> online, you will need to load Premiere, I really do not see any
other
> way of doing it.

Strange example - if someone sends you a file created in some
application you are going to have to wait while the application loads,
but it is annoying when you have to wait for your mail client to load
a bunch of modules just so it can show you a mail that someone using
lame Microsoft programs sent as HTML or RTF.

- ---
 _____ _         _       _____
| __  | |___ ___| |_ ___|   __|_ _ ___        Chris "Ng" Jones
| __ -| | .'|  _| '_|___|__   | | |   |  chris@black-sun.co.uk
|_____|_|__,|___|_,_|   |_____|___|_|_|    www.black-sun.co.uk
            S o f t w a r e

 "Linux is beating Windows" - David Cole, Microsoft Executive

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.5.3i for non-commercial use <http://www.pgpi.com>

iQA/AwUBOClnQJhmBipjerS3EQLkwQCgyJr9pOszLZWJYnGWhEKWh0tQ2NkAnAif
CTuIIimhMd6hXdZI1Y3MpMiD
=0feE
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]