do not use description as attachment name
[claws.git] / src / procmime.c
index 0e98c97fc04703cae2f131069a4d3f4deb136c4e..e7945a744318b4ad8488e999055fb6b2847899e8 100644 (file)
@@ -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
@@ -32,8 +32,9 @@
 #include "intl.h"
 #include "procmime.h"
 #include "procheader.h"
-#include "common/base64.h"
-#include "common/uuencode.h"
+#include "base64.h"
+#include "quoted-printable.h"
+#include "uuencode.h"
 #include "unmime.h"
 #include "html.h"
 #include "enriched.h"
@@ -45,7 +46,7 @@
 #  include "rfc2015.h"
 #endif
 
-#include "prefs.h"
+#include "prefs_gtk.h"
 
 static GHashTable *procmime_get_mime_type_table        (void);
 
@@ -481,12 +482,10 @@ void procmime_scan_content_description(MimeInfo *mimeinfo,
        blen = strlen(buf) + 1;
        Xalloca(tmp, blen, return);
        conv_unmime_header(tmp, blen, buf, NULL);
-       g_free(mimeinfo->name);
-       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);
+               mimeinfo->description = g_strdup(tmp);
 }
 
 void procmime_scan_subject(MimeInfo *mimeinfo,
@@ -611,7 +610,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) {
@@ -778,7 +777,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;
        }
@@ -792,8 +791,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;
        }
 }
@@ -903,7 +902,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);
@@ -1237,10 +1236,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)