From 9a864d05fef7e45c251048bebaadbfd5e07d5ac7 Mon Sep 17 00:00:00 2001 From: 4 Date: Mon, 24 Sep 2001 19:31:36 +0000 Subject: Removed unused variables. 2001-09-24 * mail-local.c (mls_get_folder): Removed unused variables. * component-factory.c (storage_create_folder): Remove unused variable. * mail-format.c (write_default_header): Used to write a header that we know about/normally print. Use a static header table to index these. (write_header): removed. (default_header_index): Return the index of the default header. (write_headers): Changed the way it writes headers a bit. Use write_default_header or write_text_header directly. Also try and use the header charset as a fallback if the header can't be decoded using the locale charset. svn path=/trunk/; revision=13097 --- mail/ChangeLog | 17 ++++++++ mail/component-factory.c | 2 +- mail/mail-format.c | 101 +++++++++++++++++++++++++++++------------------ mail/mail-local.c | 3 -- 4 files changed, 81 insertions(+), 42 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index b5ae53f23d..b61e1d97d6 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,20 @@ +2001-09-24 + + * mail-local.c (mls_get_folder): Removed unused variables. + + * component-factory.c (storage_create_folder): Remove unused + variable. + + * mail-format.c (write_default_header): Used to write a header + that we know about/normally print. Use a static header table to + index these. + (write_header): removed. + (default_header_index): Return the index of the default header. + (write_headers): Changed the way it writes headers a bit. Use + write_default_header or write_text_header directly. Also try and + use the header charset as a fallback if the header can't be + decoded using the locale charset. + 2001-09-23 Jeffrey Stedfast * mail-mt.c (pass_got): Always cache POP and IMAP passwords, even diff --git a/mail/component-factory.c b/mail/component-factory.c index 812225841b..87f4fadbc2 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -856,7 +856,7 @@ storage_create_folder (EvolutionStorage *storage, { CamelStore *store = user_data; CamelFolderInfo *root, *fi; - char *prefix, *name; + char *name; CamelURL *url; CamelException ex; diff --git a/mail/mail-format.c b/mail/mail-format.c index 480a3fbcdc..b1e3f9b5d1 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -872,30 +872,53 @@ write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *fi mail_html_write (md->html, md->stream, ""); } +/* order of these must match write_header code */ +static char *default_headers[] = { + "From", "Reply-To", "To", "Cc", "Subject", "Date", +}; + +/* return index of header in default_headers array */ +static int +default_header_index(const char *name) +{ + int i; + for (i=0;ihtml, md->stream); - } else if (!g_strcasecmp (name, "Date")) { + break; + case 5: write_date (message, flags | WRITE_BOLD, md->html, md->stream); - } else - write_text_header (name, value, flags, md->html, md->stream); + break; + default: + g_assert_not_reached(); + } } #define COLOR_IS_LIGHT(r, g, b) ((r + g + b) > (128 * 3)) @@ -904,16 +927,10 @@ static void write_headers (CamelMimeMessage *message, MailDisplay *md) { gboolean full = (md->display_style == MAIL_CONFIG_DISPLAY_FULL_HEADERS); - CamelMediumHeader *headers, default_headers[] = { - { "From", NULL }, { "Reply-To", NULL }, - { "To", NULL }, { "Cc" , NULL }, { "Subject", NULL }, - { "Date", NULL } - }; char bgcolor[7], fontcolor[7]; GtkStyle *style = NULL; - int i, len, flags; - GArray *gheaders; - + int i; + /* My favorite thing to do...much around with colors so we respect people's stupid themes */ style = gtk_widget_get_style (GTK_WIDGET (md->html)); if (style) { @@ -958,23 +975,31 @@ write_headers (CamelMimeMessage *message, MailDisplay *md) "\n", fontcolor, bgcolor); if (full) { - gheaders = camel_medium_get_headers (CAMEL_MEDIUM (message)); - headers = (CamelMediumHeader *)gheaders->data; - len = gheaders->len; - flags = WRITE_NOCOLUMNS; + struct _header_raw *header; + const char *charset; + CamelContentType *ct; + char *value; + + ct = camel_mime_part_get_content_type(CAMEL_MIME_PART(message)); + charset = header_content_type_param(ct, "charset"); + charset = camel_charset_to_iconv(charset); + + header = CAMEL_MIME_PART(message)->headers; + while (header) { + i = default_header_index(header->name); + if (i == -1) { + value = header_decode_string(header->value, charset); + write_text_header(header->name, value, WRITE_NOCOLUMNS, md->html, md->stream); + g_free(value); + } else + write_default_header(message, md, i, WRITE_NOCOLUMNS); + header = header->next; + } } else { - gheaders = NULL; - headers = default_headers; - len = sizeof (default_headers) / sizeof (default_headers[0]); - flags = 0; + for (i=0;ihtml, md->stream, "
" "
" diff --git a/mail/mail-local.c b/mail/mail-local.c index d3541d24a9..710a016d91 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -654,9 +654,6 @@ mls_get_folder(CamelStore *store, const char *folder_name, guint32 flags, CamelE { MailLocalStore *local_store = MAIL_LOCAL_STORE (store); MailLocalFolder *folder; - char *physical_uri; - CamelFolderInfo *info; - char *path = NULL; d(printf("--LOCAL-- get_folder: %s\n", folder_name)); -- cgit