On Tue, 2002-04-23 at 10:54, Ian Goldberg wrote:
> On Mon, 2002-04-22 at 20:27, Jeffrey Stedfast wrote:
> > it will severely increase the complexity of the display code, and it's
> > already nasty enough as it is without adding to it.
>
> The complexity of the display code? Sure, the *UI* part usually adds a
> lot of code, but this is the only change to the display part:
This patch wouldn't make it (even if you had the gui part, which is of
course the hardest part), because as you say, its just a cut and paste.
i.e. you doubled the amount of code to maintain without adding any more
functional code.
The code should be made to be more generic and always use a list of
headers or all headers, and have some clean gui to control it (i.e. you
dont always ask the user what headers they want, but you implement it
asif they did).
> diff -u -r1.219 mail-format.c
> --- mail/mail-format.c 2002/01/21 21:58:07 1.219
> +++ mail/mail-format.c 2002/01/26 14:59:05
> @@ -1018,8 +1018,40 @@
> header = header->next;
> }
> } else {
> + struct _header_raw *header;
> + const char *charset;
> + CamelContentType *ct;
> + char *value;
> + const GSList *extra_headers = mail_config_get_extra_headers();
> +
> + /* First write the default headers */
> for (i=0;i<sizeof(default_headers)/sizeof(default_headers[0]);i++)
> write_default_header(message, md, html, stream, i, 0);
> +
> + /* Now write any additional headers that were specified. */
> + ct = camel_mime_part_get_content_type
> + (CAMEL_MIME_PART (message));
> + charset = header_content_type_param (ct, "charset");
> + charset = e_iconv_charset_name (charset);
> +
> + header = CAMEL_MIME_PART (message)->headers;
> + while (header) {
> + const GSList *eh_node = extra_headers;
> + while (eh_node) {
> + const gchar *x_header = eh_node->data;
> + if (!g_strcasecmp (x_header, header->name)) {
> + value = header_decode_string
> + (header->value, charset);
> + write_text_header
> + (header->name, value,
> + WRITE_BOLD, html, stream);
> + g_free(value);
> + break;
> + }
> + eh_node = eh_node->next;
> + }
> + header = header->next;
> + }
> }
>
> mail_html_write (html, stream,
>
>
>
> And pretty much all of that logic is cut/paste from a paragraph or two
> earlier in the code (so it could probably be factored out). There's
> just a GSList of strings corresponding to which extra headers to display
> in the "Normal Display" (the patch lets you create this list using a UI
> widget in "Mail Settings" -> "Display"). Then after it writes all the
> default headers in the normal way, it iterates through the header list
> in the message, and if the header matches one of the selected headers in
> the GSList, it displays that one, too. It's a linear search, but I
> assume you're not listing thousands of extra headers to display.
>
> - Ian
>
> _______________________________________________
> evolution maillist - [EMAIL PROTECTED]
> http://lists.ximian.com/mailman/listinfo/evolution
_______________________________________________
evolution maillist - [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/evolution