+ case OP_COMPOSE_EDIT_X_COMMENT_TO:
+ if (news && option (OPTXCOMMENTTO)) {
+ buf[0] = 0;
+ if (msg->env->x_comment_to)
+ strfcpy (buf, msg->env->x_comment_to, sizeof (buf));
+ if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0
+ && buf[0]) {
+ mem_free (&msg->env->x_comment_to);
+ msg->env->x_comment_to = str_dup (buf);
+ move (HDR_BCC, HDR_XOFFSET);
+ clrtoeol ();
+ if (msg->env->x_comment_to)
+ printw ("%-*.*s", W, W, msg->env->x_comment_to);
+ }
+ }
+ break;
+#endif
+ case OP_COMPOSE_EDIT_SUBJECT:
+ if (msg->env->subject)
+ strfcpy (buf, msg->env->subject, sizeof (buf));
+ else
+ buf[0] = 0;
+ if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) {
+ str_replace (&msg->env->subject, buf);
+ move (HDR_SUBJECT, HDR_XOFFSET + SW);
+ clrtoeol ();
+ if (msg->env->subject)
+ mutt_paddstr (W, msg->env->subject);
+ }
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+ case OP_COMPOSE_EDIT_REPLY_TO:
+ menu->redraw = edit_address_list (HDR_REPLYTO, &msg->env->reply_to);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+ case OP_COMPOSE_EDIT_FCC:
+ strfcpy (buf, fcc, sizeof (buf));
+ if (mutt_get_field ("Fcc: ", buf, sizeof (buf), M_FILE | M_CLEAR) == 0) {
+ strfcpy (fcc, buf, _POSIX_PATH_MAX);
+ mutt_pretty_mailbox (fcc);
+ move (HDR_FCC, HDR_XOFFSET + SW);
+ mutt_paddstr (W, fcc);
+ fccSet = 1;
+ }
+ MAYBE_REDRAW (menu->redraw);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+ case OP_COMPOSE_EDIT_MESSAGE:
+ if (Editor && (str_cmp ("builtin", Editor) != 0)
+ && !option (OPTEDITHDRS)) {
+ mutt_edit_file (Editor, msg->content->filename);
+ mutt_update_encoding (msg->content);
+ menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+ }
+ /* fall through */
+ case OP_COMPOSE_EDIT_HEADERS:
+ if (str_cmp ("builtin", Editor) != 0 &&
+ (op == OP_COMPOSE_EDIT_HEADERS ||
+ (op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS)))) {
+ char *tag = NULL, *err = NULL;
+
+ mutt_env_to_local (msg->env);
+ mutt_edit_headers (NONULL (Editor), msg->content->filename, msg,
+ fcc, fcclen);
+ if (mutt_env_to_idna (msg->env, &tag, &err)) {
+ mutt_error (_("Bad IDN in \"%s\": '%s'"), tag, err);
+ mem_free (&err);
+ }
+ }
+ else {
+ /* this is grouped with OP_COMPOSE_EDIT_HEADERS because the
+ attachment list could change if the user invokes ~v to edit
+ the message with headers, in which we need to execute the
+ code below to regenerate the index array */
+ mutt_builtin_editor (msg->content->filename, msg, cur);
+ }
+ mutt_update_encoding (msg->content);
+
+ /* attachments may have been added */
+ if (idxlen && idx[idxlen - 1]->content->next) {
+ for (i = 0; i < idxlen; i++)
+ mem_free (&idx[i]);
+ idxlen = 0;
+ idx =
+ mutt_gen_attach_list (msg->content, -1, idx, &idxlen, &idxmax, 0,
+ 1);
+ menu->data = idx;
+ menu->max = idxlen;
+ }
+
+ menu->redraw = REDRAW_FULL;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+
+
+
+ case OP_COMPOSE_ATTACH_KEY:
+ if (!(WithCrypto & APPLICATION_PGP))
+ break;
+ if (idxlen == idxmax) {
+ mem_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5));
+ menu->data = idx;
+ }
+
+ idx[idxlen] = (ATTACHPTR *) mem_calloc (1, sizeof (ATTACHPTR));
+ if ((idx[idxlen]->content =
+ crypt_pgp_make_key_attachment (NULL)) != NULL) {
+ update_idx (menu, idx, idxlen++);
+ menu->redraw |= REDRAW_INDEX;
+ }
+ else
+ mem_free (&idx[idxlen]);
+
+ menu->redraw |= REDRAW_STATUS;
+
+ if (option (OPTNEEDREDRAW)) {
+ menu->redraw = REDRAW_FULL;
+ unset_option (OPTNEEDREDRAW);
+ }