summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1998-09-23 10:35:41 +0000
committerThomas Roessler <roessler@does-not-exist.org>1998-09-23 10:35:41 +0000
commitefe8e2dc68640724d33f452b5cc98a0887baa8b4 (patch)
tree17c7efbd1bff548851afa9392cf027fa35497827
parent2eabb25219b5648b2e2da27492ef79fb833dfc81 (diff)
Disable recursive invocations of the attach-message function.
-rw-r--r--commands.c4
-rw-r--r--compose.c5
-rw-r--r--curs_lib.c2
-rw-r--r--curs_main.c40
-rw-r--r--init.h2
-rw-r--r--main.c2
-rw-r--r--mutt.h1
-rw-r--r--pager.c25
-rw-r--r--pager.h2
-rw-r--r--protos.h4
-rw-r--r--recvattach.c11
-rw-r--r--sendlib.c2
-rw-r--r--status.c6
13 files changed, 69 insertions, 37 deletions
diff --git a/commands.c b/commands.c
index 715d2902..5293c2d7 100644
--- a/commands.c
+++ b/commands.c
@@ -103,7 +103,7 @@ static int is_mmnoask (const char *buf)
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;
@@ -208,7 +208,7 @@ int mutt_display_message (HEADER *cur, const char *attach_msg_status)
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
{
diff --git a/compose.c b/compose.c
index 43f1bfaa..de23890d 100644
--- a/compose.c
+++ b/compose.c
@@ -650,7 +650,10 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
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 */
diff --git a/curs_lib.c b/curs_lib.c
index 14c9afcf..700fd73f 100644
--- a/curs_lib.c
+++ b/curs_lib.c
@@ -277,7 +277,7 @@ int mutt_do_pager (const char *banner,
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];
diff --git a/curs_main.c b/curs_main.c
index 1179f4b8..429a2857 100644
--- a/curs_main.c
+++ b/curs_main.c
@@ -67,6 +67,13 @@
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)
@@ -231,9 +238,9 @@ struct mapping_t IndexHelp[] = {
/* 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;
@@ -246,6 +253,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
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;
@@ -446,19 +454,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
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);
@@ -651,6 +647,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
CHECK_MSGCOUNT;
CHECK_READONLY;
+ CHECK_ATTACH;
mutt_pattern_func (M_DELETE, "Delete messages matching: ");
menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
break;
@@ -658,6 +655,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
#ifdef USE_POP
case OP_MAIN_FETCH_MAIL:
+ CHECK_ATTACH;
mutt_fetchPopMail ();
menu->redraw = REDRAW_FULL;
break;
@@ -938,7 +936,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
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;
@@ -1386,6 +1384,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
case OP_BOUNCE_MESSAGE:
+ CHECK_ATTACH;
CHECK_MSGCOUNT;
ci_bounce_message (tag ? NULL : CURHDR, &menu->redraw);
break;
@@ -1397,6 +1396,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
break;
case OP_QUERY:
+ CHECK_ATTACH;
mutt_query_menu (NULL, 0);
MAYBE_REDRAW (menu->redraw);
break;
@@ -1485,6 +1485,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
CHECK_MSGCOUNT;
CHECK_READONLY;
+ CHECK_ATTACH;
set_option(OPTUSEHEADERDATE);
ci_send_message (SENDEDITMSG, NULL, NULL, Context, CURHDR);
@@ -1495,6 +1496,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
case OP_FORWARD_MESSAGE:
CHECK_MSGCOUNT;
+ CHECK_ATTACH;
ci_send_message (SENDFORWARD, NULL, NULL, Context, tag ? NULL : CURHDR);
menu->redraw = REDRAW_FULL;
break;
@@ -1513,12 +1515,14 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
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;
@@ -1526,6 +1530,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
case OP_MAIL:
+ CHECK_ATTACH;
ci_send_message (0, NULL, NULL, NULL, NULL);
menu->redraw = REDRAW_FULL;
break;
@@ -1539,6 +1544,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
#ifdef _PGPPATH
case OP_MAIL_KEY:
+ CHECK_ATTACH;
ci_send_message (SENDKEY, NULL, NULL, NULL, NULL);
menu->redraw = REDRAW_FULL;
break;
@@ -1592,12 +1598,14 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
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;
diff --git a/init.h b/init.h
index 02c7acf9..4f360f5d 100644
--- a/init.h
+++ b/init.h
@@ -251,7 +251,7 @@ struct option_t MuttVars[] = {
{ "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 },
diff --git a/main.c b/main.c
index b6b45aaa..2c85da3d 100644
--- a/main.c
+++ b/main.c
@@ -627,7 +627,7 @@ int main (int argc, char **argv)
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)
{
diff --git a/mutt.h b/mutt.h
index 86f7af8a..51187855 100644
--- a/mutt.h
+++ b/mutt.h
@@ -333,6 +333,7 @@ enum
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 () */
diff --git a/pager.c b/pager.c
index 6d0e723c..f0fd4b3b 100644
--- a/pager.c
+++ b/pager.c
@@ -73,6 +73,13 @@
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;
@@ -1305,8 +1312,7 @@ upNLines (int nlines, struct line_t *info, int cur, int hiding)
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];
@@ -1541,10 +1547,7 @@ mutt_pager (const char *banner, const char *fname, int do_color, pager_t *extra,
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);
@@ -1921,7 +1924,8 @@ mutt_pager (const char *banner, const char *fname, int do_color, pager_t *extra,
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:
@@ -2076,36 +2080,42 @@ mutt_pager (const char *banner, const char *fname, int do_color, pager_t *extra,
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;
@@ -2245,6 +2255,7 @@ mutt_pager (const char *banner, const char *fname, int do_color, pager_t *extra,
case OP_MAIL_KEY:
CHECK_MODE(IsHeader(extra));
+ CHECK_ATTACH;
ci_send_message (SENDKEY, NULL, NULL, extra->ctx, extra->hdr);
redraw = REDRAW_FULL;
break;
diff --git a/pager.h b/pager.h
index b218addc..bc3fab23 100644
--- a/pager.h
+++ b/pager.h
@@ -25,4 +25,4 @@ typedef struct
} 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 *);
diff --git a/protos.h b/protos.h
index 41eb9a65..b6af9be3 100644
--- a/protos.h
+++ b/protos.h
@@ -218,7 +218,7 @@ int mutt_compose_attachment (BODY *a);
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);
@@ -227,7 +227,7 @@ int mutt_get_field (char *, char *, size_t, 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 *);
diff --git a/recvattach.c b/recvattach.c
index ef464769..1ac98c56 100644
--- a/recvattach.c
+++ b/recvattach.c
@@ -778,6 +778,14 @@ mutt_attach_display_loop (MUTTMENU *menu, int op, FILE *fp, ATTACHPTR **idx)
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)
{
@@ -962,6 +970,7 @@ 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;
@@ -970,7 +979,7 @@ void mutt_view_attachments (HEADER *hdr)
case OP_LIST_REPLY:
case OP_FORWARD_MESSAGE:
-
+ CHECK_ATTACH;
#ifdef _PGPPATH
if ((hdr->pgp & PGPENCRYPT) && hdr->content->type == TYPEMULTIPART)
diff --git a/sendlib.c b/sendlib.c
index dee5f0b0..66d299d6 100644
--- a/sendlib.c
+++ b/sendlib.c
@@ -923,7 +923,7 @@ BODY *mutt_make_message_attach (CONTEXT *ctx, HEADER *hdr, int attach_msg)
#ifdef _PGPPATH
int pgp = hdr->pgp;
#endif
-
+
#ifdef _PGPPATH
if ((option(OPTMIMEFORWDECODE) || option(OPTFORWDECRYPT)) &&
(hdr->pgp & PGPENCRYPT) && !pgp_valid_passphrase())
diff --git a/status.c b/status.c
index 7cf86807..a2ca6a10 100644
--- a/status.c
+++ b/status.c
@@ -199,9 +199,9 @@ status_format_str (char *buf, size_t buflen, char op, const char *src,
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;