# include "config.h"
#endif
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <sys/utsname.h>
+
#include <lib-lib/mem.h>
#include <lib-lib/ascii.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
+#include <lib-lib/debug.h>
+
+#include <lib-sys/exit.h>
+#include <lib-sys/mutt_signal.h>
#include <lib-mime/mime.h>
+#include <lib-ui/curses.h>
+
#include "mutt.h"
#include "handler.h"
#include "recvattach.h"
-#include "mutt_curses.h"
#include "mx.h"
#include "copy.h"
#include "pager.h"
#include "charset.h"
-#include "mutt_crypt.h"
+#include <lib-crypt/crypt.h>
#include "mutt_idna.h"
-#include "lib/debug.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <ctype.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <sys/utsname.h>
-
#ifdef USE_LIBESMTP
# include "mutt_libesmtp.h"
#endif /* USE_LIBESMTP */
return (ferror (f) ? -1 : 0);
}
-# define write_as_text_part(a) (mutt_is_text_part(a) \
- || ((WithCrypto & APPLICATION_PGP)\
- && mutt_is_application_pgp(a)))
+# define write_as_text_part(a) (mutt_is_text_part(a) || mutt_is_application_pgp(a))
int mutt_write_mime_body (BODY * a, FILE * f)
{
}
/* This is pretty gross, but it's the best solution for now... */
- if ((WithCrypto & APPLICATION_PGP)
- && a->type == TYPEAPPLICATION
- && m_strcmp(a->subtype, "pgp-encrypted") == 0) {
+ if (a->type == TYPEAPPLICATION && !m_strcmp(a->subtype, "pgp-encrypted")) {
fputs ("Version: 1\n", f);
return 0;
}
snprintf (buf, sizeof (buf), "%s/.mime.types", NONULL (Homedir));
break;
case 1:
- m_strcpy(buf, sizeof(buf), SYSCONFDIR "/muttng-mime.types");
+ m_strcpy(buf, sizeof(buf), SYSCONFDIR "/madmutt-mime.types");
break;
case 2:
m_strcpy(buf, sizeof(buf), PKGDATADIR "/mime.types");
BODY *body;
FILE *fp;
int cmflags, chflags;
- int pgp = WithCrypto ? hdr->security : 0;
+ int pgp = hdr->security;
- if (WithCrypto) {
- if ((option (OPTMIMEFORWDECODE) || option (OPTFORWDECRYPT)) &&
- (hdr->security & ENCRYPT)) {
- if (!crypt_valid_passphrase (hdr->security))
- return (NULL);
- }
+ if ((option (OPTMIMEFORWDECODE) || option (OPTFORWDECRYPT)) &&
+ (hdr->security & ENCRYPT)) {
+ if (!crypt_valid_passphrase (hdr->security))
+ return (NULL);
}
mutt_mktemp (buffer);
if (!attach_msg && option (OPTMIMEFORWDECODE)) {
chflags |= CH_MIME | CH_TXTPLAIN;
cmflags = M_CM_DECODE | M_CM_CHARCONV;
- if ((WithCrypto & APPLICATION_PGP))
- pgp &= ~PGPENCRYPT;
- if ((WithCrypto & APPLICATION_SMIME))
- pgp &= ~SMIMEENCRYPT;
+ pgp &= ~(PGPENCRYPT|SMIMEENCRYPT);
}
- else if (WithCrypto && option (OPTFORWDECRYPT) && (hdr->security & ENCRYPT)) {
- if ((WithCrypto & APPLICATION_PGP)
- && mutt_is_multipart_encrypted (hdr->content)) {
+ else if (option (OPTFORWDECRYPT) && (hdr->security & ENCRYPT)) {
+ if (mutt_is_multipart_encrypted (hdr->content)) {
chflags |= CH_MIME | CH_NONEWLINE;
cmflags = M_CM_DECODE_PGP;
pgp &= ~PGPENCRYPT;
}
- else if ((WithCrypto & APPLICATION_PGP)
- && (mutt_is_application_pgp (hdr->content) & PGPENCRYPT)) {
+ else if (mutt_is_application_pgp (hdr->content) & PGPENCRYPT) {
chflags |= CH_MIME | CH_TXTPLAIN;
cmflags = M_CM_DECODE | M_CM_CHARCONV;
pgp &= ~PGPENCRYPT;
}
- else if ((WithCrypto & APPLICATION_SMIME)
- && mutt_is_application_smime (hdr->content) & SMIMEENCRYPT) {
+ else if (mutt_is_application_smime (hdr->content) & SMIMEENCRYPT) {
chflags |= CH_MIME | CH_TXTPLAIN;
cmflags = M_CM_DECODE | M_CM_CHARCONV;
pgp &= ~SMIMEENCRYPT;
fflush (fp);
rewind (fp);
- body->hdr = mutt_new_header ();
+ body->hdr = header_new();
body->hdr->offset = 0;
/* we don't need the user headers here */
body->hdr->env = mutt_read_rfc822_header (fp, body->hdr, 0, 0);
- if (WithCrypto)
- body->hdr->security = pgp;
+ body->hdr->security = pgp;
mutt_update_encoding (body);
body->parts = body->hdr->content;
/* need to write the list in reverse because they are stored in reverse order
* when parsed to speed up threading
*/
-void mutt_write_references (LIST * r, FILE * f)
+void mutt_write_references (string_list_t * r, FILE * f)
{
- LIST **ref = NULL;
+ string_list_t **ref = NULL;
int refcnt = 0, refmax = 0;
for (; (TrimRef == 0 || refcnt < TrimRef) && r; r = r->next) {
{
char buffer[LONG_STRING];
char *p;
- LIST *tmp = env->userhdrs;
+ string_list_t *tmp = env->userhdrs;
int has_agent = 0; /* user defined user-agent header field exists */
list2_t* hdrs = list_from_str (EditorHeaders, " ");
return (ferror (fp) == 0 ? 0 : -1);
}
-static void encode_headers (LIST * h)
+static void encode_headers (string_list_t * h)
{
char *tmp;
char *p;
if ((i = send_msg (path, args, msg, &childout)) != (EX_OK & 0xff)) {
if (i != S_BKG) {
- const char *e = mutt_strsysexit (i);
-
- e = mutt_strsysexit (i);
mutt_error (_("Error sending message, child exited %d (%s)."), i,
- NONULL (e));
+ m_strsysexit(i));
if (childout) {
struct stat st;
void mutt_unprepare_envelope (ENVELOPE * env)
{
- LIST *item;
+ string_list_t *item;
for (item = env->userhdrs; item; item = item->next)
rfc2047_decode (&item->data);
- address_delete (&env->mail_followup_to);
+ address_list_wipe(&env->mail_followup_to);
/* back conversions */
rfc2047_decode_adrlist (env->to);
ret = _mutt_bounce_message (fp, h, to, resent_from, from);
- address_delete (&from);
+ address_list_wipe(&from);
return ret;
}
*last = addr->next;
addr->next = NULL;
- address_delete (&addr);
+ address_list_wipe(&addr);
addr = *last;
}
/* (postponment) if the mail is to be signed or encrypted, save this info */
- if ((WithCrypto & APPLICATION_PGP)
- && post && (hdr->security & APPLICATION_PGP)) {
+ if (post && (hdr->security & APPLICATION_PGP)) {
fputs ("X-Mutt-PGP: ", msg->fp);
if (hdr->security & ENCRYPT)
fputc ('E', msg->fp);
}
/* (postponment) if the mail is to be signed or encrypted, save this info */
- if ((WithCrypto & APPLICATION_SMIME)
- && post && (hdr->security & APPLICATION_SMIME)) {
+ if (post && (hdr->security & APPLICATION_SMIME)) {
fputs ("X-Mutt-SMIME: ", msg->fp);
if (hdr->security & ENCRYPT) {
fputc ('E', msg->fp);
*/
if (post && hdr->chain && hdr->chain) {
- LIST *p;
+ string_list_t *p;
fputs ("X-Mutt-Mix:", msg->fp);
for (p = hdr->chain; p; p = p->next)