From 5fbd8a74d24624a118c9b835b136c73b8da076d7 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sat, 11 Aug 2007 13:10:24 +0200 Subject: [PATCH] Drop mixmaster support. I don't like people caring about being anonymous that much. Signed-off-by: Pierre Habouzit --- CMakeLists.txt | 5 - OPS | 7 - compose.c | 40 --- config.h.cmake | 4 - dotlock.c | 4 +- functions.def | 10 - globals.h | 3 - headers.c | 2 +- init.h | 22 -- keymap.c | 8 - keymap.h | 1 - lib-mime/mime-types.h | 2 - lib-mime/mime.cpkg | 1 - lib-mx/hcache.c | 1 - main.c | 1 - postpone.c | 22 -- protos.h | 2 +- remailer.c | 700 ------------------------------------------ remailer.h | 21 -- send.c | 8 +- sendlib.c | 32 +- 21 files changed, 10 insertions(+), 886 deletions(-) delete mode 100644 remailer.c delete mode 100644 remailer.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 0845d34..1d393b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,10 +43,6 @@ FIND_FILE(SENDMAIL sendmail PATHS /usr/sbin /sbin /usr/lib DOC "path to sendmail executable" ) -FIND_FILE(MIXMASTER mixmaster DOC "path to mixmaster") -IF(NOT MIXMASTER) - SET(MIXMASTER "mixmaster") -ENDIF(NOT MIXMASTER) IF(NOT MAILPATH) IF(EXISTS /var/mail) @@ -303,7 +299,6 @@ MADMUTT_SOURCES(madmuttsrc madmuttgen postpone.c recvattach.c recvcmd.c - remailer.c send.c sendlib.c sort.c diff --git a/OPS b/OPS index 514bb10..fb8bc8d 100644 --- a/OPS +++ b/OPS @@ -211,10 +211,3 @@ OP_COMPOSE_SMIME_MENU "show S/MIME options" OP_DECRYPT_SAVE "make decrypted copy and delete" OP_DECRYPT_COPY "make decrypted copy" OP_EXTRACT_KEYS "extract supported public keys" -OP_MIX_USE "Accept the chain constructed" -OP_MIX_APPEND "Append a remailer to the chain" -OP_MIX_INSERT "Insert a remailer into the chain" -OP_MIX_DELETE "Delete a remailer from the chain" -OP_MIX_CHAIN_PREV "Select the previous element of the chain" -OP_MIX_CHAIN_NEXT "Select the next element of the chain" -OP_COMPOSE_MIX "send the message through a mixmaster remailer chain" diff --git a/compose.c b/compose.c index 6fa6ad3..8ad53e8 100644 --- a/compose.c +++ b/compose.c @@ -30,7 +30,6 @@ #include "sort.h" #include "charset.h" #include "buffy.h" -#include "remailer.h" #ifdef USE_NNTP #include "nntp.h" @@ -50,7 +49,6 @@ enum { HDR_SUBJECT, HDR_REPLYTO, HDR_FCC, - HDR_MIX, HDR_CRYPT, HDR_CRYPTINFO, @@ -140,35 +138,6 @@ static void redraw_crypt_lines (HEADER * msg) } } -static void redraw_mix_line (string_list_t * chain) -{ - int c; - const char *t; - - mvwaddstr (stdscr, HDR_MIX, SW, " Mix: "); - - if (!chain) { - waddstr (stdscr, ""); - wclrtoeol (stdscr); - return; - } - - for (c = 12; chain; chain = chain->next) { - t = chain->data; - if (t && t[0] == '0' && t[1] == '\0') - t = ""; - - if (c + m_strlen(t) + 2 >= COLS - SW) - break; - - waddstr (stdscr, NONULL (t)); - if (chain->next) - waddstr (stdscr, ", "); - - c += m_strlen(t) + 2; - } -} - static int check_attachments (ATTACHPTR ** idx, short idxlen) { int i, r; @@ -232,7 +201,6 @@ static void draw_envelope (HEADER * msg, char *fcc) mutt_paddstr (W, fcc); redraw_crypt_lines (msg); - redraw_mix_line (msg->chain); SETCOLOR (MT_COLOR_STATUS); mvwaddstr (stdscr, HDR_ATTACH - 1, SW, _("-- Attachments")); @@ -925,9 +893,6 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ break; } - if (msg->chain && mix_check_message (msg) != 0) - break; - if (!fccSet && *fcc) { if ((i = query_quadoption (OPT_COPY, _("Save a copy of this message?"))) == -1) @@ -1201,11 +1166,6 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ redraw_crypt_lines (msg); mutt_message_hook (NULL, msg, M_SEND2HOOK); break; - - case OP_COMPOSE_MIX: - mix_make_chain (&msg->chain, &menu->redraw); - mutt_message_hook (NULL, msg, M_SEND2HOOK); - break; } /* Draw formated compose status line */ diff --git a/config.h.cmake b/config.h.cmake index 54a3be7..32d8734 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1,10 +1,6 @@ #cmakedefine PACKAGE "${PACKAGE}" #cmakedefine MAILPATH "${MAILPATH}" #cmakedefine SENDMAIL "${SENDMAIL}" -#cmakedefine MIXMASTER "${MIXMASTER}" -#ifndef MIXMASTER -#define MIXMASTER "mixmaster" -#endif /* headers */ #cmakedefine HAVE_ALLOCA_H 1 diff --git a/dotlock.c b/dotlock.c index 8f1f308..94f569f 100644 --- a/dotlock.c +++ b/dotlock.c @@ -422,11 +422,9 @@ dotlock_expand_link (char *newpath, const char *path, const char *flink) /* * Deference a chain of symbolic links - * - * The final path is written to d. * + * The final path is written to d. */ - static int dotlock_deference_symlink (char *d, size_t l, const char *path) { struct stat sb; diff --git a/functions.def b/functions.def index d681100..c4b730d 100644 --- a/functions.def +++ b/functions.def @@ -366,7 +366,6 @@ LIST(OpCompose) ITEM("pipe-entry", OP_PIPE, "|") ITEM("pgp-menu", OP_COMPOSE_PGP_MENU, "p") ITEM("smime-menu", OP_COMPOSE_SMIME_MENU, "S") - ITEM("mix", OP_COMPOSE_MIX, "M") ENDLIST LIST(OpPost) @@ -453,15 +452,6 @@ LIST(OpSmime) #endif ENDLIST -LIST(OpMix) - ITEM("accept", OP_MIX_USE, "\n") - ITEM("append", OP_MIX_APPEND, "a") - ITEM("insert", OP_MIX_INSERT, "i") - ITEM("delete", OP_MIX_DELETE, "d") - ITEM("chain-prev", OP_MIX_CHAIN_PREV, "") - ITEM("chain-next", OP_MIX_CHAIN_NEXT, "") -ENDLIST - #undef ENDLIST #undef ITEM #undef LIST diff --git a/globals.h b/globals.h index 46473fc..ee1a94a 100644 --- a/globals.h +++ b/globals.h @@ -67,9 +67,6 @@ WHERE rx_t StripWasRegexp; WHERE char *Preconnect INITVAL (NULL); WHERE char *Tunnel INITVAL (NULL); WHERE short NetInc; - -WHERE char *Mixmaster; -WHERE char *MixEntryFormat; WHERE char *Muttrc INITVAL (NULL); #ifdef USE_NNTP diff --git a/headers.c b/headers.c index 65c3708..efd7caf 100644 --- a/headers.c +++ b/headers.c @@ -35,7 +35,7 @@ void mutt_edit_headers(const char *body, } mutt_env_to_local (msg->env); - mutt_write_rfc822_header (ofp, msg->env, NULL, 1, 0); + mutt_write_rfc822_header (ofp, msg->env, NULL, 1); fputc ('\n', ofp); /* tie off the header. */ /* now copy the body of the message. */ diff --git a/init.h b/init.h index 1cbfc55..70ba04e 100644 --- a/init.h +++ b/init.h @@ -1096,28 +1096,6 @@ struct option_t MuttVars[] = { ** menu, attachments which cannot be decoded in a reasonable manner will ** be attached to the newly composed message if this option is set. */ - {"mix_entry_format", DT_STR, R_NONE, UL &MixEntryFormat, "%4n %c %-16s %a"}, - /* - ** .pp - ** This variable describes the format of a remailer line on the mixmaster - ** chain selection screen. The following \fTprintf(3)\fP-like sequences are - ** supported: - ** .pp - ** .dl - ** .dt %n .dd The running number on the menu. - ** .dt %c .dd Remailer capabilities. - ** .dt %s .dd The remailer's short name. - ** .dt %a .dd The remailer's e-mail address. - ** .de - */ - {"mixmaster", DT_PATH, R_NONE, UL &Mixmaster, MIXMASTER}, - /* - ** .pp - ** This variable contains the path to the Mixmaster binary on your - ** system. It is used with various sets of parameters to gather the - ** list of known remailers, and to finally send a message through the - ** mixmaster chain. - */ {"move", DT_QUAD, R_NONE, OPT_MOVE, "ask-no" }, /* ** .pp diff --git a/keymap.c b/keymap.c index ccce5c7..5e32da0 100644 --- a/keymap.c +++ b/keymap.c @@ -36,7 +36,6 @@ struct mapping_t Menus[] = { {"key_select_smime", MENU_KEY_SELECT_SMIME}, #endif - {"mix", MENU_MIX}, {"query", MENU_QUERY}, {"generic", MENU_GENERIC}, {NULL, 0} @@ -503,11 +502,6 @@ void km_init (void) create_bindings (OpSmime, MENU_SMIME); create_bindings (OpPgp, MENU_KEY_SELECT_PGP); create_bindings (OpSmime, MENU_KEY_SELECT_SMIME); - create_bindings (OpMix, MENU_MIX); - - km_bindkey ("", MENU_MIX, OP_GENERIC_SELECT_ENTRY); - km_bindkey ("h", MENU_MIX, OP_MIX_CHAIN_PREV); - km_bindkey ("l", MENU_MIX, OP_MIX_CHAIN_NEXT); /* bindings for the line editor */ create_bindings (OpEditor, MENU_EDITOR); @@ -720,8 +714,6 @@ struct binding_t *km_get_table (int menu) return OpPgp; case MENU_KEY_SELECT_SMIME: return OpSmime; - case MENU_MIX: - return OpMix; } return NULL; } diff --git a/keymap.h b/keymap.h index 0a0d428..5e2bb87 100644 --- a/keymap.h +++ b/keymap.h @@ -58,7 +58,6 @@ enum { MENU_SMIME, MENU_KEY_SELECT_PGP, MENU_KEY_SELECT_SMIME, - MENU_MIX, MENU_MAX }; diff --git a/lib-mime/mime-types.h b/lib-mime/mime-types.h index daf1ce2..c57c90e 100644 --- a/lib-mime/mime-types.h +++ b/lib-mime/mime-types.h @@ -331,8 +331,6 @@ see: crypt.h pgplib.h, smime.h */ short attach_total; - string_list_t *chain; - int refno; /* message number on server */ void *data; /* driver-specific data */ diff --git a/lib-mime/mime.cpkg b/lib-mime/mime.cpkg index ddb7a14..de979ee 100644 --- a/lib-mime/mime.cpkg +++ b/lib-mime/mime.cpkg @@ -333,7 +333,6 @@ void header_wipe(HEADER *h) p_delete(&h->maildir_flags); p_delete(&h->tree); p_delete(&h->path); - string_list_wipe(&h->chain); p_delete(&h->data); } diff --git a/lib-mx/hcache.c b/lib-mx/hcache.c index c3fca8d..c3ab701 100644 --- a/lib-mx/hcache.c +++ b/lib-mx/hcache.c @@ -59,7 +59,6 @@ static int generate_crc32(void) crc = crc32(crc, mod_cset.charset, m_strlen(mod_cset.charset)); #endif crc = crc32(crc, "USE_POP", m_strlen("USE_POP")); - crc = crc32(crc, "MIXMASTER", m_strlen("MIXMASTER")); crc = crc32(crc, "USE_IMAP", m_strlen("USE_IMAP")); #ifdef USE_NNTP crc = crc32(crc, "USE_NNTP", m_strlen("USE_NNTP")); diff --git a/main.c b/main.c index f7e3193..3d8f6ef 100644 --- a/main.c +++ b/main.c @@ -209,7 +209,6 @@ static void show_version (void) printf (" +PKGDATADIR=\"%s\"\n", PKGDATADIR); printf (" +PKGDOCDIR=\"%s\"\n", PKGDOCDIR); printf (" +SYSCONFDIR=\"%s\"\n", SYSCONFDIR); - printf (" +MIXMASTER=\"%s\"\n\n", MIXMASTER); puts (_("MadMutt is based on Madmutt wich was based on Mutt before\n")); diff --git a/postpone.c b/postpone.c index e5a3629..4cabf1d 100644 --- a/postpone.c +++ b/postpone.c @@ -325,26 +325,6 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc, string_list_wipe(&tmp); tmp = next; } - else if (m_strncmp("X-Mutt-Mix:", tmp->data, 11) == 0) { - char *t; - - string_list_wipe(&hdr->chain); - - t = strtok (tmp->data + 11, " \t\n"); - while (t) { - hdr->chain = mutt_add_list (hdr->chain, t); - t = strtok (NULL, " \t\n"); - } - - next = tmp->next; - if (last) - last->next = tmp->next; - else - hdr->env->userhdrs = tmp->next; - tmp->next = NULL; - string_list_wipe(&tmp); - tmp = next; - } else { last = tmp; tmp = tmp->next; @@ -353,8 +333,6 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc, return (code); } - - int mutt_parse_crypt_hdr (char *p, int set_signas) { int pgp = 0; diff --git a/protos.h b/protos.h index 0a7c85d..2282b8f 100644 --- a/protos.h +++ b/protos.h @@ -135,7 +135,7 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid, int, char *); int mutt_write_mime_body (BODY *, FILE *); int mutt_write_mime_header (BODY *, FILE *); -int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, int, int); +int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, int); void mutt_sleep (short); int mutt_save_confirm (const char *, struct stat *); diff --git a/remailer.c b/remailer.c deleted file mode 100644 index 1118345..0000000 --- a/remailer.c +++ /dev/null @@ -1,700 +0,0 @@ -/* - * Copyright notice from original mutt: - * Copyright (C) 1999-2000 Thomas Roessler - * - * This file is part of mutt-ng, see http://www.muttng.org/. - * It's licensed under the GNU General Public License, - * please see the file GPL in the top level source directory. - */ - -/* - * Mixmaster support for Mutt - */ - -#include - -#include -#include -#include - -#include "mutt.h" -#include "recvattach.h" - -#include "remailer.h" - -#define SW (option(OPTMBOXPANE)?SidebarWidth:0) - -#define MIX_CAP_COMPRESS (1 << 0) -#define MIX_CAP_MIDDLEMAN (1 << 1) -#define MIX_CAP_NEWSPOST (1 << 2) -#define MIX_CAP_NEWSMAIL (1 << 3) - -/* Mixmaster's maximum chain length. Don't change this. */ -#define MAXMIXES 19 - -typedef struct remailer_t { - int num; - int caps; - char *shortname; - char *addr; - char *ver; -} remailer_t; - -DO_INIT(remailer_t, remailer); -static void remailer_wipe(remailer_t *remailer) { - p_delete(&remailer->shortname); - p_delete(&remailer->addr); - p_delete(&remailer->ver); -} -DO_NEW(remailer_t, remailer); -DO_DELETE(remailer_t, remailer); - -typedef struct mixchain_t { - ssize_t cl; - int ch[MAXMIXES]; -} mixchain_t; - -struct coord { - short r, c; -}; - -static int mix_get_caps(const char *capstr) -{ - int caps = 0; - - while (*capstr) { - switch (*capstr) { - case 'C': - caps |= MIX_CAP_COMPRESS; - break; - - case 'M': - caps |= MIX_CAP_MIDDLEMAN; - break; - - case 'N': - switch (*++capstr) { - case 'm': - caps |= MIX_CAP_NEWSMAIL; - break; - - case 'p': - caps |= MIX_CAP_NEWSPOST; - break; - - } - } - - if (*capstr) - capstr++; - } - - return caps; -} - -static void mix_add_entry(remailer_t ***type2_list, remailer_t *entry, - ssize_t *slots, ssize_t *used) -{ - if (*used == *slots) { - *slots += 5; - p_realloc(type2_list, *slots); - } - - (*type2_list)[(*used)++] = entry; - if (entry) - entry->num = *used; -} - -/* parse the type2.list as given by mixmaster -T */ -static remailer_t **mix_type2_list (ssize_t * l) -{ - FILE *fp; - pid_t mm_pid; - int devnull; - - char cmd[HUGE_STRING + _POSIX_PATH_MAX]; - char line[HUGE_STRING]; - char *t; - - remailer_t **type2_list = NULL, *p; - ssize_t slots = 0, used = 0; - - if (!l) - return NULL; - - if ((devnull = open ("/dev/null", O_RDWR)) == -1) - return NULL; - - snprintf (cmd, sizeof (cmd), "%s -T", Mixmaster); - - if ((mm_pid = - mutt_create_filter_fd (cmd, NULL, &fp, NULL, devnull, -1, - devnull)) == -1) { - close (devnull); - return NULL; - } - - /* first, generate the "random" remailer */ - - p = remailer_new(); - p->shortname = m_strdup(""); - mix_add_entry (&type2_list, p, &slots, &used); - - while (fgets (line, sizeof (line), fp)) { - p = remailer_new(); - - if (!(t = strtok (line, " \t\n"))) - goto problem; - - p->shortname = m_strdup(t); - - if (!(t = strtok (NULL, " \t\n"))) - goto problem; - - p->addr = m_strdup(t); - - if (!(t = strtok (NULL, " \t\n"))) - goto problem; - - if (!(t = strtok (NULL, " \t\n"))) - goto problem; - - p->ver = m_strdup(t); - - if (!(t = strtok (NULL, " \t\n"))) - goto problem; - - p->caps = mix_get_caps (t); - - mix_add_entry (&type2_list, p, &slots, &used); - continue; - -problem: - remailer_delete(&p); - } - - *l = used; - - mix_add_entry (&type2_list, NULL, &slots, &used); - mutt_wait_filter (mm_pid); - - close (devnull); - - return type2_list; -} - -static void mix_free_type2_list (remailer_t *** ttlp) -{ - int i; - remailer_t **type2_list = *ttlp; - - for (i = 0; type2_list[i]; i++) - remailer_delete(&type2_list[i]); - - p_delete(type2_list); -} - - -#define MIX_HOFFSET 2 -#define MIX_VOFFSET (LINES - 6) -#define MIX_MAXROW (LINES - 3) - - -static void mix_screen_coordinates (remailer_t ** type2_list, - struct coord **coordsp, - mixchain_t * chain, int i) -{ - short c, r, oc; - struct coord *coords; - - if (!chain->cl) - return; - - p_realloc(coordsp, chain->cl); - - coords = *coordsp; - - if (i) { - c = - coords[i - 1].c + m_strlen(type2_list[chain->ch[i - 1]]->shortname) + 2; - r = coords[i - 1].r; - } - else { - r = MIX_VOFFSET; - c = MIX_HOFFSET; - } - - - for (; i < chain->cl; i++) { - oc = c; - c += m_strlen(type2_list[chain->ch[i]]->shortname) + 2; - - if (c >= COLS) { - oc = c = MIX_HOFFSET; - r++; - } - - coords[i].c = oc; - coords[i].r = r; - - } - -} - -static void mix_redraw_ce (remailer_t ** type2_list, - struct coord *coords, - mixchain_t * chain, int i, short selected) -{ - if (!coords || !chain) - return; - - if (coords[i].r < MIX_MAXROW) { - - if (selected) - SETCOLOR (MT_COLOR_INDICATOR); - else - SETCOLOR (MT_COLOR_NORMAL); - - mvwaddstr (stdscr, coords[i].r, coords[i].c, type2_list[chain->ch[i]]->shortname); - SETCOLOR (MT_COLOR_NORMAL); - - if (i + 1 < chain->cl) - waddstr (stdscr, ", "); - } -} - -static void mix_redraw_chain (remailer_t ** type2_list, - struct coord *coords, mixchain_t * chain, int cur) -{ - int i; - - SETCOLOR (MT_COLOR_NORMAL); - BKGDSET (MT_COLOR_NORMAL); - - for (i = MIX_VOFFSET; i < MIX_MAXROW; i++) { - wmove (stdscr, i, 0); - wclrtoeol (stdscr); - } - - for (i = 0; i < chain->cl; i++) - mix_redraw_ce (type2_list, coords, chain, i, i == cur); -} - -static void mix_redraw_head (mixchain_t * chain) -{ - SETCOLOR (MT_COLOR_STATUS); - mvwprintw (stdscr, MIX_VOFFSET - 1, 0, "-- Remailer chain [Length: %d]", - chain ? chain->cl : 0); - - BKGDSET (MT_COLOR_STATUS); - wclrtoeol (stdscr); - - BKGDSET (MT_COLOR_NORMAL); - SETCOLOR (MT_COLOR_NORMAL); -} - -static const char *mix_format_caps (remailer_t * r) -{ - static char capbuff[10]; - char *t = capbuff; - - if (r->caps & MIX_CAP_COMPRESS) - *t++ = 'C'; - else - *t++ = ' '; - - if (r->caps & MIX_CAP_MIDDLEMAN) - *t++ = 'M'; - else - *t++ = ' '; - - if (r->caps & MIX_CAP_NEWSPOST) { - *t++ = 'N'; - *t++ = 'p'; - } - else { - *t++ = ' '; - *t++ = ' '; - } - - if (r->caps & MIX_CAP_NEWSMAIL) { - *t++ = 'N'; - *t++ = 'm'; - } - else { - *t++ = ' '; - *t++ = ' '; - } - - *t = '\0'; - - return capbuff; -} - -/* - * Format an entry for the remailer menu. - * - * %n number - * %c capabilities - * %s short name - * %a address - * - */ -static const char * -mix_entry_fmt (char *dest, ssize_t destlen, char op, const char *src, - const char *prefix, const char *ifstr, - const char *elstr, anytype data, format_flag flags) -{ - char fmt[16]; - remailer_t *remailer = data.ptr; - int optional = (flags & M_FORMAT_OPTIONAL); - - switch (op) { - case 'n': - if (!optional) { - snprintf (fmt, sizeof (fmt), "%%%sd", prefix); - snprintf (dest, destlen, fmt, remailer->num); - } - break; - case 'c': - if (!optional) { - snprintf (fmt, sizeof (fmt), "%%%ss", prefix); - snprintf (dest, destlen, fmt, mix_format_caps (remailer)); - } - break; - case 's': - if (!optional) { - snprintf (fmt, sizeof (fmt), "%%%ss", prefix); - snprintf (dest, destlen, fmt, NONULL (remailer->shortname)); - } - else if (!remailer->shortname) - optional = 0; - break; - case 'a': - if (!optional) { - snprintf (fmt, sizeof (fmt), "%%%ss", prefix); - snprintf (dest, destlen, fmt, NONULL (remailer->addr)); - } - else if (!remailer->addr) - optional = 0; - break; - - default: - *dest = '\0'; - } - - if (flags & M_FORMAT_OPTIONAL) - m_strformat(dest, destlen, 0, optional ? ifstr : elstr, - mutt_attach_fmt, data, 0); - return (src); -} - - - -static void mix_entry (char *b, ssize_t blen, MUTTMENU * menu, int num) -{ - remailer_t **type2_list = (remailer_t **) menu->data; - - m_strformat(b, blen, COLS - SW, MixEntryFormat, mix_entry_fmt, - type2_list[num], 0); -} - -static int mix_chain_add (mixchain_t * chain, const char *s, - remailer_t ** type2_list) -{ - int i; - - if (chain->cl >= MAXMIXES) - return -1; - - if (!m_strcmp(s, "0") || !ascii_strcasecmp (s, "")) { - chain->ch[chain->cl++] = 0; - return 0; - } - - for (i = 0; type2_list[i]; i++) { - if (!ascii_strcasecmp (s, type2_list[i]->shortname)) { - chain->ch[chain->cl++] = i; - return 0; - } - } - - /* replace unknown remailers by */ - - if (!type2_list[i]) - chain->ch[chain->cl++] = 0; - - return 0; -} - -void mix_make_chain (string_list_t ** chainp, int *redraw) -{ - string_list_t *p; - mixchain_t *chain; - int c_cur = 0, c_old = 0; - int m_len; - short c_redraw = 1; - - remailer_t **type2_list = NULL; - ssize_t ttll = 0; - - struct coord *coords = NULL; - - MUTTMENU *menu; - short loop = 1; - int op; - - int i, j; - const char *t; - - if (!(type2_list = mix_type2_list (&ttll))) { - mutt_error _("Can't get mixmaster's type2.list!"); - - return; - } - - *redraw = REDRAW_FULL; - - chain = p_new(mixchain_t, 1); - for (p = *chainp; p; p = p->next) - mix_chain_add (chain, (char *) p->data, type2_list); - - string_list_wipe(chainp); - - /* safety check */ - for (i = 0; i < chain->cl; i++) { - if (chain->ch[i] >= ttll) - chain->ch[i] = 0; - } - - mix_screen_coordinates (type2_list, &coords, chain, 0); - - menu = mutt_new_menu (); - menu->menu = MENU_MIX; - menu->max = ttll; - menu->make_entry = mix_entry; - menu->tag = NULL; - menu->title = _("Select a remailer chain."); - menu->data = type2_list; - - m_len = menu->pagelen = MIX_VOFFSET - menu->offset - 1; - - while (loop) { - if (menu->pagelen != m_len) { - menu->pagelen = m_len; - menu->redraw = REDRAW_FULL; - } - - if (c_redraw) { - mix_redraw_head (chain); - mix_redraw_chain (type2_list, coords, chain, c_cur); - c_redraw = 0; - } - else if (c_cur != c_old) { - mix_redraw_ce (type2_list, coords, chain, c_old, 0); - mix_redraw_ce (type2_list, coords, chain, c_cur, 1); - } - - c_old = c_cur; - - switch ((op = mutt_menuLoop (menu))) { - case OP_REDRAW: - { - menu_redraw_status (menu); - mix_redraw_head (chain); - mix_screen_coordinates (type2_list, &coords, chain, 0); - mix_redraw_chain (type2_list, coords, chain, c_cur); - menu->pagelen = m_len = MIX_VOFFSET - menu->offset - 1; - break; - } - - case OP_EXIT: - { - chain->cl = 0; - loop = 0; - break; - } - - case OP_MIX_USE: - { - if (!chain->cl) { - chain->cl++; - chain->ch[0] = menu->current; - mix_screen_coordinates (type2_list, &coords, chain, c_cur); - c_redraw = 1; - } - - if (chain->cl && chain->ch[chain->cl - 1] && - (type2_list[chain->ch[chain->cl - 1]]->caps & MIX_CAP_MIDDLEMAN)) - { - mutt_error (_ - ("Error: %s can't be used as the final remailer of a chain."), - type2_list[chain->ch[chain->cl - 1]]->shortname); - } - else { - loop = 0; - } - break; - } - - case OP_GENERIC_SELECT_ENTRY: - case OP_MIX_APPEND: - { - if (chain->cl < MAXMIXES && c_cur < chain->cl) - c_cur++; - } - /* fallthrough */ - case OP_MIX_INSERT: - { - if (chain->cl < MAXMIXES) { - chain->cl++; - for (i = chain->cl - 1; i > c_cur; i--) - chain->ch[i] = chain->ch[i - 1]; - - chain->ch[c_cur] = menu->current; - mix_screen_coordinates (type2_list, &coords, chain, c_cur); - c_redraw = 1; - } - else - mutt_error (_("Mixmaster chains are limited to %d elements."), - MAXMIXES); - - break; - } - - case OP_MIX_DELETE: - { - if (chain->cl) { - chain->cl--; - - for (i = c_cur; i < chain->cl; i++) - chain->ch[i] = chain->ch[i + 1]; - - if (c_cur == chain->cl && c_cur) - c_cur--; - - mix_screen_coordinates (type2_list, &coords, chain, c_cur); - c_redraw = 1; - } - else { - mutt_error _("The remailer chain is already empty."); - } - break; - } - - case OP_MIX_CHAIN_PREV: - { - if (c_cur) - c_cur--; - else - mutt_error _("You already have the first chain element selected."); - - break; - } - - case OP_MIX_CHAIN_NEXT: - { - if (chain->cl && c_cur < chain->cl - 1) - c_cur++; - else - mutt_error _("You already have the last chain element selected."); - - break; - } - } - } - - mutt_menuDestroy (&menu); - - /* construct the remailer list */ - - if (chain->cl) { - for (i = 0; i < chain->cl; i++) { - if ((j = chain->ch[i])) - t = type2_list[j]->shortname; - else - t = "*"; - - *chainp = mutt_add_list (*chainp, t); - } - } - - mix_free_type2_list (&type2_list); - p_delete(&coords); - p_delete(&chain); -} - -/* some safety checks before piping the message to mixmaster */ - -int mix_check_message (HEADER * msg) -{ - const char *fqdn; - short need_hostname = 0; - address_t *p; - - if (msg->env->cc || msg->env->bcc) { - mutt_error _("Mixmaster doesn't accept Cc or Bcc headers."); - - return -1; - } - - /* When using mixmaster, we MUST qualify any addresses since - * the message will be delivered through remote systems. - * - * use_domain won't be respected at this point, hidden_host will. - */ - - for (p = msg->env->to; p; p = p->next) { - if (!p->group && strchr (p->mailbox, '@') == NULL) { - need_hostname = 1; - break; - } - } - - if (need_hostname) { - - if (!(fqdn = mutt_fqdn(1))) { - mutt_error - _("Please set the hostname variable to a proper value when using mixmaster!"); - return -1; - } - - /* Cc and Bcc are empty at this point. */ - rfc822_qualify(msg->env->to, fqdn); - rfc822_qualify(msg->env->reply_to, fqdn); - rfc822_qualify(msg->env->mail_followup_to, fqdn); - } - - return 0; -} - -int mix_send_message (string_list_t * chain, const char *tempfile) -{ - char cmd[HUGE_STRING]; - char tmp[HUGE_STRING]; - char cd_quoted[STRING]; - int i; - - snprintf (cmd, sizeof (cmd), "cat %s | %s -m ", tempfile, Mixmaster); - - for (i = 0; chain; chain = chain->next, i = 1) { - m_strcpy(tmp, sizeof(tmp), cmd); - mutt_quote_filename (cd_quoted, sizeof (cd_quoted), (char *) chain->data); - snprintf (cmd, sizeof (cmd), "%s%s%s", tmp, i ? "," : " -l ", cd_quoted); - } - - if (!option (OPTNOCURSES)) - mutt_endwin (NULL); - - if ((i = mutt_system (cmd))) { - fprintf (stderr, _("Error sending message, child exited %d.\n"), i); - if (!option (OPTNOCURSES)) { - mutt_any_key_to_continue (NULL); - mutt_error _("Error sending message."); - } - } - - unlink (tempfile); - return i; -} - diff --git a/remailer.h b/remailer.h deleted file mode 100644 index 9f93bdd..0000000 --- a/remailer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright notice from original mutt: - * Copyright (C) 1999-2000 Thomas Roessler - * - * This file is part of mutt-ng, see http://www.muttng.org/. - * It's licensed under the GNU General Public License, - * please see the file GPL in the top level source directory. - */ - -/* - * Mixmaster support for Mutt - */ - -#ifndef _REMAILER_H -#define _REMAILER_H - -int mix_send_message(string_list_t *, const char *); -int mix_check_message(HEADER * msg); -void mix_make_chain(string_list_t **, int *); - -#endif /* _REMAILER_H */ diff --git a/send.c b/send.c index 5551bad..62207d2 100644 --- a/send.c +++ b/send.c @@ -27,8 +27,6 @@ #include "nntp.h" #endif -#include "remailer.h" - int url_parse_mailto(ENVELOPE *e, char **body, const char *src) { char *t; @@ -994,8 +992,7 @@ static int send_message (HEADER * msg) if (!tempfp) return -1; - mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, - msg->chain ? 1 : 0); + mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0); fputc ('\n', tempfp); /* tie off the header. */ if ((mutt_write_mime_body (msg->content, tempfp) == -1)) { @@ -1010,9 +1007,6 @@ static int send_message (HEADER * msg) return (-1); } - if (msg->chain) - return mix_send_message (msg->chain, tempfile); - i = mutt_invoke_mta (msg->env->from, msg->env->to, msg->env->cc, msg->env->bcc, tempfile, (msg->content->encoding == ENC8BIT)); diff --git a/sendlib.c b/sendlib.c index 5ac02ab..f191e5c 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1342,14 +1342,9 @@ static int edit_header(int mode, const char *s) * mode == 1 => "lite" mode (used for edit_hdrs) * mode == 0 => normal mode. write full header + MIME headers * mode == -1 => write just the envelope info (used for postponing messages) - * - * privacy != 0 => will omit any headers which may identify the user. - * Output generated is suitable for being sent through - * anonymous remailer chains. - * */ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach, - int mode, int privacy) + int mode) { char buffer[LONG_STRING]; char *p; @@ -1359,13 +1354,13 @@ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach, #ifdef USE_NNTP if (!option (OPTNEWSSEND)) #endif - if (mode == 0 && !privacy) + if (mode == 0) fputs (mutt_make_date (buffer, sizeof (buffer)), fp); /* OPTUSEFROM is not consulted here so that we can still write a From: * field if the user sets it with the `my_hdr' command */ - if (env->from && !privacy) { + if (env->from) { buffer[0] = 0; rfc822_addrcat(buffer, sizeof(buffer), env->from, 0); fprintf (fp, "From: %s\n", buffer); @@ -1424,7 +1419,7 @@ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach, fputs ("Subject:\n", fp); /* save message id if the user has set it */ - if (env->message_id && !privacy) + if (env->message_id) fprintf (fp, "Message-ID: %s\n", env->message_id); if (env->reply_to) { @@ -1471,8 +1466,6 @@ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach, /* check to see if the user has overridden the user-agent field */ if (!ascii_strncasecmp ("user-agent", tmp->data, 10)) { has_agent = 1; - if (privacy) - continue; } fputs (tmp->data, fp); @@ -1480,7 +1473,7 @@ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach, } } - if (mode == 0 && !privacy && option (OPTXMAILER) && !has_agent) { + if (mode == 0 && option (OPTXMAILER) && !has_agent) { if (mod_core.operating_system) { fprintf(fp, "User-Agent: %s (%s)\n", mutt_make_version(), mod_core.operating_system); @@ -2096,7 +2089,7 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid, /* post == 1 => postpone message. Set mode = -1 in mutt_write_rfc822_header() * post == 0 => Normal mode. Set mode = 0 in mutt_write_rfc822_header() * */ - mutt_write_rfc822_header(msg->fp, hdr->env, hdr->content, -post, 0); + mutt_write_rfc822_header(msg->fp, hdr->env, hdr->content, -post); /* (postponment) if this was a reply of some sort, contians the * Message-ID: of message replied to. Save it using a special X-Mutt- @@ -2147,19 +2140,6 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid, fputc ('\n', msg->fp); } - /* (postponement) if the mail is to be sent through a mixmaster - * chain, save that information - */ - if (post && hdr->chain && hdr->chain) { - string_list_t *p; - - fputs ("X-Mutt-Mix:", msg->fp); - for (p = hdr->chain; p; p = p->next) - fprintf (msg->fp, " %s", (char *) p->data); - - fputc ('\n', msg->fp); - } - if (tempfp) { char sasha[LONG_STRING]; int lines = 0; -- 2.20.1