/*
* Copyright (C) 1996-8 Michael R. Elkins <me@cs.hmc.edu>
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "mutt.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "rfc1524.h"
#include "mime.h"
#include "attach.h"
#include "mapping.h"
#include "mailbox.h"
#include "sort.h"
#include "charset.h"
#ifdef MIXMASTER
#include "remailer.h"
#endif
#include <string.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
#define CHECK_COUNT if (idxlen == 0) { mutt_error _("There are no attachments."); break; }
enum
{
HDR_FROM = 1,
HDR_TO,
HDR_CC,
HDR_BCC,
HDR_SUBJECT,
HDR_REPLYTO,
HDR_FCC,
#ifdef MIXMASTER
HDR_MIX,
#endif
#ifdef _PGPPATH
HDR_PGP,
HDR_PGPSIGINFO,
#endif
HDR_ATTACH = (HDR_FCC + 5) /* where to start printing the attachments */
};
#define HDR_XOFFSET 10
#define TITLE_FMT "%10s"
#define W (COLS - HDR_XOFFSET)
static char *Prompts[] =
{
"From: ",
"To: ",
"Cc: ",
"Bcc: ",
"Subject: ",
"Reply-To: ",
"Fcc: "
};
static struct mapping_t ComposeHelp[] = {
{ N_("Send"), OP_COMPOSE_SEND_MESSAGE },
{ N_("Abort"), OP_EXIT },
{ "To", OP_COMPOSE_EDIT_TO },
{ "CC", OP_COMPOSE_EDIT_CC },
{ "Subj", OP_COMPOSE_EDIT_SUBJECT },
{ N_("Attach file"), OP_COMPOSE_ATTACH_FILE },
{ N_("Descrip"), OP_COMPOSE_EDIT_DESCRIPTION },
{ N_("Help"), OP_HELP },
{ NULL }
};
static void snd_entry (char *b, size_t blen, MUTTMENU *menu, int num)
{
mutt_FormatString (b, blen, NONULL (AttachFormat), mutt_attach_fmt,
(unsigned long)(((ATTACHPTR **) menu->data)[num]),
M_FORMAT_STAT_FILE | M_FORMAT_ARROWCURSOR);
}
#ifdef _PGPPATH
#include "pgp.h"
static void redraw_pgp_lines (int pgp)
{
mvaddstr (HDR_PGP, 0, " PGP: ");
if ((pgp & (PGPENCRYPT | PGPSIGN)) == (PGPENCRYPT | PGPSIGN))
addstr (_("Sign, Encrypt"));
else if (pgp & PGPENCRYPT)
addstr (_("Encrypt"));
else if (pgp & PGPSIGN)
addstr (_("Sign"));
else
addstr (_("Clear"));
clrtoeol ();
move (HDR_PGPSIGINFO, 0