save_all fixes
authorThorsten Maerz <torte@netztorte.de>
Mon, 5 Aug 2002 22:46:46 +0000 (22:46 +0000)
committerThorsten Maerz <torte@netztorte.de>
Mon, 5 Aug 2002 22:46:46 +0000 (22:46 +0000)
ChangeLog.claws
configure.in
src/mimeview.c

index 28f6152..daf192f 100644 (file)
@@ -1,3 +1,9 @@
+2002-08-06 [thorsten]  0.8.0claws18
+
+       * src/mimeview.c
+               attach_all: save unnamed as "noname.%d",
+               dont free static dirname
+
 2002-08-05 [alfons]    0.8.1claws17
 
        * configure.in
index b27619b..a367075 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=8
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws17
+EXTRA_VERSION=claws18
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index f8f42b9..954ece0 100644 (file)
@@ -815,36 +815,36 @@ static void mimeview_save_all(MimeView *mimeview)
        /* for each attachment, extract it in the selected dir. */
        while(attachment != NULL)
        {
-               if(attachment->filename) {
-                       gchar *attachdir;
-                       gchar *attachname = g_strdup(attachment->filename);
-
-                       subst_chars(attachname, "/\\", G_DIR_SEPARATOR);
-                       subst_chars(attachname, ":?*&|<>\t\r\n", '_');
-                       g_snprintf(buf, sizeof(buf), "%s%s",
-                                  dirname,
-                                  (attachname[0] == G_DIR_SEPARATOR)
-                                  ? &attachname[1]
-                                  : attachname);
-                       attachdir = g_dirname(buf);
-                       make_dir_hier(attachdir);
-                       g_free(attachdir);
-                       g_free(attachname);
-
-                       if (is_file_exist(buf)) {
-                               AlertValue aval;
-
-                               aval = alertpanel(_("Overwrite"),
-                                                 _("Overwrite existing file?"),
-                                                 _("OK"), _("Cancel"), NULL);
-                               if (G_ALERTDEFAULT != aval) return;
-                       }
-                       if (procmime_get_part(buf, mimeview->file, attachment) < 0)
-                               alertpanel_error(_("Can't save the part of multipart message."));
+               static guint subst_cnt = 1;
+               gchar *attachdir;
+               gchar *attachname = (attachment->filename)
+                       ? g_strdup(attachment->filename)
+                       : g_strdup_printf("noname.%d",subst_cnt++);
+
+               subst_chars(attachname, "/\\", G_DIR_SEPARATOR);
+               subst_chars(attachname, ":?*&|<>\t\r\n", '_');
+               g_snprintf(buf, sizeof(buf), "%s%s",
+                          dirname,
+                          (attachname[0] == G_DIR_SEPARATOR)
+                          ? &attachname[1]
+                          : attachname);
+               attachdir = g_dirname(buf);
+               make_dir_hier(attachdir);
+               g_free(attachdir);
+               g_free(attachname);
+
+               if (is_file_exist(buf)) {
+                       AlertValue aval;
+
+                       aval = alertpanel(_("Overwrite"),
+                                         _("Overwrite existing file?"),
+                                         _("OK"), _("Cancel"), NULL);
+                       if (G_ALERTDEFAULT != aval) return;
                }
+               if (procmime_get_part(buf, mimeview->file, attachment) < 0)
+                       alertpanel_error(_("Can't save the part of multipart message."));
                attachment = attachment->next;
        }
-       g_free(dirname);
 }
 
 static void mimeview_display_as_text(MimeView *mimeview)