static void mutt_gen_compose_attach_list(struct AttachCtx *actx, struct Body *m,
int parent_type, int level)
{
- struct AttachPtr *new = NULL;
-
for (; m; m = m->next)
{
if (m->type == TYPE_MULTIPART && m->parts &&
}
else
{
- new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
+ struct AttachPtr *new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
mutt_actx_add_attach(actx, new);
new->content = m;
m->aptr = new;
*/
int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email *cur, int flags)
{
- char helpstr[LONG_STRING];
+ char helpstr[LONG_STRING]; // This isn't copied by the help bar
char buf[LONG_STRING];
char fname[PATH_MAX];
- struct AttachPtr *new = NULL;
- int i, close = 0;
- int r = -1; /* return value */
+ int op_close = OP_NULL;
+ int rc = -1;
int loop = 1;
int fcc_set = 0; /* has the user edited the Fcc: field ? */
- struct Context *ctx = NULL, *this = NULL;
- /* Sort, SortAux could be changed in mutt_index_menu() */
- int old_sort, old_sort_aux;
- struct stat st;
struct ComposeRedrawData rd;
#ifdef USE_NNTP
int news = 0; /* is it a news article ? */
break;
case OP_COMPOSE_ATTACH_KEY:
+ {
if (!(WithCrypto & APPLICATION_PGP))
break;
- new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
+ struct AttachPtr *new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
new->content = crypt_pgp_make_key_attachment();
if (new->content)
{
mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
break;
+ }
case OP_COMPOSE_MOVE_UP:
if (menu->current == 0)
struct Body *alts = NULL;
/* group tagged message into a multipart/alternative */
struct Body *bptr = msg->content;
- for (i = 0; bptr;)
+ for (int i = 0; bptr;)
{
if (bptr->tagged)
{
struct Body *alts = NULL;
/* group tagged message into a multipart/multilingual */
struct Body *bptr = msg->content;
- for (i = 0; bptr;)
+ for (int i = 0; bptr;)
{
if (bptr->tagged)
{
mutt_message(ngettext("Attaching selected file...",
"Attaching selected files...", numfiles));
}
- for (i = 0; i < numfiles; i++)
+ for (int i = 0; i < numfiles; i++)
{
char *att = files[i];
- new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
+ struct AttachPtr *new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
new->unowned = true;
new->content = mutt_make_file_attach(att);
if (new->content)
menu->redraw = REDRAW_FULL;
struct Mailbox *m = mx_path_resolve(fname);
- ctx = mx_mbox_open(m, MUTT_READONLY);
+ struct Context *ctx = mx_mbox_open(m, MUTT_READONLY);
if (!ctx)
{
mutt_error(_("Unable to open mailbox %s"), fname);
break;
}
- this = Context; /* remember current folder and sort methods */
- old_sort = Sort;
- old_sort_aux = SortAux;
+ struct Context *this = Context; /* remember current folder and sort methods */
+ int old_sort = Sort; /* Sort, SortAux could be changed in mutt_index_menu() */
+ int old_sort_aux = SortAux;
Context = ctx;
OptAttachMsg = true;
mutt_message(_("Tag the messages you want to attach"));
- close = mutt_index_menu();
+ op_close = mutt_index_menu();
OptAttachMsg = false;
if (!Context)
break;
}
- for (i = 0; i < Context->mailbox->msg_count; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
{
if (!message_is_tagged(Context, i))
continue;
- new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
+ struct AttachPtr *new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
new->content = mutt_make_message_attach(Context->mailbox,
Context->mailbox->emails[i], true);
if (new->content)
}
menu->redraw |= REDRAW_FULL;
- if (close == OP_QUIT)
+ if (op_close == OP_QUIT)
mx_mbox_close(&Context);
else
{
/* Restore old $sort and $sort_aux */
Sort = old_sort;
SortAux = old_sort_aux;
- }
mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
break;
+ }
case OP_DELETE:
CHECK_COUNT;
mutt_str_strfcpy(buf, ENCODING(CURATTACH->content->encoding), sizeof(buf));
if (mutt_get_field("Content-Transfer-Encoding: ", buf, sizeof(buf), 0) == 0 && buf[0])
{
- i = mutt_check_encoding(buf);
- if ((i != ENC_OTHER) && (i != ENC_UUENCODED))
+ int enc = mutt_check_encoding(buf);
+ if ((enc != ENC_OTHER) && (enc != ENC_UUENCODED))
{
- CURATTACH->content->encoding = i;
+ CURATTACH->content->encoding = enc;
menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
mutt_clear_error();
}
if (!fcc_set && *fcc)
{
- i = query_quadoption(Copy, _("Save a copy of this message?"));
- if (i == MUTT_ABORT)
+ int ans = query_quadoption(Copy, _("Save a copy of this message?"));
+ if (ans == MUTT_ABORT)
break;
- else if (i == MUTT_NO)
+ else if (ans == MUTT_NO)
*fcc = 0;
}
loop = 0;
- r = 0;
+ rc = 0;
break;
case OP_COMPOSE_EDIT_FILE:
if (mutt_get_field(_("Rename to: "), fname, sizeof(fname), MUTT_FILE) == 0 &&
fname[0])
{
+ struct stat st;
if (stat(CURATTACH->content->filename, &st) == -1)
{
/* L10N:
mutt_error(_("Unknown Content-Type %s"), type);
continue;
}
- new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
+ struct AttachPtr *new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
/* Touch the file */
fp = mutt_file_fopen(fname, "w");
if (!fp)
break;
case OP_EXIT:
- i = query_quadoption(Postpone, _("Postpone this message?"));
- if (i == MUTT_NO)
+ {
+ int ans = query_quadoption(Postpone, _("Postpone this message?"));
+ if (ans == MUTT_NO)
{
- for (i = 0; i < actx->idxlen; i++)
+ for (int i = 0; i < actx->idxlen; i++)
if (actx->idx[i]->unowned)
actx->idx[i]->content->unlink = false;
if (!(flags & MUTT_COMPOSE_NOFREEHEADER))
{
- for (i = 0; i < actx->idxlen; i++)
+ for (int i = 0; i < actx->idxlen; i++)
{
/* avoid freeing other attachments */
actx->idx[i]->content->next = NULL;
mutt_body_free(&actx->idx[i]->content);
}
}
- r = -1;
+ rc = -1;
loop = 0;
break;
}
- else if (i == MUTT_ABORT)
+ else if (ans == MUTT_ABORT)
break; /* abort */
+ }
/* fallthrough */
case OP_COMPOSE_POSTPONE_MESSAGE:
}
loop = 0;
- r = 1;
+ rc = 1;
break;
case OP_COMPOSE_ISPELL:
mutt_actx_free(&actx);
- return r;
+ return rc;
}