get attachment names
authorPaul Mangan <paul@claws-mail.org>
Wed, 29 Oct 2003 17:47:06 +0000 (17:47 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 29 Oct 2003 17:47:06 +0000 (17:47 +0000)
ChangeLog.claws
src/compose.c
src/mimeview.c

index 4e06c7e4c0ea400697cf291a703a702310398e28..b2843cef34748885ec793dad365b5f08820bd53b 100644 (file)
@@ -1,3 +1,12 @@
+2003-10-29 [paul]      0.9.6claws59
+
+       * src/compose.c
+               get name of attachment(s) when re-editing, fwd'ing or
+               redirecting
+               
+       * src/mimeview.c
+               get name of attachment(s) when saving
+
 2003-10-29 [hoa]       0.9.6claws58
 
        * src/textview.c
index 9c72d7f6e82f97d1309c72d226a23bb3c1fe650d..3755a636c13f04685256a3aafcca13902f07b5fc 100644 (file)
@@ -2181,6 +2181,7 @@ static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
        MimeInfo *child;
        gchar *infile;
        gchar *outfile;
+       const gchar *partname = NULL;
 
        mimeinfo = procmime_scan_message(msginfo);
        if (!mimeinfo) return;
@@ -2218,10 +2219,10 @@ static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
                        gchar *content_type;
 
                        content_type = g_strdup_printf("%s/%s", procmime_get_type_str(child->type), child->subtype);
-                       compose_attach_append
-                               (compose, outfile,
-                                child->filename ? child->filename : child->name,
-                                content_type);
+                       partname = procmime_mimeinfo_get_parameter(child, "name");
+                       
+                       compose_attach_append(compose, outfile, 
+                                             partname, content_type);
                        g_free(content_type);
                }
 
index cee0b88cc6fd5cf8c4ac30b72e2164daf6248567..d196550ec1e37ec697454d2a4f2d84f51a71ef81 100644 (file)
@@ -1004,11 +1004,15 @@ static void mimeview_save_as(MimeView *mimeview)
 {
        gchar *filename;
        gchar *defname = NULL;
+       MsgInfo *msginfo;
        MimeInfo *partinfo;
        gchar *res;
+       const gchar *partname = NULL;
 
        if (!mimeview->opened) return;
        if (!mimeview->file) return;
+       if (!mimeview->messageview->msginfo) return;
+       msginfo = mimeview->messageview->msginfo;
 
        partinfo = mimeview_get_selected_part(mimeview);
        if (!partinfo) { 
@@ -1019,14 +1023,15 @@ static void mimeview_save_as(MimeView *mimeview)
                                    "pop_partinfo", NULL);
        }                        
        g_return_if_fail(partinfo != NULL);
-
-       if (partinfo->filename)
-               defname = partinfo->filename;
-       else if (partinfo->name) {
-               Xstrdup_a(defname, partinfo->name, return);
+       
+       if (partname = procmime_mimeinfo_get_parameter(partinfo, "name")) {
+               Xstrdup_a(defname, partname, return);
+               subst_for_filename(defname);
+       } else if (msginfo->subject) {
+               Xstrdup_a(defname, msginfo->subject, return);
                subst_for_filename(defname);
        }
-
+       
        filename = filesel_select_file(_("Save as"), defname);
        if (!filename) return;
        if (is_file_exist(filename)) {