X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=blobdiff_plain;f=src%2Fprocmime.c;h=97585cc3c1128c678225241330a30a78f8be88bf;hp=7c07a70dc187c53b1d025ba17fb149587bf89426;hb=99a7382d8fc0b91c98475ec8c92c9a86975accc7;hpb=239f8bb0a79484881dfc12f67f2006bcbc7f5023 diff --git a/src/procmime.c b/src/procmime.c index 7c07a70dc..97585cc3c 100644 --- a/src/procmime.c +++ b/src/procmime.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2002 Hiroyuki Yamamoto + * Copyright (C) 1999-2003 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +33,7 @@ #include "procmime.h" #include "procheader.h" #include "base64.h" +#include "quoted-printable.h" #include "uuencode.h" #include "unmime.h" #include "html.h" @@ -45,7 +46,7 @@ # include "rfc2015.h" #endif -#include "prefs.h" +#include "prefs_gtk.h" static GHashTable *procmime_get_mime_type_table (void); @@ -60,28 +61,6 @@ MimeInfo *procmime_mimeinfo_new(void) return mimeinfo; } -void procmime_mimeinfo_free(MimeInfo *mimeinfo) -{ - if (!mimeinfo) return; - - g_free(mimeinfo->encoding); - g_free(mimeinfo->content_type); - g_free(mimeinfo->charset); - g_free(mimeinfo->name); - g_free(mimeinfo->boundary); - g_free(mimeinfo->content_disposition); - g_free(mimeinfo->filename); -#if USE_GPGME - g_free(mimeinfo->plaintextfile); - g_free(mimeinfo->sigstatus); - g_free(mimeinfo->sigstatus_full); -#endif - - procmime_mimeinfo_free(mimeinfo->sub); - - g_free(mimeinfo); -} - void procmime_mimeinfo_free_all(MimeInfo *mimeinfo) { while (mimeinfo != NULL) { @@ -403,7 +382,10 @@ void procmime_scan_content_type(MimeInfo *mimeinfo, const gchar *content_type) Xalloca(tmp, len, return); conv_unmime_header(tmp, len, value, NULL); g_free(mimeinfo->name); - mimeinfo->name = g_strdup(tmp); + /*pgp signatures should NOT have a name */ + if (mimeinfo->content_type + && strcasecmp(mimeinfo->content_type, "application/pgp-signature")) + mimeinfo->name = g_strdup(tmp); } else if (!strcasecmp(attr, "boundary")) mimeinfo->boundary = g_strdup(value); } @@ -467,7 +449,10 @@ void procmime_scan_content_disposition(MimeInfo *mimeinfo, Xalloca(tmp, len, return); conv_unmime_header(tmp, len, value, NULL); g_free(mimeinfo->filename); - mimeinfo->filename = g_strdup(tmp); + /*pgp signatures should NOT have a name */ + if (mimeinfo->content_type + && strcasecmp(mimeinfo->content_type, "application/pgp-signature")) + mimeinfo->filename = g_strdup(tmp); break; } } @@ -498,7 +483,11 @@ void procmime_scan_content_description(MimeInfo *mimeinfo, Xalloca(tmp, blen, return); conv_unmime_header(tmp, blen, buf, NULL); g_free(mimeinfo->name); - mimeinfo->name = g_strdup(tmp); + mimeinfo->name = NULL; + /*pgp signatures should NOT have a name */ + if (mimeinfo->content_type + && strcasecmp(mimeinfo->content_type, "application/pgp-signature")) + mimeinfo->name = g_strdup(tmp); } void procmime_scan_subject(MimeInfo *mimeinfo, @@ -623,7 +612,7 @@ FILE *procmime_decode_content(FILE *outfp, FILE *infp, MimeInfo *mimeinfo) (!boundary || !IS_BOUNDARY(buf, boundary, boundary_len))) { gint len; - len = unmime_quoted_printable_line(buf); + len = qp_decode_line(buf); fwrite(buf, len, 1, outfp); } } else if (mimeinfo->encoding_type == ENC_BASE64) { @@ -790,7 +779,7 @@ void renderer_write_config(void) rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, RENDERER_RC, NULL); if ((pfile = prefs_write_open(rcpath)) == NULL) { - g_warning(_("failed to write configuration to file\n")); + g_warning("failed to write configuration to file\n"); g_free(rcpath); return; } @@ -804,8 +793,8 @@ void renderer_write_config(void) renderer->renderer); } - if (prefs_write_close(pfile) < 0) { - g_warning(_("failed to write configuration to file\n")); + if (prefs_file_close(pfile) < 0) { + g_warning("failed to write configuration to file\n"); return; } } @@ -915,7 +904,7 @@ FILE *procmime_get_text_content(MimeInfo *mimeinfo, FILE *infp) } if (conv_fail) - g_warning(_("procmime_get_text_content(): Code conversion failed.\n")); + g_warning("procmime_get_text_content(): Code conversion failed.\n"); fclose(tmpfp); rewind(outfp); @@ -1249,10 +1238,14 @@ EncodingType procmime_get_encoding_for_charset(const gchar *charset) else if (!strncasecmp(charset, "ISO-2022-", 9) || !strcasecmp(charset, "US-ASCII")) return ENC_7BIT; + else if (!strcasecmp(charset, "ISO-8859-5") || + !strncasecmp(charset, "KOI8-", 5) || + !strcasecmp(charset, "Windows-1251")) + return ENC_8BIT; + else if (!strncasecmp(charset, "ISO-8859-", 9)) + return ENC_QUOTED_PRINTABLE; else return ENC_8BIT; - /* return ENC_BASE64; */ - /* return ENC_QUOTED_PRINTABLE; */ } EncodingType procmime_get_encoding_for_file(const gchar *file)