return (0);
}
-int mutt_display_message (HEADER *cur, const char *attach_msg_status)
+int mutt_display_message (HEADER *cur)
{
char tempfile[_POSIX_PATH_MAX], buf[LONG_STRING];
int rc = 0, builtin = 0;
memset (&info, 0, sizeof (pager_t));
info.hdr = cur;
info.ctx = Context;
- rc = mutt_pager (NULL, tempfile, 1, &info, attach_msg_status);
+ rc = mutt_pager (NULL, tempfile, 1, &info);
}
else
{
this = Context; /* remember current folder */
Context = ctx;
- close = mutt_index_menu (1);
+ set_option(OPTATTACHMSG);
+ close = mutt_index_menu ();
+ unset_option(OPTATTACHMSG);
+
if (!Context)
{
/* go back to the folder we started from */
int rc;
if (!Pager || strcmp (Pager, "builtin") == 0)
- rc = mutt_pager (banner, tempfile, do_color, info, "");
+ rc = mutt_pager (banner, tempfile, do_color, info);
else
{
char cmd[STRING];
break; \
}
+#define CHECK_ATTACH if(option(OPTATTACHMSG)) \
+ {\
+ mutt_flushinp (); \
+ mutt_error ("Function not permitted in attach-message mode."); \
+ break; \
+ }
+
#define CURHDR Context->hdrs[Context->v2r[menu->current]]
#define OLDHDR Context->hdrs[Context->v2r[menu->oldcurrent]]
#define UNREAD(h) mutt_thread_contains_unread (Context, h)
/* This function handles the message index window as well as commands returned
* from the pager (MENU_PAGER).
*/
-int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
+int mutt_index_menu (void)
{
- char buf[LONG_STRING], attach_msg_status[LONG_STRING] = "", helpstr[SHORT_STRING];
+ char buf[LONG_STRING], helpstr[SHORT_STRING];
int op = OP_NULL; /* function to execute */
int done = 0; /* controls when to exit the "event" loop */
int i = 0, j;
int index_hint; /* used to restore cursor position */
int do_buffy_notify = 1;
int close = 0; /* did we OP_QUIT or OP_EXIT out of this menu? */
+ int attach_msg = option(OPTATTACHMSG);
menu = mutt_new_menu ();
menu->menu = MENU_MAIN;
if (menu->redraw & REDRAW_STATUS)
{
- if (attach_msg)
- {
- char from_folder [STRING];
- strfcpy(from_folder, Context->path, sizeof (from_folder));
- mutt_pretty_mailbox (from_folder);
- snprintf (attach_msg_status, sizeof (attach_msg_status),
- "Folder: %s Tagged messages will be attached upon exiting",
- from_folder);
- snprintf (buf, sizeof (buf), M_MODEFMT, attach_msg_status);
- }
- else
- menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
-
+ menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2);
SETCOLOR (MT_COLOR_STATUS);
printw ("%-*.*s", COLS, COLS, buf);
CHECK_MSGCOUNT;
CHECK_READONLY;
+ CHECK_ATTACH;
mutt_pattern_func (M_DELETE, "Delete messages matching: ");
menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
break;
#ifdef USE_POP
case OP_MAIN_FETCH_MAIL:
+ CHECK_ATTACH;
mutt_fetchPopMail ();
menu->redraw = REDRAW_FULL;
break;
menu->current = mutt_thread_next_unread (Context, CURHDR);
}
- if ((op = mutt_display_message (CURHDR, attach_msg_status)) == -1)
+ if ((op = mutt_display_message (CURHDR)) == -1)
{
unset_option (OPTNEEDRESORT);
break;
case OP_BOUNCE_MESSAGE:
+ CHECK_ATTACH;
CHECK_MSGCOUNT;
ci_bounce_message (tag ? NULL : CURHDR, &menu->redraw);
break;
break;
case OP_QUERY:
+ CHECK_ATTACH;
mutt_query_menu (NULL, 0);
MAYBE_REDRAW (menu->redraw);
break;
CHECK_MSGCOUNT;
CHECK_READONLY;
+ CHECK_ATTACH;
set_option(OPTUSEHEADERDATE);
ci_send_message (SENDEDITMSG, NULL, NULL, Context, CURHDR);
case OP_FORWARD_MESSAGE:
CHECK_MSGCOUNT;
+ CHECK_ATTACH;
ci_send_message (SENDFORWARD, NULL, NULL, Context, tag ? NULL : CURHDR);
menu->redraw = REDRAW_FULL;
break;
case OP_GROUP_REPLY:
CHECK_MSGCOUNT;
+ CHECK_ATTACH;
ci_send_message (SENDREPLY|SENDGROUPREPLY, NULL, NULL, Context, tag ? NULL : CURHDR);
menu->redraw = REDRAW_FULL;
break;
case OP_LIST_REPLY:
+ CHECK_ATTACH;
CHECK_MSGCOUNT;
ci_send_message (SENDREPLY|SENDLISTREPLY, NULL, NULL, Context, tag ? NULL : CURHDR);
menu->redraw = REDRAW_FULL;
case OP_MAIL:
+ CHECK_ATTACH;
ci_send_message (0, NULL, NULL, NULL, NULL);
menu->redraw = REDRAW_FULL;
break;
#ifdef _PGPPATH
case OP_MAIL_KEY:
+ CHECK_ATTACH;
ci_send_message (SENDKEY, NULL, NULL, NULL, NULL);
menu->redraw = REDRAW_FULL;
break;
case OP_RECALL_MESSAGE:
+ CHECK_ATTACH;
ci_send_message (SENDPOSTPONED, NULL, NULL, Context, NULL);
menu->redraw = REDRAW_FULL;
break;
case OP_REPLY:
+ CHECK_ATTACH;
CHECK_MSGCOUNT;
ci_send_message (SENDREPLY, NULL, NULL, Context, tag ? NULL : CURHDR);
menu->redraw = REDRAW_FULL;
{ "sort_browser", DT_SORT|DT_SORT_BROWSER, R_NONE, UL &BrowserSort, SORT_SUBJECT },
{ "sort_re", DT_BOOL, R_INDEX|R_RESORT_BOTH, OPTSORTRE, 1 },
{ "spoolfile", DT_PATH, R_NONE, UL &Spoolfile, 0 },
- { "status_chars", DT_STR, R_BOTH, UL &StChars, UL "-*%" },
+ { "status_chars", DT_STR, R_BOTH, UL &StChars, UL "-*%A" },
{ "status_format", DT_STR, R_BOTH, UL &Status, UL "-%r-Mutt: %f [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---" },
{ "status_on_top", DT_BOOL, R_BOTH, OPTSTATUSONTOP, 0 },
{ "strict_threads", DT_BOOL, R_RESORT|R_INDEX, OPTSTRICTTHREADS, 0 },
if ((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL)) != NULL)
{
- int close = mutt_index_menu (0);
+ int close = mutt_index_menu ();
if (Context)
{
OPTNEEDRESCORE, /* (pseudo) set when the `score' command is used */
OPTSORTCOLLAPSE, /* (pseudo) used by mutt_sort_headers() */
OPTUSEHEADERDATE, /* (pseudo) used by edit-message */
+ OPTATTACHMSG, /* (pseudo) used by attach-message */
#ifdef _PGPPATH
OPTPGPCHECKTRUST, /* (pseudo) used by pgp_select_key () */
break; \
}
+#define CHECK_ATTACH if(option(OPTATTACHMSG)) \
+ {\
+ mutt_flushinp (); \
+ mutt_error ("Function not permitted in attach-message mode."); \
+ break; \
+ }
+
struct q_class_t
{
int length;
is there so that we can do operations on the current message without the
need to pop back out to the main-menu. */
int
-mutt_pager (const char *banner, const char *fname, int do_color, pager_t *extra,
- const char *attach_msg_status /* invoked while attaching a message */)
+mutt_pager (const char *banner, const char *fname, int do_color, pager_t *extra)
{
static char searchbuf[STRING];
char buffer[LONG_STRING];
menu_redraw_current (index);
/* print out the index status bar */
- if (*attach_msg_status)
- snprintf (buffer, sizeof (buffer), M_MODEFMT, attach_msg_status);
- else
- menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
+ menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0);
SETCOLOR (MT_COLOR_STATUS);
case OP_BOUNCE_MESSAGE:
CHECK_MODE(IsHeader (extra));
- ci_bounce_message (extra->hdr, &redraw);
+ CHECK_ATTACH;
+ ci_bounce_message (extra->hdr, &redraw);
break;
case OP_CREATE_ALIAS:
case OP_MAIL:
CHECK_MODE(IsHeader (extra));
+ CHECK_ATTACH;
ci_send_message (0, NULL, NULL, NULL, NULL);
redraw = REDRAW_FULL;
break;
case OP_REPLY:
CHECK_MODE(IsHeader (extra));
+ CHECK_ATTACH;
ci_send_message (SENDREPLY, NULL, NULL, extra->ctx, extra->hdr);
redraw = REDRAW_FULL;
break;
case OP_RECALL_MESSAGE:
CHECK_MODE(IsHeader (extra));
+ CHECK_ATTACH;
ci_send_message (SENDPOSTPONED, NULL, NULL, extra->ctx, extra->hdr);
redraw = REDRAW_FULL;
break;
case OP_GROUP_REPLY:
CHECK_MODE(IsHeader (extra));
+ CHECK_ATTACH;
ci_send_message (SENDREPLY | SENDGROUPREPLY, NULL, NULL, extra->ctx, extra->hdr);
redraw = REDRAW_FULL;
break;
case OP_LIST_REPLY:
CHECK_MODE(IsHeader (extra));
+ CHECK_ATTACH;
ci_send_message (SENDREPLY | SENDLISTREPLY, NULL, NULL, extra->ctx, extra->hdr);
redraw = REDRAW_FULL;
break;
case OP_FORWARD_MESSAGE:
CHECK_MODE(IsHeader (extra));
+ CHECK_ATTACH;
ci_send_message (SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr);
redraw = REDRAW_FULL;
break;
case OP_MAIL_KEY:
CHECK_MODE(IsHeader(extra));
+ CHECK_ATTACH;
ci_send_message (SENDKEY, NULL, NULL, extra->ctx, extra->hdr);
redraw = REDRAW_FULL;
break;
} pager_t;
int mutt_do_pager (const char *, const char *, int, pager_t *);
-int mutt_pager (const char *, const char *, int, pager_t *, const char *);
+int mutt_pager (const char *, const char *, int, pager_t *);
int mutt_copy_bytes (FILE *, FILE *, size_t);
int mutt_copy_stream (FILE *, FILE *);
int mutt_decode_save_attachment (FILE *, BODY *, char *, int, int);
-int mutt_display_message (HEADER *h, const char *);
+int mutt_display_message (HEADER *h);
int mutt_edit_attachment(BODY *);
int mutt_edit_message(CONTEXT *, HEADER *, HEADER *);
int mutt_enter_fname (const char *, char *, size_t, int *, int);
int mutt_get_password (char *, char *, size_t);
int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **);
int mutt_get_tmp_attachment (BODY *);
-int mutt_index_menu (int);
+int mutt_index_menu (void);
int mutt_invoke_sendmail (ADDRESS *, ADDRESS *, ADDRESS *, const char *, int);
int mutt_is_autoview (char *);
int mutt_is_mail_list (ADDRESS *);
toggle_option (OPTWEED);
}
+
+#define CHECK_ATTACH if(option(OPTATTACHMSG)) \
+ {\
+ mutt_flushinp (); \
+ mutt_error ("Function not permitted in attach-message mode."); \
+ break; \
+ }
+
void mutt_view_attachments (HEADER *hdr)
{
break;
case OP_BOUNCE_MESSAGE:
+ CHECK_ATTACH;
query_bounce_attachment (menu->tagprefix, menu->tagprefix ? cur : idx[menu->current]->content, hdr);
break;
case OP_LIST_REPLY:
case OP_FORWARD_MESSAGE:
-
+ CHECK_ATTACH;
#ifdef _PGPPATH
if ((hdr->pgp & PGPENCRYPT) && hdr->content->type == TYPEMULTIPART)
#ifdef _PGPPATH
int pgp = hdr->pgp;
#endif
-
+
#ifdef _PGPPATH
if ((option(OPTMIMEFORWDECODE) || option(OPTFORWDECRYPT)) &&
(hdr->pgp & PGPENCRYPT) && !pgp_valid_passphrase())
break;
case 'r':
- if (Context)
- buf[0] = (Context->readonly || Context->dontwrite) ? StChars[2] :
- (Context->changed || Context->deleted) ? StChars[1] : StChars[0];
+ if (Context && StChars) /* XXX */
+ buf[0] = option(OPTATTACHMSG) ? StChars[3] : ((Context->readonly || Context->dontwrite) ? StChars[2] :
+ (Context->changed || Context->deleted) ? StChars[1] : StChars[0]);
else
buf[0] = StChars[0];
buf[1] = 0;