Re: Custom headers RFE WAS: Re: [Evolution] RFE: ability to add headers to "standard" display.
- From: Ian Goldberg <ian cypherpunks ca>
- To: evolution ximian com
- Subject: Re: Custom headers RFE WAS: Re: [Evolution] RFE: ability to add headers to "standard" display.
- Date: 22 Apr 2002 21:24:09 -0400
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:
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]