static const char rcsid[]="$Id$";
/*
* 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 <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 _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);
clrtoeol ();
if (pgp & PGPSIGN)
{
printw ("%s%s", _(" sign as: "), PgpSignAs ? PgpSignAs : _("<default>"));
mvprintw (HDR_PGPSIGINFO, 40, "%s%s", _("MIC algorithm: "),
NONULL(PgpSignMicalg));
}
}
static int pgp_send_menu (int bits, int *redraw)
{
char *p;
char *micalg = NULL;
char input_signas[SHORT_STRING];
char input_micalg[SHORT_STRING];
KEYINFO *secring;
struct pgp_vinfo *pgp = pgp_get_vinfo(PGP_SIGN);
switch (mutt_multi_choice (_("(e)ncrypt, (s)ign, sign (a)s, (b)oth, select (m)ic algorithm, or (f)orget it? "),
_("esabmf")))
{
case 1: /* (e)ncrypt */
bits |= PGPENCRYPT;
break;
case 2: /* (s)ign */
bits |= PGPSIGN;
break;
case 3: /* sign (a)s */
unset_option(OPTPGPCHECKTRUST);
if(pgp)
{
if(!(secring = pgp->read_secring(pgp)))
{
mutt_error _("Can't open your secret key ring!");
bits &= ~PGPSIGN;
}
else
{
if ((p = pgp_ask_for_key (pgp, secring, _(<