<<< Date Index >>>     <<< Thread Index >>>

[FEATURE][PATCH] disposition filename



hi,

i just had to mail an attachment with a special filename set. after i
had a look at the source code i was quite sure there is no way in mutt
to set the disposition filename of an attachment.

so one would have to rename/copy the file manually to the desired filename,
attach it to the mail message, and maybe rename it back.

this sucks.

i wrote a patch agains 1.4.1 that adds a OP_COMPOSE_EDIT_DFILENAME that
allows to change the body->d_filename member.

there are few minor drawbacks:

- i did not update any documentation.
- the disposition filename is not shown on compose screen
- the command-name "edit-disposition-filename" is too long to fit in the
  help screen.
- no checks are performed whether content->disposition is DISPATTACH

and another one:

postpone.c:577: b->d_filename = safe_strdup (b->filename);
sendlib.c:1126: a->d_filename = a->filename;
sendlib.c:1172: a->d_filename = a->filename;

i don't know that source very well, but i think these 3 lines should be
replaced with some code that does not throw away reference to
potential allocated d_filename-strings. (mutt_str_replace?)

regards,
th

PS: i'm not subscribed to the devel-list please send direct answers.
-- 
Tobias Hintze http://hbs-solutions.de
HBS solutions GbR - Network & Information Systems
diff -Naur mutt-1.4.1/OPS mutt-1.4.1-changed/OPS
--- mutt-1.4.1/OPS      2002-04-25 15:26:56.000000000 +0200
+++ mutt-1.4.1-changed/OPS      2003-11-28 16:26:27.000000000 +0100
@@ -17,6 +17,7 @@
 OP_COMPOSE_EDIT_BCC "edit the BCC list"
 OP_COMPOSE_EDIT_CC "edit the CC list"
 OP_COMPOSE_EDIT_DESCRIPTION "edit attachment description"
+OP_COMPOSE_EDIT_DFILENAME "edit attachment disposition filename"
 OP_COMPOSE_EDIT_ENCODING "edit attachment transfer-encoding"
 OP_COMPOSE_EDIT_FCC "enter a file to save a copy of this message in"
 OP_COMPOSE_EDIT_FILE "edit the file to be attached"
diff -Naur mutt-1.4.1/compose.c mutt-1.4.1-changed/compose.c
--- mutt-1.4.1/compose.c        2002-07-24 10:41:29.000000000 +0200
+++ mutt-1.4.1-changed/compose.c        2003-11-28 16:00:21.000000000 +0100
@@ -853,6 +853,20 @@
        }
        break;
 
+      case OP_COMPOSE_EDIT_DFILENAME:
+         /* change the disposition-filename*/
+       CHECK_COUNT;
+       strfcpy (buf,
+                idx[menu->current]->content->d_filename ?
+                idx[menu->current]->content->d_filename : "",
+                sizeof (buf));
+       if (mutt_get_field ("Disposition-filename: ", buf, sizeof (buf), 0) == 
0)
+       {
+         mutt_str_replace (&idx[menu->current]->content->d_filename, buf);
+         menu->redraw = REDRAW_CURRENT;
+       }
+       break;
+
       case OP_COMPOSE_UPDATE_ENCODING:
         CHECK_COUNT;
         if (menu->tagprefix)
diff -Naur mutt-1.4.1/functions.h mutt-1.4.1-changed/functions.h
--- mutt-1.4.1/functions.h      2001-09-11 13:20:34.000000000 +0200
+++ mutt-1.4.1-changed/functions.h      2003-11-28 16:49:54.000000000 +0100
@@ -282,6 +282,7 @@
   { "detach-file",     OP_DELETE,                      "D" },
   { "toggle-disposition",OP_COMPOSE_TOGGLE_DISPOSITION,        "\004" },
   { "edit-description",        OP_COMPOSE_EDIT_DESCRIPTION,    "d" },
+  { "edit-disposition-filename", OP_COMPOSE_EDIT_DFILENAME,    "\030f" },
   { "edit-message",    OP_COMPOSE_EDIT_MESSAGE,        "e" },
   { "edit-headers",    OP_COMPOSE_EDIT_HEADERS,        "E" },
   { "edit-file",       OP_COMPOSE_EDIT_FILE,           "\030e" },