/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
+ * Copyright (C) 2004 g10 Code GmbH
*
* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "mutt.h"
#include "mutt_curses.h"
#include "mutt_idna.h"
HDR_REPLYTO,
HDR_FCC,
+#ifdef MIXMASTER
+ HDR_MIX,
+#endif
HDR_CRYPT,
HDR_CRYPTINFO,
HDR_XCOMMENTTO,
#endif
+#ifndef USE_NNTP
HDR_ATTACH = (HDR_FCC + 5) /* where to start printing the attachments */
+#else
+ HDR_ATTACH = (HDR_FCC + 7)
+#endif
};
#define HDR_XOFFSET 14
#define TITLE_FMT "%14s" /* Used for Prompts, which are ASCII */
-#define W (COLS - HDR_XOFFSET)
+#define W (COLS - HDR_XOFFSET - SidebarWidth)
static char *Prompts[] =
{
if ((WithCrypto & APPLICATION_PGP) && (WithCrypto & APPLICATION_SMIME))
{
if (!msg->security)
- mvaddstr (HDR_CRYPT, 0, " Security: ");
+ mvaddstr (HDR_CRYPT, SidebarWidth, " Security: ");
else if (msg->security & APPLICATION_SMIME)
- mvaddstr (HDR_CRYPT, 0, " S/MIME: ");
+ mvaddstr (HDR_CRYPT, SidebarWidth, " S/MIME: ");
else if (msg->security & APPLICATION_PGP)
- mvaddstr (HDR_CRYPT, 0, " PGP: ");
+ mvaddstr (HDR_CRYPT, SidebarWidth, " PGP: ");
}
else if ((WithCrypto & APPLICATION_SMIME))
- mvaddstr (HDR_CRYPT, 0, " S/MIME: ");
+ mvaddstr (HDR_CRYPT, SidebarWidth, " S/MIME: ");
else if ((WithCrypto & APPLICATION_PGP))
- mvaddstr (HDR_CRYPT, 0, " PGP: ");
+ mvaddstr (HDR_CRYPT, SidebarWidth, " PGP: ");
else
return;
addstr (_("Sign"));
else
addstr (_("Clear"));
+
+ if ((WithCrypto & APPLICATION_PGP))
+ if ((msg->security & APPLICATION_PGP)
+ && (msg->security & (ENCRYPT | SIGN)))
+ {
+ if ((msg->security & INLINE))
+ addstr (_(" (inline)"));
+ else
+ addstr (_(" (PGP/MIME)"));
+ }
clrtoeol ();
- move (HDR_CRYPTINFO, 0);
+ move (HDR_CRYPTINFO, SidebarWidth);
clrtoeol ();
if ((WithCrypto & APPLICATION_PGP)
&& msg->security & APPLICATION_PGP && msg->security & SIGN)
- printw ("%s%s", _(" sign as: "), PgpSignAs ? PgpSignAs : _("<default>"));
+ printw ("%s%s", _(" sign as: "), PgpSignAs ? PgpSignAs : _("<default>"));
if ((WithCrypto & APPLICATION_SMIME)
- && msg->security & APPLICATION_SMIME && msg->security & SIGN) {
- printw ("%s%s", _(" sign as: "), SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
+ && msg->security & APPLICATION_SMIME && msg->security & SIGN) {
+ printw ("%s%s", _(" sign as: "), SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
}
if ((WithCrypto & APPLICATION_SMIME)
- && msg->security & APPLICATION_SMIME && (msg->security & ENCRYPT)) {
- mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
+ && (msg->security & APPLICATION_SMIME)
+ && (msg->security & ENCRYPT)
+ && SmimeCryptAlg
+ && *SmimeCryptAlg) {
+ mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "),
NONULL(SmimeCryptAlg));
off = 20;
}
}
-
-static int pgp_send_menu (HEADER *msg, int *redraw)
-{
- pgp_key_t p;
- char input_signas[SHORT_STRING];
-
- if (!(WithCrypto & APPLICATION_PGP))
- return msg->security;
-
- switch (mutt_multi_choice (_("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, or (f)orget it? "),
- _("esabf")))
- {
- case 1: /* (e)ncrypt */
- msg->security |= ENCRYPT;
- break;
-
- case 2: /* (s)ign */
- msg->security |= SIGN;
- break;
-
- case 3: /* sign (a)s */
- unset_option(OPTPGPCHECKTRUST);
-
- if ((p = crypt_pgp_ask_for_key (_("Sign as: "), NULL,
- KEYFLAG_CANSIGN, PGP_PUBRING)))
- {
- snprintf (input_signas, sizeof (input_signas), "0x%s",
- crypt_pgp_keyid (p));
- mutt_str_replace (&PgpSignAs, input_signas);
- crypt_pgp_free_key (&p);
-
- msg->security |= SIGN;
-
- crypt_pgp_void_passphrase (); /* probably need a different passphrase */
- }
- else
- {
- msg->security &= ~SIGN;
- }
-
- *redraw = REDRAW_FULL;
- break;
-
- case 4: /* (b)oth */
- msg->security = ENCRYPT | SIGN;
- break;
-
- case 5: /* (f)orget it */
- msg->security = 0;
- break;
- }
-
- if (msg->security && msg->security != APPLICATION_PGP)
- msg->security |= APPLICATION_PGP;
- else
- msg->security = 0;
-
- if(*redraw)
- redraw_crypt_lines (msg);
- return (msg->security);
-}
-
-
-
-static int smime_send_menu (HEADER *msg, int *redraw)
-{
- char *p;
-
- if (!(WithCrypto & APPLICATION_SMIME))
- return msg->security;
-
- switch (mutt_multi_choice (_("S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign (a)s, (b)oth, or (f)orget it? "),
- _("eswabf")))
- {
- case 1: /* (e)ncrypt */
- msg->security |= ENCRYPT;
- break;
-
- case 3: /* encrypt (w)ith */
- msg->security |= ENCRYPT;
- switch (mutt_multi_choice (_("1: DES, 2: Triple-DES, 3: RC2-40,"
- " 4: RC2-64, 5: RC2-128, or (f)orget it? "),
- _("12345f"))) {
- case 1:
- mutt_str_replace (&SmimeCryptAlg, "des");
- break;
- case 2:
- mutt_str_replace (&SmimeCryptAlg, "des3");
- break;
- case 3:
- mutt_str_replace (&SmimeCryptAlg, "rc2-40");
- break;
- case 4:
- mutt_str_replace (&SmimeCryptAlg, "rc2-64");
- break;
- case 5:
- mutt_str_replace (&SmimeCryptAlg, "rc2-128");
- break;
- case 6: /* forget it */
- break;
- }
- break;
-
- case 2: /* (s)ign */
-
- if(!SmimeDefaultKey)
- mutt_message("Can\'t sign: No key specified. use sign(as).");
- else
- msg->security |= SIGN;
- break;
-
- case 4: /* sign (a)s */
-
- if ((p = crypt_smime_ask_for_key (_("Sign as: "), NULL, 0))) {
- p[mutt_strlen (p)-1] = '\0';
- mutt_str_replace (&SmimeDefaultKey, p);
-
- msg->security |= SIGN;
-
- /* probably need a different passphrase */
- crypt_smime_void_passphrase ();
- }
- else
- msg->security &= ~SIGN;
-
- *redraw = REDRAW_FULL;
- break;
-
- case 5: /* (b)oth */
- msg->security = ENCRYPT | SIGN;
- break;
-
- case 6: /* (f)orget it */
- msg->security = 0;
- break;
- }
-
- if (msg->security && msg->security != APPLICATION_SMIME)
- msg->security |= APPLICATION_SMIME;
- else
- msg->security = 0;
-
- if(*redraw)
- redraw_crypt_lines (msg);
- return (msg->security);
-}
-
-
#ifdef MIXMASTER
static void redraw_mix_line (LIST *chain)
int c;
char *t;
- mvaddstr (HDR_MIX, 0, " Mix: ");
+ mvaddstr (HDR_MIX, SidebarWidth, " Mix: ");
if (!chain)
{
if (t && t[0] == '0' && t[1] == '\0')
t = "<random>";
- if (c + mutt_strlen (t) + 2 >= COLS)
+ if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth)
break;
addstr (NONULL(t));
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), addr, 1);
- mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]);
+ mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]);
mutt_paddstr (W, buf);
}
}
else
{
- mvprintw (HDR_TO, 0, TITLE_FMT , Prompts[HDR_NEWSGROUPS - 1]);
+ mvprintw (HDR_TO, SidebarWidth, TITLE_FMT , Prompts[HDR_NEWSGROUPS - 1]);
mutt_paddstr (W, NONULL (msg->env->newsgroups));
- mvprintw (HDR_CC, 0, TITLE_FMT , Prompts[HDR_FOLLOWUPTO - 1]);
+ mvprintw (HDR_CC, SidebarWidth, TITLE_FMT , Prompts[HDR_FOLLOWUPTO - 1]);
mutt_paddstr (W, NONULL (msg->env->followup_to));
if (option (OPTXCOMMENTTO))
{
}
}
#endif
- mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
+ mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
mutt_paddstr (W, NONULL (msg->env->subject));
draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
- mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
+ mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]);
mutt_paddstr (W, fcc);
if (WithCrypto)
#endif
SETCOLOR (MT_COLOR_STATUS);
- mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
+ mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments"));
BKGDSET (MT_COLOR_STATUS);
clrtoeol ();
/* redraw the expanded list so the user can see the result */
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), *addr, 1);
- move (line, HDR_XOFFSET);
+ move (line, HDR_XOFFSET+SidebarWidth);
mutt_paddstr (W, buf);
return 0;
}
/* prototype for use below */
-void compose_status_line (char *buf, size_t buflen, MUTTMENU *menu,
+static void compose_status_line (char *buf, size_t buflen, MUTTMENU *menu,
const char *p);
/*
break;
case 'v':
- snprintf (fmt, sizeof (fmt), "Mutt %%s");
+ snprintf (fmt, sizeof (fmt), "Mutt-ng %%s");
snprintf (buf, buflen, fmt, MUTT_VERSION);
break;
return (src);
}
-void compose_status_line (char *buf, size_t buflen, MUTTMENU *menu,
+static void compose_status_line (char *buf, size_t buflen, MUTTMENU *menu,
const char *p)
{
mutt_FormatString (buf, buflen, p, compose_format_str,
#endif
menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeHelp);
+ if (option (OPTSTATUSONTOP))
+ mutt_buffy_check(1);
while (loop)
{
#ifdef USE_NNTP
break;
case OP_COMPOSE_EDIT_FROM:
menu->redraw = edit_address_list (HDR_FROM, &msg->env->from);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
case OP_COMPOSE_EDIT_TO:
#ifdef USE_NNTP
- if (!news)
+ if (!news) {
#endif
menu->redraw = edit_address_list (HDR_TO, &msg->env->to);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+#ifdef USE_NNTP
+ }
+#endif
break;
case OP_COMPOSE_EDIT_BCC:
#ifdef USE_NNTP
- if (!news)
+ if (!news) {
#endif
menu->redraw = edit_address_list (HDR_BCC, &msg->env->bcc);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+#ifdef USE_NNTP
+ }
+#endif
break;
case OP_COMPOSE_EDIT_CC:
#ifdef USE_NNTP
- if (!news)
+ if (!news) {
#endif
menu->redraw = edit_address_list (HDR_CC, &msg->env->cc);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+#ifdef USE_NNTP
+ }
+#endif
break;
#ifdef USE_NNTP
case OP_COMPOSE_EDIT_NEWSGROUPS:
if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
{
mutt_str_replace (&msg->env->subject, buf);
- move (HDR_SUBJECT, HDR_XOFFSET);
+ move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth);
clrtoeol ();
if (msg->env->subject)
mutt_paddstr (W, msg->env->subject);
}
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_COMPOSE_EDIT_REPLY_TO:
menu->redraw = edit_address_list (HDR_REPLYTO, &msg->env->reply_to);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
case OP_COMPOSE_EDIT_FCC:
strfcpy (buf, fcc, sizeof (buf));
{
strfcpy (fcc, buf, _POSIX_PATH_MAX);
mutt_pretty_mailbox (fcc);
- move (HDR_FCC, HDR_XOFFSET);
+ move (HDR_FCC, HDR_XOFFSET + SidebarWidth);
mutt_paddstr (W, fcc);
fccSet = 1;
}
MAYBE_REDRAW (menu->redraw);
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_COMPOSE_EDIT_MESSAGE:
if (Editor && (mutt_strcmp ("builtin", Editor) != 0) && !option (OPTEDITHDRS))
{
mutt_edit_file (Editor, msg->content->filename);
mutt_update_encoding (msg->content);
menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
}
/* fall through */
case OP_COMPOSE_EDIT_HEADERS:
- if (op == OP_COMPOSE_EDIT_HEADERS ||
- (op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS)))
+ if (mutt_strcmp ("builtin", Editor) != 0 &&
+ (op == OP_COMPOSE_EDIT_HEADERS ||
+ (op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS))))
{
char *tag = NULL, *err = NULL;
mutt_env_to_local (msg->env);
menu->max = idxlen;
}
- menu->redraw = REDRAW_FULL;
+ menu->redraw = REDRAW_FULL;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
unset_option(OPTNEEDREDRAW);
}
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_COMPOSE_ATTACH_FILE:
menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
}
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_COMPOSE_ATTACH_MESSAGE:
#ifdef USE_NNTP
Sort = oldSort;
SortAux = oldSortAux;
}
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_DELETE:
CHECK_COUNT;
msg->content = idx[0]->content;
menu->redraw |= REDRAW_STATUS;
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
#define CURRENT idx[menu->current]->content
else
mutt_message (_("The current attachment will be converted."));
menu->redraw = REDRAW_CURRENT;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
}
#undef CURRENT
mutt_str_replace (&idx[menu->current]->content->description, buf);
menu->redraw = REDRAW_CURRENT;
}
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_COMPOSE_UPDATE_ENCODING:
CHECK_COUNT;
mutt_update_encoding(idx[menu->current]->content);
menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
}
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
case OP_COMPOSE_TOGGLE_DISPOSITION:
menu->redraw = REDRAW_CURRENT;
}
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_COMPOSE_EDIT_ENCODING:
CHECK_COUNT;
else
mutt_error _("Invalid encoding.");
}
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_COMPOSE_SEND_MESSAGE:
+
+ /* Note: We don't invoke send2-hook here, since we want to leave
+ * users an opportunity to change settings from the ":" prompt.
+ */
if(check_attachments(idx, idxlen) != 0)
{
mutt_edit_file (NONULL(Editor), idx[menu->current]->content->filename);
mutt_update_encoding (idx[menu->current]->content);
menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
case OP_COMPOSE_TOGGLE_UNLINK:
menu->current++;
# endif
menu->redraw = REDRAW_INDEX;
+ /* No send2hook since this doesn't change the message. */
break;
case OP_COMPOSE_GET_ATTACHMENT:
else if (mutt_get_tmp_attachment(idx[menu->current]->content) == 0)
menu->redraw = REDRAW_CURRENT;
+ /* No send2hook since this doesn't change the message. */
break;
case OP_COMPOSE_RENAME_FILE:
mutt_stamp_attachment(idx[menu->current]->content);
}
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_COMPOSE_NEW_MIME:
{
menu->redraw = REDRAW_FULL;
}
}
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_COMPOSE_EDIT_MIME:
CHECK_COUNT;
mutt_update_encoding (idx[menu->current]->content);
menu->redraw = REDRAW_FULL;
}
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_VIEW_ATTACH:
case OP_DISPLAY_HEADERS:
CHECK_COUNT;
mutt_attach_display_loop (menu, op, NULL, NULL, NULL, &idx, &idxlen, NULL, 0);
menu->redraw = REDRAW_FULL;
+ /* no send2hook, since this doesn't modify the message */
break;
case OP_SAVE:
CHECK_COUNT;
mutt_save_attachment_list (NULL, menu->tagprefix, menu->tagprefix ? msg->content : idx[menu->current]->content, NULL, menu);
MAYBE_REDRAW (menu->redraw);
+ /* no send2hook, since this doesn't modify the message */
break;
case OP_PRINT:
CHECK_COUNT;
mutt_print_attachment_list (NULL, menu->tagprefix, menu->tagprefix ? msg->content : idx[menu->current]->content);
+ /* no send2hook, since this doesn't modify the message */
break;
case OP_PIPE:
CHECK_COUNT;
mutt_pipe_attachment_list (NULL, menu->tagprefix, menu->tagprefix ? msg->content : idx[menu->current]->content, op == OP_FILTER);
if (op == OP_FILTER) /* cte might have changed */
- menu->redraw = menu->tagprefix ? REDRAW_FULL : REDRAW_CURRENT;
+ menu->redraw = menu->tagprefix ? REDRAW_FULL : REDRAW_CURRENT;
menu->redraw |= REDRAW_STATUS;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
case OP_EXIT:
}
msg->security = 0;
}
- msg->security = pgp_send_menu (msg, &menu->redraw);
+ msg->security = crypt_pgp_send_menu (msg, &menu->redraw);
redraw_crypt_lines (msg);
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
case OP_FORGET_PASSPHRASE:
}
msg->security = 0;
}
- msg->security = smime_send_menu(msg, &menu->redraw);
+ msg->security = crypt_smime_send_menu(msg, &menu->redraw);
redraw_crypt_lines (msg);
- break;
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
#ifdef MIXMASTER
case OP_COMPOSE_MIX:
mix_make_chain (&msg->chain, &menu->redraw);
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
#endif