- 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)
- {
- mutt_str_replace (&msg->env->subject, buf);
- move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth);
- clrtoeol ();
- if (msg->env->subject)
- mutt_paddstr (W, msg->env->subject);
- }
- break;
- case OP_COMPOSE_EDIT_REPLY_TO:
- menu->redraw = edit_address_list (HDR_REPLYTO, &msg->env->reply_to);
- 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 + SidebarWidth);
- mutt_paddstr (W, fcc);
- fccSet = 1;
- }
- MAYBE_REDRAW (menu->redraw);
- break;
- case OP_COMPOSE_EDIT_MESSAGE:
- if (Editor && (mutt_strcmp ("builtin", Editor) != 0) && !option (OPTEDITHDRS))
- {
- mutt_edit_file (Editor, msg->content->filename);
- mutt_update_encoding (msg->content);
- menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
- break;
- }
- /* fall through */
- case OP_COMPOSE_EDIT_HEADERS:
- if (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);
- 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++)
- 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;
- break;
-
-
-
- case OP_COMPOSE_ATTACH_KEY:
- if (!(WithCrypto & APPLICATION_PGP))
- break;
- if (idxlen == idxmax)
- {
- safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5));
- menu->data = idx;
- }
-
- idx[idxlen] = (ATTACHPTR *) safe_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
- FREE (&idx[idxlen]);
-
- menu->redraw |= REDRAW_STATUS;
-
- if (option(OPTNEEDREDRAW))
- {
- menu->redraw = REDRAW_FULL;
- unset_option(OPTNEEDREDRAW);
- }
-
- break;
-
-
- case OP_COMPOSE_ATTACH_FILE:
- {
- char *prompt, **files;
- int error, numfiles;
-
- fname[0] = 0;
- prompt = _("Attach file");
- numfiles = 0;
- files = NULL;
-
- if (_mutt_enter_fname (prompt, fname, sizeof (fname), &menu->redraw, 0, 1, &files, &numfiles) == -1 ||
- *fname == '\0')
- break;
-
- if (idxlen + numfiles >= idxmax)
- {
- safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5 + numfiles));
- menu->data = idx;
- }
-
- error = 0;
- if (numfiles > 1)
- mutt_message _("Attaching selected files...");
- for (i = 0; i < numfiles; i++)
- {
- char *att = files[i];
- idx[idxlen] = (ATTACHPTR *) safe_calloc (1, sizeof (ATTACHPTR));
- idx[idxlen]->content = mutt_make_file_attach (att);
- if (idx[idxlen]->content != NULL)
- update_idx (menu, idx, idxlen++);
- else
- {
- error = 1;
- mutt_error (_("Unable to attach %s!"), att);
- FREE (&idx[idxlen]);
- }
- }
-
- FREE (&files);
- if (!error) mutt_clear_error ();
-
- menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
- }
- break;
-
- case OP_COMPOSE_ATTACH_MESSAGE:
+ 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 + SidebarWidth);
+ 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 + SidebarWidth);
+ 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);
+ }
+
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+
+
+ case OP_COMPOSE_ATTACH_FILE:
+ {
+ char *prompt, **files;
+ int error, numfiles;
+
+ fname[0] = 0;
+ prompt = _("Attach file");
+ numfiles = 0;
+ files = NULL;
+
+ if (_mutt_enter_fname
+ (prompt, fname, sizeof (fname), &menu->redraw, 0, 1, &files,
+ &numfiles) == -1 || *fname == '\0')
+ break;
+
+ if (idxlen + numfiles >= idxmax) {
+ mem_realloc (&idx,
+ sizeof (ATTACHPTR *) * (idxmax += 5 + numfiles));
+ menu->data = idx;
+ }
+
+ error = 0;
+ if (numfiles > 1)
+ mutt_message _("Attaching selected files...");
+
+ for (i = 0; i < numfiles; i++) {
+ char *att = files[i];
+
+ idx[idxlen] = (ATTACHPTR *) mem_calloc (1, sizeof (ATTACHPTR));
+ idx[idxlen]->unowned = 1;
+ idx[idxlen]->content = mutt_make_file_attach (att);
+ if (idx[idxlen]->content != NULL)
+ update_idx (menu, idx, idxlen++);
+ else {
+ error = 1;
+ mutt_error (_("Unable to attach %s!"), att);
+ mem_free (&idx[idxlen]);
+ }
+ }
+
+ mem_free (&files);
+ if (!error)
+ mutt_clear_error ();
+
+ menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
+ }
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+
+ case OP_COMPOSE_ATTACH_MESSAGE: