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_TO_SENDER "compose new message to the current message sender"
OP_COMPOSE_TOGGLE_DISPOSITION "toggle disposition between inline/attachment"
OP_COMPOSE_TOGGLE_UNLINK "toggle whether to delete file after sending it"
OP_COMPOSE_UPDATE_ENCODING "update an attachment's encoding info"
void mutt_attach_resend (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *);
void mutt_attach_forward (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *);
void mutt_attach_reply (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *, int);
+void mutt_attach_mail_sender (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *);
void mutt_actx_add_attach (ATTACH_CONTEXT *actx, ATTACHPTR *attach);
void mutt_actx_add_fp (ATTACH_CONTEXT *actx, FILE *new_fp);
ci_bounce_message (tag ? NULL : CURHDR);
break;
+ case OP_COMPOSE_TO_SENDER:
+
+ CHECK_ATTACH;
+ CHECK_MSGCOUNT;
+ CHECK_VISIBLE;
+ ci_send_message (SENDTOSENDER, NULL, NULL, Context, tag ? NULL : CURHDR);
+ menu->redraw = REDRAW_FULL;
+ break;
+
case OP_CREATE_ALIAS:
mutt_create_alias (Context && Context->vcount ? CURHDR->env : NULL, NULL);
{ "next-unread-mailbox", OP_MAIN_NEXT_UNREAD_MAILBOX, NULL },
{ "collapse-thread", OP_MAIN_COLLAPSE_THREAD, "\033v" },
{ "collapse-all", OP_MAIN_COLLAPSE_ALL, "\033V" },
+ { "compose-to-sender", OP_COMPOSE_TO_SENDER, NULL},
{ "copy-message", OP_COPY_MESSAGE, "C" },
{ "decode-copy", OP_DECODE_COPY, "\033C" },
{ "decode-save", OP_DECODE_SAVE, "\033s" },
{ "change-folder", OP_MAIN_CHANGE_FOLDER, "c" },
{ "change-folder-readonly", OP_MAIN_CHANGE_FOLDER_READONLY, "\033c" },
{ "next-unread-mailbox", OP_MAIN_NEXT_UNREAD_MAILBOX, NULL },
+ { "compose-to-sender", OP_COMPOSE_TO_SENDER, NULL},
{ "copy-message", OP_COPY_MESSAGE, "C" },
{ "decode-copy", OP_DECODE_COPY, "\033C" },
{ "delete-message", OP_DELETE, "d" },
const struct binding_t OpAttach[] = { /* map: attachment */
{ "bounce-message", OP_BOUNCE_MESSAGE, "b" },
{ "display-toggle-weed", OP_DISPLAY_HEADERS, "h" },
+ { "compose-to-sender", OP_COMPOSE_TO_SENDER, NULL},
{ "edit-type", OP_EDIT_TYPE, "\005" },
{ "print-entry", OP_PRINT, "p" },
{ "save-entry", OP_SAVE, "s" },
#define SENDPOSTPONEDFCC (1<<9) /* used by mutt_get_postponed() to signal that the x-mutt-fcc header field was present */
#define SENDNOFREEHEADER (1<<10) /* Used by the -E flag */
#define SENDDRAFTFILE (1<<11) /* Used by the -H flag */
+#define SENDTOSENDER (1<<12)
/* flags for mutt_compose_menu() */
#define MUTT_COMPOSE_NOFREEHEADER (1<<0)
rc = OP_CHECK_TRADITIONAL;
}
break;
-
+
+ case OP_COMPOSE_TO_SENDER:
+ CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
+ CHECK_ATTACH;
+ if (IsMsgAttach (extra))
+ mutt_attach_mail_sender (extra->fp, extra->hdr, extra->actx,
+ extra->bdy);
+ else
+ ci_send_message (SENDTOSENDER, NULL, NULL, extra->ctx, extra->hdr);
+ pager_menu->redraw = REDRAW_FULL;
+ break;
+
case OP_CREATE_ALIAS:
CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
if (IsMsgAttach (extra))
menu->redraw = REDRAW_FULL;
break;
+ case OP_COMPOSE_TO_SENDER:
+ CHECK_ATTACH;
+ mutt_attach_mail_sender (CURATTACH->fp, hdr, actx,
+ menu->tagprefix ? NULL : CURATTACH->content);
+ menu->redraw = REDRAW_FULL;
+ break;
+
case OP_REPLY:
case OP_GROUP_REPLY:
case OP_LIST_REPLY:
}
}
+void mutt_attach_mail_sender (FILE *fp, HEADER *hdr, ATTACH_CONTEXT *actx,
+ BODY *cur)
+{
+ HEADER *tmphdr = NULL;
+ short i;
+
+ if (check_all_msg (actx, cur, 0) == -1)
+ {
+ mutt_error _("You may only compose to sender with message/rfc822 parts.");
+ return;
+ }
+
+ tmphdr = mutt_new_header ();
+ tmphdr->env = mutt_new_envelope ();
+
+ if (cur)
+ {
+ if (mutt_fetch_recips (tmphdr->env, cur->hdr->env, SENDTOSENDER) == -1)
+ return;
+ }
+ else
+ {
+ for (i = 0; i < actx->idxlen; i++)
+ {
+ if (actx->idx[i]->content->tagged &&
+ mutt_fetch_recips (tmphdr->env, actx->idx[i]->content->hdr->env,
+ SENDTOSENDER) == -1)
+ return;
+ }
+ }
+ ci_send_message (0, tmphdr, NULL, NULL, NULL);
+}
\f
/**
default_to (&out->cc, in, flags & SENDLISTREPLY, hmfupto) == -1)
return (-1); /* abort */
}
+ else if (flags & SENDTOSENDER)
+ rfc822_append (&out->to, in->from, 0);
else
{
if (default_to (&out->to, in, flags & SENDGROUPREPLY, hmfupto) == -1)
else
curenv = cur->env;
- if (flags & SENDREPLY)
+ if (flags & (SENDREPLY|SENDTOSENDER))
{
if (tag)
{
return (-1);
}
- mutt_make_misc_reply_headers (env, ctx, cur, curenv);
- mutt_make_reference_headers (tag ? NULL : curenv, env, ctx);
+ if (flags & SENDREPLY)
+ {
+ mutt_make_misc_reply_headers (env, ctx, cur, curenv);
+ mutt_make_reference_headers (tag ? NULL : curenv, env, ctx);
+ }
}
else if (flags & SENDFORWARD)
mutt_make_forward_subject (env, ctx, cur);
if (! (flags & (SENDPOSTPONED|SENDRESEND)) &&
! ((flags & SENDDRAFTFILE) && option (OPTRESUMEDRAFTFILES)))
{
- if ((flags & (SENDREPLY | SENDFORWARD)) && ctx &&
+ if ((flags & (SENDREPLY | SENDFORWARD | SENDTOSENDER)) && ctx &&
envelope_defaults (msg->env, ctx, cur, flags) == -1)
goto cleanup;