Skip to content

Commit

Permalink
Remove refresh parameter from mutt_enter_fname().
Browse files Browse the repository at this point in the history
Also remove it from mutt_save_message(), which used it to pass through
to mutt_enter_fname().  The callers of this already had redraw logic,
to which REDRAW_STATUS merely needed to be added.
  • Loading branch information
kevin8t8 authored and flatcap committed Apr 2, 2017
1 parent 05954d7 commit 401cc3e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 31 deletions.
16 changes: 2 additions & 14 deletions commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,18 +728,14 @@ int _mutt_save_message (HEADER *h, CONTEXT *ctx, int delete, int decode, int dec
}

/* returns 0 if the copy/save was successful, or -1 on error/abort */
int mutt_save_message (HEADER *h, int delete,
int decode, int decrypt, int *redraw)
int mutt_save_message (HEADER *h, int delete, int decode, int decrypt)
{
int i, need_buffy_cleanup;
int need_passphrase = 0, app=0;
char prompt[SHORT_STRING], buf[_POSIX_PATH_MAX];
CONTEXT ctx;
struct stat st;

*redraw = 0;


snprintf (prompt, sizeof (prompt),
decode ? (delete ? _("Decode-save%s to mailbox") :
_("Decode-copy%s to mailbox")) :
Expand Down Expand Up @@ -787,17 +783,9 @@ int mutt_save_message (HEADER *h, int delete,
}

mutt_pretty_mailbox (buf, sizeof (buf));
if (mutt_enter_fname (prompt, buf, sizeof (buf), redraw, 0) == -1)
if (mutt_enter_fname (prompt, buf, sizeof (buf), 0) == -1)
return -1;

if (*redraw != REDRAW_FULL)
{
if (!h)
*redraw = REDRAW_INDEX | REDRAW_STATUS;
else
*redraw = REDRAW_STATUS;
}

if (!buf[0])
return -1;

Expand Down
7 changes: 3 additions & 4 deletions compose.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,8 +801,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
numfiles = 0;
files = NULL;

if (_mutt_enter_fname (prompt, fname, sizeof (fname),
&menu->redraw, 0, 1, &files, &numfiles, MUTT_SEL_MULTI) == -1 ||
if (_mutt_enter_fname (prompt, fname, sizeof (fname), 0, 1, &files, &numfiles, MUTT_SEL_MULTI) == -1 ||
*fname == '\0')
break;

Expand Down Expand Up @@ -871,7 +870,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
mutt_pretty_mailbox (fname, sizeof (fname));
}

if (mutt_enter_fname (prompt, fname, sizeof (fname), &menu->redraw, 1) == -1 || !fname[0])
if (mutt_enter_fname (prompt, fname, sizeof (fname), 1) == -1 || !fname[0])
break;

#ifdef USE_NNTP
Expand Down Expand Up @@ -1380,7 +1379,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
if (idxlen)
msg->content = idx[0]->content;
if (mutt_enter_fname (_("Write message to mailbox"), fname, sizeof (fname),
&menu->redraw, 1) != -1 && fname[0])
1) != -1 && fname[0])
{
mutt_message (_("Writing message to %s ..."), fname);
mutt_expand_path (fname, sizeof (fname));
Expand Down
4 changes: 1 addition & 3 deletions curs_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,7 @@ int mutt_do_pager (const char *banner,
}

int _mutt_enter_fname (const char *prompt, char *buf, size_t blen,
int *redraw, int buffy, int multiple,
char ***files, int *numfiles, int flags)
int buffy, int multiple, char ***files, int *numfiles, int flags)
{
event_t ch;

Expand All @@ -833,7 +832,6 @@ int _mutt_enter_fname (const char *prompt, char *buf, size_t blen,
flags = MUTT_SEL_FOLDER | (multiple ? MUTT_SEL_MULTI : 0);

_mutt_select_file (buf, blen, flags, files, numfiles);
*redraw = REDRAW_FULL;
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions curs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,7 @@ int mutt_index_menu (void)
strfcpy(buf, Context->path, sizeof (buf));
mutt_buffy_vfolder (buf, sizeof (buf));
}
mutt_enter_vfolder (cp, buf, sizeof (buf), &menu->redraw, 1);
mutt_enter_vfolder (cp, buf, sizeof (buf), 1);
if (!buf[0])
{
mutt_window_clearline (MuttMessageWindow, 0);
Expand Down Expand Up @@ -2021,7 +2021,7 @@ int mutt_index_menu (void)
* mail */
mutt_buffy (buf, sizeof (buf));

if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
if (mutt_enter_fname (cp, buf, sizeof (buf), 1) == -1)
{
if (menu->menu == MENU_PAGER)
{
Expand Down Expand Up @@ -2319,11 +2319,11 @@ int mutt_index_menu (void)
(op == OP_SAVE) || (op == OP_DECODE_SAVE),
(op == OP_DECODE_SAVE) || (op == OP_DECODE_COPY),
(op == OP_DECRYPT_SAVE) || (op == OP_DECRYPT_COPY) ||
0,
&menu->redraw) == 0 &&
0) == 0 &&
(op == OP_SAVE || op == OP_DECODE_SAVE || op == OP_DECRYPT_SAVE)
)
{
menu->redraw |= REDRAW_STATUS;
if (tag)
menu->redraw |= REDRAW_INDEX;
else if (option (OPTRESOLVE))
Expand Down
3 changes: 1 addition & 2 deletions pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -2928,8 +2928,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
(ch == OP_SAVE) || (ch == OP_DECODE_SAVE),
(ch == OP_DECODE_SAVE) || (ch == OP_DECODE_COPY),
(ch == OP_DECRYPT_SAVE) || (ch == OP_DECRYPT_COPY) ||
0,
&pager_menu->redraw) == 0 && (ch == OP_SAVE || ch == OP_DECODE_SAVE
0) == 0 && (ch == OP_SAVE || ch == OP_DECODE_SAVE
|| ch == OP_DECRYPT_SAVE
))
{
Expand Down
8 changes: 4 additions & 4 deletions protos.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ int mutt_parent_message(CONTEXT *ctx, HEADER *hdr, int find_root);
int mutt_prepare_template(FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, short resend);
int mutt_resend_message(FILE *fp, CONTEXT *ctx, HEADER *cur);
int mutt_compose_to_sender(HEADER *hdr);
#define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL,0)
#define mutt_enter_vfolder(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL,MUTT_SEL_VFOLDER)
int _mutt_enter_fname(const char *prompt, char *buf, size_t blen, int *redraw, int buffy,
#define mutt_enter_fname(A,B,C,D) _mutt_enter_fname(A,B,C,D,0,NULL,NULL,0)
#define mutt_enter_vfolder(A,B,C,D) _mutt_enter_fname(A,B,C,D,0,NULL,NULL,MUTT_SEL_VFOLDER)
int _mutt_enter_fname(const char *prompt, char *buf, size_t blen, int buffy,
int multiple, char ***files, int *numfiles, int flags);
int mutt_enter_string(char *buf, size_t buflen, int col, int flags);
int _mutt_enter_string(char *buf, size_t buflen, int col, int flags, int multiple,
Expand Down Expand Up @@ -371,7 +371,7 @@ int mutt_query_complete(char *buf, size_t buflen);
int mutt_query_variables(LIST *queries);
int mutt_save_attachment(FILE *fp, BODY *m, char *path, int flags, HEADER *hdr);
int _mutt_save_message(HEADER *h, CONTEXT *ctx, int delete, int decode, int decrypt);
int mutt_save_message(HEADER *h, int delete, int decode, int decrypt, int *redraw);
int mutt_save_message(HEADER *h, int delete, int decode, int decrypt);
int mutt_search_command(int cur, int op);
#ifdef USE_SMTP
int mutt_smtp_send(const ADDRESS *from, const ADDRESS *to, const ADDRESS *cc,
Expand Down

0 comments on commit 401cc3e

Please sign in to comment.