/*
* Copyright (C) 1996-2000,2002,2007,2010 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1999-2006 Thomas Roessler <roessler@does-not-exist.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include "mutt.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "rfc1524.h"
#include "mime.h"
#include "mailbox.h"
#include "attach.h"
#include "mapping.h"
#include "mx.h"
#include "mutt_crypt.h"
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
static void mutt_update_recvattach_menu (ATTACH_CONTEXT *actx, MUTTMENU *menu, int init);
static const char *Mailbox_is_read_only = N_("Mailbox is read-only.");
#define CHECK_READONLY if (Context->readonly) \
{\
mutt_flushinp (); \
mutt_error _(Mailbox_is_read_only); \
break; \
}
#define CURATTACH actx->idx[actx->v2r[menu->current]]
static const struct mapping_t AttachHelp[] = {
{ N_("Exit"), OP_EXIT },
{ N_("Save"), OP_SAVE },
{ N_("Pipe"), OP_PIPE },
{ N_("Print"), OP_PRINT },
{ N_("Help"), OP_HELP },
{ NULL, 0 }
};
static void mutt_update_v2r (ATTACH_CONTEXT *actx)
{
int vindex, rindex, curlevel;
vindex = rindex = 0;
while (rindex < actx->idxlen)
{
actx->v2r[vindex++] = rindex;
if (actx->idx[rindex]->content->collapsed)
{
curlevel = actx->idx[rindex]->level;
do
rindex++;
while ((rindex < actx->idxlen) &&
(actx->idx[rindex]->level > curlevel));
}
else
rindex++;
}
actx->vcount = vindex;
}
void mutt_update_tree