-#ifdef USE_NNTP
- if (news)
- menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeNewsHelp);
- else
-#endif
- menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeHelp);
-
- if (option (OPTSTATUSONTOP))
- mutt_buffy_check(1);
- while (loop)
- {
-#ifdef USE_NNTP
- unset_option (OPTNEWS); /* for any case */
-#endif
- switch (op = mutt_menuLoop (menu))
- {
- case OP_REDRAW:
- draw_envelope (msg, fcc);
- menu->offset = HDR_ATTACH;
- menu->pagelen = LINES - HDR_ATTACH - 2;
- break;
- case OP_COMPOSE_EDIT_FROM:
- menu->redraw = edit_address_list (HDR_FROM, &msg->env->from);
- mutt_message_hook (NULL, msg, M_SEND2HOOK);
- break;
- case OP_COMPOSE_EDIT_TO:
-#ifdef USE_NNTP
- if (!news) {
-#endif
- menu->redraw = edit_address_list (HDR_TO, &msg->env->to);
- mutt_message_hook (NULL, msg, M_SEND2HOOK);
-#ifdef USE_NNTP
- }
-#endif
- break;
- case OP_COMPOSE_EDIT_BCC:
-#ifdef USE_NNTP
- if (!news) {
-#endif
- menu->redraw = edit_address_list (HDR_BCC, &msg->env->bcc);
- mutt_message_hook (NULL, msg, M_SEND2HOOK);
-#ifdef USE_NNTP
- }
-#endif
- break;
- case OP_COMPOSE_EDIT_CC:
-#ifdef USE_NNTP
- if (!news) {
-#endif
- menu->redraw = edit_address_list (HDR_CC, &msg->env->cc);
- mutt_message_hook (NULL, msg, M_SEND2HOOK);
-#ifdef USE_NNTP
- }
-#endif
- break;
-#ifdef USE_NNTP
- case OP_COMPOSE_EDIT_NEWSGROUPS:
- if (news)
- {
- if (msg->env->newsgroups)
- strfcpy (buf, msg->env->newsgroups, sizeof (buf));
- else
- buf[0] = 0;
- if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) == 0 && buf[0])
- {
- FREE (&msg->env->newsgroups);
- mutt_remove_trailing_ws (buf);
- msg->env->newsgroups = safe_strdup (mutt_skip_whitespace (buf));
- move (HDR_TO, HDR_XOFFSET);
- clrtoeol ();
- if (msg->env->newsgroups)
- printw ("%-*.*s", W, W, msg->env->newsgroups);
- }
- }
- break;
-
- case OP_COMPOSE_EDIT_FOLLOWUP_TO:
- if (news)
- {
- buf[0] = 0;
- if (msg->env->followup_to)
- strfcpy (buf, msg->env->followup_to, sizeof (buf));
- if (mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) == 0 && buf[0])
- {
- FREE (&msg->env->followup_to);
- mutt_remove_trailing_ws (buf);
- msg->env->followup_to = safe_strdup (mutt_skip_whitespace (buf));
- move (HDR_CC, HDR_XOFFSET);
- clrtoeol();
- if (msg->env->followup_to)
- printw ("%-*.*s", W, W, msg->env->followup_to);
- }
- }
- break;
-
- 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])
- {
- FREE (&msg->env->x_comment_to);
- msg->env->x_comment_to = safe_strdup (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)
- {
- mutt_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);
+
+ while (loop) {
+ switch (op = mutt_menuLoop (menu)) {
+ case OP_REDRAW:
+ draw_envelope (msg, fcc);
+ menu->offset = HDR_ATTACH;
+ menu->pagelen = LINES - HDR_ATTACH - 2;
+ break;
+ case OP_COMPOSE_EDIT_FROM:
+ menu->redraw = edit_address_list (HDR_FROM, &msg->env->from);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+ case OP_COMPOSE_EDIT_TO:
+ menu->redraw = edit_address_list (HDR_TO, &msg->env->to);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+ case OP_COMPOSE_EDIT_BCC:
+ menu->redraw = edit_address_list (HDR_BCC, &msg->env->bcc);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+ case OP_COMPOSE_EDIT_CC:
+ menu->redraw = edit_address_list (HDR_CC, &msg->env->cc);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+ case OP_COMPOSE_EDIT_SUBJECT:
+ if (msg->env->subject)
+ m_strcpy(buf, sizeof(buf), msg->env->subject);
+ else
+ buf[0] = 0;
+ if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) {
+ m_strreplace(&msg->env->subject, buf);
+ wmove (main_w, HDR_SUBJECT, HDR_XOFFSET);
+ wclrtoeol (main_w);
+ if (msg->env->subject)
+ mutt_paddstr (main_w, 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:
+ m_strcpy(buf, sizeof(buf), fcc);
+ if (mutt_get_field ("Fcc: ", buf, sizeof (buf), M_FILE | M_CLEAR) == 0) {
+ m_strcpy(fcc, _POSIX_PATH_MAX, buf);
+ mutt_pretty_mailbox (fcc);
+ wmove (main_w, HDR_FCC, HDR_XOFFSET);
+ mutt_paddstr (main_w, W, fcc);
+ fccSet = 1;
+ }
+ MAYBE_REDRAW (menu->redraw);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+ case OP_COMPOSE_EDIT_MESSAGE:
+ if (!option (OPTEDITHDRS)) {
+ mutt_edit_file(msg->content->filename);
+ mutt_update_encoding (msg->content);
+ menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;