Re: HTML document "attachment" icon



> This patch replaces the paper clip icon in the "attachment" column
> with a document icon for messages with "Content-Type" of "text/html".
> 
> libbalsa/message.c:
> 	libbalsa_message_has_attachment() now returns FALSE for
> 	both text/plain and text/html
> 
> 	libbalsa_message_is_html() added, returns TRUE for
> 	text/html, FALSE for all others
> 
> libbalsa/message.h:
> 	Added prototype for libbalsa_message_is_html().
> 
> src/balsa-icons.c, src/balsa-icons.h, src/pixmaps/html_doc.xpm:
> 	Create the new "html_doc" icon.
> 
> src/balsa-index.c:
> 	if libbalsa_message_has_attachment() returned FALSE (no
> 	paper clip icon will be used), call libbalsa_message_is_html()
> 	to see if an html_doc icon should be used.

Hmmm. I still think we need to do something like [from a patch I submitted
earlier]
	-    /* FIXME: Can be simplified into 1 if */
	-    if (msg_header->content->type != TYPETEXT) {
	+    switch(msg_header->content->type) {
	+    case TYPEMULTIPART:
	+	ret = (g_strcasecmp("alternative",
msg_header->content->subtype)!=0);
	+	break;
	+    case TYPETEXT:		/* *** Or always return FALSE 
*/
	+	ret = (g_strcasecmp("plain", msg_header->content->subtype)
!= 0 &&
	+	       g_strcasecmp("html", msg_header->content->subtype)
!= 0);
	+	break;
	+    default:
	+	ret=true

in libbalsa_message_has_attachment(). That's really a simplified approach,
too, as the individual parts in "mulipart/alternative" may have attachments
(I think). Also, strictly speaking, a message doesn't necessarily have
attachments even if it's "multipart/mixed" or similar, it does so only if
one
of the parts has "Content-Disposition: attachment". The problem is, that
information isn't necessarily available when adding the icons, and there
are MUAs that don't set these headers right - refer to previous discussion.

Also, perhaps you want to add the HTML icon when the message is
"multipart/alternative" and one of the parts is "text/html"? Or maybe not,
it might be that you want it only when no plain text version is available.
--
- Toralf




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