62 #define MIX_VOFFSET (win->state.rows - 4) 63 #define MIX_MAXROW (win->state.rows - 1) 75 static const struct Mapping RemailerHelp[] = {
77 {
N_(
"Append"), OP_MIX_APPEND },
78 {
N_(
"Insert"), OP_MIX_INSERT },
79 {
N_(
"Delete"), OP_MIX_DELETE },
80 {
N_(
"Abort"), OP_EXIT },
81 {
N_(
"OK"), OP_MIX_USE },
137 size_t *slots,
size_t *used)
145 (*type2_list)[(*used)++] = entry;
190 struct Remailer **type2_list = NULL;
192 size_t slots = 0, used = 0;
194 int fd_null = open(
"/dev/null", O_RDWR);
217 while (fgets(line,
sizeof(line), fp))
221 t = strtok(line,
" \t\n");
227 t = strtok(NULL,
" \t\n");
233 t = strtok(NULL,
" \t\n");
237 t = strtok(NULL,
" \t\n");
243 t = strtok(NULL,
" \t\n");
272 struct Remailer **type2_list = *ttlp;
274 for (
int i = 0; type2_list[i]; i++)
298 struct Coord *coords = *coordsp;
302 c = coords[i - 1].
c + strlen(type2_list[chain->
ch[i - 1]]->
shortname) + 2;
311 for (; i < chain->
cl; i++)
314 c += strlen(type2_list[chain->
ch[i]]->
shortname) + 2;
338 struct Coord *coords,
struct MixChain *chain,
int i,
bool selected)
340 if (!coords || !chain)
353 if (i + 1 < chain->
cl)
375 for (
int i = 0; i < chain->
cl; i++)
388 "-- Remailer chain [Length: %d]", chain ? chain->
cl : 0);
402 static char capbuf[10];
452 static const char *
mix_format_str(
char *buf,
size_t buflen,
size_t col,
int cols,
453 char op,
const char *src,
const char *prec,
454 const char *if_str,
const char *else_str,
466 snprintf(fmt,
sizeof(fmt),
"%%%ss", prec);
467 snprintf(buf, buflen, fmt,
NONULL(remailer->
addr));
469 else if (!remailer->
addr)
477 snprintf(fmt,
sizeof(fmt),
"%%%ss", prec);
485 snprintf(fmt,
sizeof(fmt),
"%%%sd", prec);
486 snprintf(buf, buflen, fmt, remailer->
num);
492 snprintf(fmt,
sizeof(fmt),
"%%%ss", prec);
544 chain->
ch[chain->
cl++] = 0;
548 for (i = 0; type2_list[i]; i++)
552 chain->
ch[chain->
cl++] = i;
560 chain->
ch[chain->
cl++] = 0;
575 int c_cur = 0, c_old = 0;
576 bool c_redraw =
true;
579 struct Coord *coords = NULL;
581 struct Menu *menu = NULL;
603 for (
int i = 0; i < chain->
cl; i++)
605 if (chain->
ch[i] >= ttll)
619 menu->
title =
_(
"Select a remailer chain");
620 menu->
mdata = type2_list;
638 else if (c_cur != c_old)
676 if (chain->
cl && chain->
ch[chain->
cl - 1] &&
680 _(
"Error: %s can't be used as the final remailer of a chain"),
690 case OP_GENERIC_SELECT_ENTRY:
693 if ((chain->
cl <
MAX_MIXES) && (c_cur < chain->cl))
702 for (
int i = chain->
cl - 1; i > c_cur; i--)
703 chain->
ch[i] = chain->
ch[i - 1];
724 for (
int i = c_cur; i < chain->
cl; i++)
725 chain->
ch[i] = chain->
ch[i + 1];
727 if ((c_cur == chain->
cl) && c_cur)
735 mutt_error(
_(
"The remailer chain is already empty"));
740 case OP_MIX_CHAIN_PREV:
745 mutt_error(
_(
"You already have the first chain element selected"));
750 case OP_MIX_CHAIN_NEXT:
752 if (chain->
cl && (c_cur < chain->cl - 1))
755 mutt_error(
_(
"You already have the last chain element selected"));
770 for (
int i = 0; i < chain->
cl; i++)
772 const int j = chain->
ch[i];
795 bool need_hostname =
false;
799 mutt_error(
_(
"Mixmaster doesn't accept Cc or Bcc headers"));
814 need_hostname =
true;
824 mutt_error(
_(
"Please set the hostname variable to a proper value when " 867 fprintf(stderr,
_(
"Error sending message, child exited %d\n"), i);
static void mix_redraw_ce(struct MuttWindow *win, struct Remailer **type2_list, struct Coord *coords, struct MixChain *chain, int i, bool selected)
Redraw the Remailer chain.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Convenience wrapper for the gui headers.
void mutt_buffer_quote_filename(struct Buffer *buf, const char *filename, bool add_outer)
Quote a filename to survive the shell's quoting rules.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
The envelope/body of an email.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
static const char * mix_format_caps(struct Remailer *r)
Turn flags into a MixMaster capability string.
struct AddressList mail_followup_to
Email's 'mail-followup-to'.
#define TAILQ_FOREACH(var, head, field)
Structs that make up an email.
struct AddressList reply_to
Email's 'reply-to'.
Convenience wrapper for the send headers.
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
struct AddressList bcc
Email's 'Bcc' list.
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
String manipulation buffer.
char * mutt_str_dup(const char *str)
Copy a string, safely.
WHERE bool OptNoCurses
(pseudo) when sending in batch mode
char * mailbox
Mailbox and host address.
A division of the screen.
static void mix_redraw_chain(struct MuttWindow *win, struct Remailer **type2_list, struct Coord *coords, struct MixChain *chain, int cur)
Redraw the chain on screen.
char * C_MixEntryFormat
Config: (mixmaster) printf-like format string for the mixmaster chain.
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
Move the cursor and write a fixed string to a Window.
All user-callable functions.
Container for Accounts, Notifications.
struct MuttWindow * dialog_create_simple_index(struct Menu *menu, enum WindowType type)
Create a simple index Dialog.
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
void dlg_select_mixmaster_chain(struct MuttWindow *win, struct ListHead *chainhead, int cols)
Create a Mixmaster chain.
Convenience wrapper for the config headers.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Some miscellaneous functions.
Many unsorted constants and some structs.
char * C_Mixmaster
Config: (mixmaster) External command to route a mixmaster message.
static void remailer_free(struct Remailer **ptr)
Free a Remailer.
struct Envelope * env
Envelope information.
Convenience wrapper for the core headers.
struct AddressList cc
Email's 'Cc' list.
static void mix_add_entry(struct Remailer ***type2_list, struct Remailer *entry, size_t *slots, size_t *used)
Add an entry to the Remailer list.
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Prototypes for many functions.
struct WindowState state
Current state of the Window.
void mutt_endwin(void)
Shutdown curses/slang.
uint8_t MixCapFlags
Flags, e.g. MIX_CAP_NO_FLAGS.
Status bar (takes a pattern)
#define MIX_CAP_NO_FLAGS
No flags are set.
const struct Mapping * help_data
Data for the Help Bar.
char * data
Pointer to data.
void dialog_destroy_simple_index(struct MuttWindow **ptr)
Destroy a simple index Dialog.
int mix_send_message(struct ListHead *chain, const char *tempfile)
Send an email via Mixmaster.
#define STAILQ_FOREACH(var, head, field)
#define MIX_CAP_MIDDLEMAN
static const char * mix_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
Format a string for the remailer menu - Implements format_t.
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
static void mix_type2_list_free(struct Remailer ***ttlp)
Free a Remailer List.
void mutt_addrlist_qualify(struct AddressList *al, const char *host)
Expand local names in an Address list using a hostname.
const char * mutt_fqdn(bool may_hide_host, const struct ConfigSubset *sub)
Get the Fully-Qualified Domain Name.
Routines for managing attachments.
static MixCapFlags mix_get_caps(const char *capstr)
Get Mixmaster Capabilities.
pid_t filter_create_fd(const char *cmd, FILE **fp_in, FILE **fp_out, FILE **fp_err, int fdin, int fdout, int fderr)
Run a command on a pipe (optionally connect stdin/stdout)
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t callback, intptr_t data, MuttFormatFlags flags)
Expand expandos (x) in a string.
Create/edit a Mixmaster chain.
Mapping between user-readable string and a constant.
struct AddressList to
Email's 'To' list.
static void mix_redraw_head(struct MuttWindow *win, struct MixChain *chain)
Redraw the Chain info.
int mutt_window_mvprintw(struct MuttWindow *win, int col, int row, const char *fmt,...)
Move the cursor and write a formatted string to a Window.
static struct Remailer * remailer_new(void)
Create a new Remailer.
int mutt_window_addstr(const char *str)
Write a string to a Window.
Hundreds of global variables to back the user variables.
Handling of global boolean variables.
struct ConfigSubset * sub
Inherited config items.
static int mix_chain_add(struct MixChain *chain, const char *s, struct Remailer **type2_list)
Add a host to the chain.
#define TAILQ_EMPTY(head)
Convenience wrapper for the library headers.
static void mix_make_entry(char *buf, size_t buflen, struct Menu *menu, int num)
Format a menu item for the mixmaster chain list - Implements Menu::make_entry()
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
static void mix_screen_coordinates(struct MuttWindow *win, struct Remailer **type2_list, struct Coord **coordsp, struct MixChain *chain, int i)
Get the screen coordinates to place a chain.
static struct Remailer ** mix_type2_list(size_t *l)
parse the type2.list as given by mixmaster -T
int mutt_system(const char *cmd)
Run an external command.
Support of Mixmaster anonymous remailer.
int mix_check_message(struct Email *e)
Safety-check the message before passing it to mixmaster.
static const struct Mapping RemailerHelp[]
Help Bar for the Mixmaster dialog.
Remailer Dialog, dlg_select_mixmaster_chain()