0.9.7claws43
authorLuke Plant <L.Plant.98@cantab.net>
Mon, 15 Dec 2003 21:00:59 +0000 (21:00 +0000)
committerLuke Plant <L.Plant.98@cantab.net>
Mon, 15 Dec 2003 21:00:59 +0000 (21:00 +0000)
use "name" parameter if "filename" doesn't exist

src/mimeview.c
src/textview.c

index 7a89249..9fd1f20 100644 (file)
@@ -532,6 +532,8 @@ static MimeViewer *get_viewer_for_mimeinfo(MimeView *mimeview, MimeInfo *partinf
                const gchar *filename;
 
                filename = procmime_mimeinfo_get_parameter(partinfo, "filename");
+               if (filename == NULL)
+                       filename = procmime_mimeinfo_get_parameter(partinfo, "name");
                if (filename != NULL)
                        content_type = procmime_get_mime_type(filename);
        } else {
index 0e5cc0a..774c617 100644 (file)
@@ -411,6 +411,7 @@ static void textview_add_part(TextView *textview, MimeInfo *mimeinfo)
        gchar buf[BUFFSIZE];
        const gchar *charset = NULL;
        GPtrArray *headers = NULL;
+       const gchar *name;
 
        g_return_if_fail(mimeinfo != NULL);
 
@@ -436,9 +437,12 @@ static void textview_add_part(TextView *textview, MimeInfo *mimeinfo)
 
        gtk_stext_freeze(text);
 
-       if (g_hash_table_lookup(mimeinfo->parameters, "filename") != NULL)
+       name = procmime_mimeinfo_get_parameter(mimeinfo, "filename");
+       if (name == NULL)
+               name = procmime_mimeinfo_get_parameter(mimeinfo, "name");
+       if (name != NULL)
                g_snprintf(buf, sizeof(buf), "\n[%s  %s/%s (%d bytes)]\n",
-                          (gchar *) g_hash_table_lookup(mimeinfo->parameters, "filename"),
+                          name,
                           procmime_get_type_str(mimeinfo->type),
                           mimeinfo->subtype, mimeinfo->length);
        else