/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
* Copyright (C) 1999-2000 Thomas Roessler <roessler@guug.de>
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
#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 "copy.h"
#ifdef HAVE_PGP
#include "pgp.h"
#endif
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
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; \
}
static 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 }
};
void mutt_update_tree (ATTACHPTR **idx, short idxlen)
{
char buf[STRING];
char *s;
int x;
for (x = 0; x < idxlen; x++)
{
idx[x]->num = x;
if (2 * (idx[x]->level + 2) < sizeof (buf))
{
if (idx[x]->level)
{
s = buf + 2 * (idx[x]->level - 1);
*s++ = (idx[x]->content->next) ? M_TREE_LTEE : M_TREE_LLCORNER;
*s++ = M_TREE_HLINE;
*s++ = M_TREE_RARROW;
}
else
s = buf;
*s = 0;
}
if (idx[x]->tree)
{
if (mutt_strcmp (idx[x]->tree, buf) != 0)
mutt_str_replace (&idx[x]->tree, buf);
}
else
idx[x]->tree = safe_strdup (buf);
if (2 * (idx[x]->level + 2) < sizeof (buf) && idx[x]->level)
{
s = buf + 2 * (idx[x]->level - 1);
*s++ = (idx[x]->content->next) ? '\005' : '\006';
*s++ = '\006';
}
}
}
ATTACHPTR **mutt_gen_attach_list (BODY *m,
int parent_type,
ATTACHPTR **idx,
short *idxlen,
short *idxmax,
int level,
int compose)
{
ATTACHPTR *new;
int i;
for (; m; m = m