---
OPS | 1 +
compose.c | 27 ++++++++++++++++++++++++++-
functions.h | 1 +
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/OPS b/OPS
index ed15b49..8bad616 100644
--- a/OPS
+++ b/OPS
@@ -36,6 +36,7 @@ OP_COMPOSE_ISPELL "run ispell on the message"
OP_COMPOSE_NEW_MIME "compose new attachment using mailcap entry"
OP_COMPOSE_TOGGLE_RECODE "toggle recoding of this attachment"
OP_COMPOSE_POSTPONE_MESSAGE "save this message to send later"
+OP_COMPOSE_RENAME_ATTACHMENT "send attachment with a different name"
OP_COMPOSE_RENAME_FILE "rename/move an attached file"
OP_COMPOSE_SEND_MESSAGE "send the message"
OP_COMPOSE_TOGGLE_DISPOSITION "toggle disposition between inline/attachment"
diff --git a/compose.c b/compose.c
index b4d0c41..aa59506 100644
--- a/compose.c
+++ b/compose.c
@@ -1019,7 +1019,32 @@ int mutt_compose_menu (HEADER *msg, /* structure for
new message */
/* No send2hook since this doesn't change the message. */
break;
-
+
+ case OP_COMPOSE_RENAME_ATTACHMENT:
+ {
+ char *src;
+ int ret;
+
+ CHECK_COUNT;
+ if (idx[menu->current]->content->d_filename)
+ src = idx[menu->current]->content->d_filename;
+ else
+ src = idx[menu->current]->content->filename;
+ strfcpy (fname, mutt_basename (NONULL (src)), sizeof (fname));
+ ret = mutt_get_field (_("Send attachment with name: "),
+ fname, sizeof (fname), MUTT_FILE);
+ if (ret == 0)
+ {
+ /*
+ * As opposed to RENAME_FILE, we don't check fname[0] because it's
+ * valid to set an empty string here, to erase what was set
+ */
+ mutt_str_replace (&idx[menu->current]->content->d_filename, fname);
+ menu->redraw = REDRAW_CURRENT;
+ }
+ }
+ break;
+
case OP_COMPOSE_RENAME_FILE:
CHECK_COUNT;
strfcpy (fname, idx[menu->current]->content->filename, sizeof (fname));
diff --git a/functions.h b/functions.h
index 4f04251..a0a09d0 100644
--- a/functions.h
+++ b/functions.h
@@ -350,6 +350,7 @@ const struct binding_t OpCompose[] = { /* map: compose */
{ "new-mime", OP_COMPOSE_NEW_MIME, "n" },
{ "postpone-message", OP_COMPOSE_POSTPONE_MESSAGE, "P" },
{ "edit-reply-to", OP_COMPOSE_EDIT_REPLY_TO, "r" },
+ { "rename-attachment",OP_COMPOSE_RENAME_ATTACHMENT, "\017" },
{ "rename-file", OP_COMPOSE_RENAME_FILE, "R" },
{ "edit-subject", OP_COMPOSE_EDIT_SUBJECT, "s" },
{ "edit-to", OP_COMPOSE_EDIT_TO, "t" },
--
2.10.0