#include "config.h"
#include <stddef.h>
#include <stdbool.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "mutt.h"
#include "ncrypt/lib.h"
#include "keymap.h"
Go to the source code of this file.
|
int | mutt_ev_message (struct Mailbox *m, struct EmailList *el, enum EvMessage action) |
| Edit or view a message. More...
|
|
int | mutt_system (const char *cmd) |
| Run an external command. More...
|
|
int | mutt_set_xdg_path (enum XdgType type, struct Buffer *buf) |
| Find an XDG path or its fallback. More...
|
|
void | mutt_help (enum MenuType menu) |
| Display the help menu. More...
|
|
void | mutt_set_flag_update (struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox) |
| Set a flag on an email. More...
|
|
void | mutt_signal_init (void) |
| Initialise the signal handling. More...
|
|
void | mutt_emails_set_flag (struct Mailbox *m, struct EmailList *el, enum MessageType flag, bool bf) |
| Set flag on messages. More...
|
|
int | mutt_change_flag (struct Mailbox *m, struct EmailList *el, bool bf) |
| Change the flag on a Message. More...
|
|
int | mutt_complete (char *buf, size_t buflen) |
| Attempt to complete a partial pathname. More...
|
|
int | mutt_prepare_template (FILE *fp, struct Mailbox *m, struct Email *e_new, struct Email *e, bool resend) |
| Prepare a message template. More...
|
|
int | mutt_enter_string (char *buf, size_t buflen, int col, CompletionFlags flags) |
| Ask the user for a string. More...
|
|
int | mutt_enter_string_full (char *buf, size_t buflen, int col, CompletionFlags flags, bool multiple, struct Mailbox *m, char ***files, int *numfiles, struct EnterState *state) |
| Ask the user for a string. More...
|
|
int | mutt_get_postponed (struct Context *ctx, struct Email *hdr, struct Email **cur, struct Buffer *fcc) |
| Recall a postponed message. More...
|
|
SecurityFlags | mutt_parse_crypt_hdr (const char *p, bool set_empty_signas, SecurityFlags crypt_app) |
| Parse a crypto header string. More...
|
|
int | mutt_num_postponed (struct Mailbox *m, bool force) |
| Return the number of postponed messages. More...
|
|
int | mutt_thread_set_flag (struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool subthread) |
| Set a flag on an entire thread. More...
|
|
void | mutt_update_num_postponed (void) |
| Force the update of the number of postponed messages. More...
|
|
int | mutt_is_quote_line (char *buf, regmatch_t *pmatch) |
| Is a line of message text a quote? More...
|
|
int | wcscasecmp (const wchar_t *a, const wchar_t *b) |
| Compare two wide-character strings, ignoring case. More...
|
|
int | mutt_reply_observer (struct NotifyCallback *nc) |
|
Prototypes for many functions
- Authors
- Michael R. Elkins
- Karel Zak
- Copyright
- 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, see http://www.gnu.org/licenses/.
Definition in file protos.h.
◆ mutt_set_flag
◆ XdgType
XDG variable types.
Enumerator |
---|
XDG_CONFIG_HOME | XDG home dir: ~/.config.
|
XDG_CONFIG_DIRS | XDG system dir: /etc/xdg.
|
Definition at line 45 of file protos.h.
◆ EvMessage
Edit or View a message.
Enumerator |
---|
EVM_VIEW | View the message.
|
EVM_EDIT | Edit the message.
|
Definition at line 54 of file protos.h.
◆ mutt_ev_message()
int mutt_ev_message |
( |
struct Mailbox * |
m, |
|
|
struct EmailList * |
el, |
|
|
enum EvMessage |
action |
|
) |
| |
Edit or view a message.
- Parameters
-
- Return values
-
Definition at line 280 of file editmsg.c.
◆ mutt_system()
int mutt_system |
( |
const char * |
cmd | ) |
|
Run an external command.
- Parameters
-
- Return values
-
-1 | Error |
>=0 | Success (command's return code) |
Fork and run an external command with arguments.
- Note
- This function won't return until the command finishes.
Definition at line 51 of file system.c.
55 struct sigaction oldtstp;
56 struct sigaction oldcont;
59 if (!cmd || (*cmd ==
'\0'))
66 act.sa_handler = SIG_DFL;
69 act.sa_flags = SA_RESTART;
71 sigemptyset(&act.sa_mask);
72 sigaction(SIGTSTP, &act, &oldtstp);
73 sigaction(SIGCONT, &act, &oldcont);
82 act.sa_handler = SIG_DFL;
84 sigemptyset(&act.sa_mask);
85 sigaction(SIGTERM, &act, NULL);
86 sigaction(SIGTSTP, &act, NULL);
87 sigaction(SIGCONT, &act, NULL);
99 sigaction(SIGCONT, &oldcont, NULL);
100 sigaction(SIGTSTP, &oldtstp, NULL);
105 rc = (pid != -1) ? (WIFEXITED(rc) ? WEXITSTATUS(rc) : -1) : -1;
◆ mutt_set_xdg_path()
Find an XDG path or its fallback.
- Parameters
-
- Return values
-
1 | if an entry was found that actually exists on disk and 0 otherwise |
Process an XDG environment variable or its fallback.
Definition at line 1501 of file muttlib.c.
1509 while ((token = strsep(&xdg,
":")))
◆ mutt_help()
Display the help menu.
- Parameters
-
Definition at line 385 of file help.c.
398 desc =
_(
"<UNKNOWN>");
412 fprintf(fp,
"\n%s\n\n",
_(
"Generic bindings:"));
416 fprintf(fp,
"\n%s\n\n",
_(
"Unbound functions:"));
424 snprintf(buf,
sizeof(buf),
_(
"Help for %s"), desc);
427 NULL) == OP_REFORMAT_WINCH);
◆ mutt_set_flag_update()
Set a flag on an email.
- Parameters
-
Definition at line 54 of file flags.c.
◆ mutt_signal_init()
void mutt_signal_init |
( |
void |
| ) |
|
Initialise the signal handling.
Definition at line 132 of file mutt_signal.c.
136 #ifdef USE_SLANG_CURSES
143 SLang_getkey_intr_hook = mutt_intr_hook;
◆ mutt_emails_set_flag()
void mutt_emails_set_flag |
( |
struct Mailbox * |
m, |
|
|
struct EmailList * |
el, |
|
|
enum MessageType |
flag, |
|
|
bool |
bf |
|
) |
| |
Set flag on messages.
- Parameters
-
m | Mailbox |
el | List of Emails to flag |
flag | Flag to set, e.g. MUTT_DELETE |
bf | true: set the flag; false: clear the flag |
Definition at line 354 of file flags.c.
◆ mutt_change_flag()
int mutt_change_flag |
( |
struct Mailbox * |
m, |
|
|
struct EmailList * |
el, |
|
|
bool |
bf |
|
) |
| |
Change the flag on a Message.
- Parameters
-
m | Mailbox |
el | List of Emails to change |
bf | true: set the flag; false: clear the flag |
- Return values
-
Definition at line 436 of file flags.c.
445 "%s? (D/N/O/r/*/!): ", bf ?
_(
"Set flag") :
_(
"Clear flag"));
452 }
while (event.ch == -2);
◆ mutt_complete()
int mutt_complete |
( |
char * |
buf, |
|
|
size_t |
buflen |
|
) |
| |
Attempt to complete a partial pathname.
- Parameters
-
buf | Buffer containing pathname |
buflen | Length of buffer |
- Return values
-
Given a partial pathname, fill in as much of the rest of the path as is unique.
Definition at line 57 of file complete.c.
61 struct dirent *de = NULL;
64 struct Buffer *dirpart = NULL;
65 struct Buffer *exp_dirpart = NULL;
66 struct Buffer *filepart = NULL;
69 struct Buffer *imap_path = NULL;
83 if ((*buf ==
'=') || (*buf ==
'+') || (*buf ==
'!'))
110 if ((*buf ==
'=') || (*buf ==
'+') || (*buf ==
'!'))
117 p = strrchr(buf,
'/');
122 (
size_t)(p - buf - 1));
133 p = strrchr(buf,
'/');
172 while ((de = readdir(dirp)))
183 while ((de = readdir(dirp)))
189 char *cp = filepart->
data;
191 for (
int i = 0; (*cp !=
'\0') && (de->d_name[i] !=
'\0'); i++, cp++)
193 if (*cp != de->d_name[i])
243 return init ? 0 : -1;
◆ mutt_prepare_template()
int mutt_prepare_template |
( |
FILE * |
fp, |
|
|
struct Mailbox * |
m, |
|
|
struct Email * |
e_new, |
|
|
struct Email * |
e, |
|
|
bool |
resend |
|
) |
| |
Prepare a message template.
- Parameters
-
fp | If not NULL, file containing the template |
m | If fp is NULL, the Mailbox containing the header with the template |
e_new | The template is read into this Header |
e | Email to recall/resend |
resend | Set if resending (as opposed to recalling a postponed msg) Resent messages enable header weeding, and also discard any existing Message-ID and Mail-Followup-To |
- Return values
-
Definition at line 664 of file postpone.c.
668 struct Body *b = NULL;
669 FILE *fp_body = NULL;
671 struct State s = { 0 };
673 struct Envelope *protected_headers = NULL;
685 fseeko(fp, e->
offset, SEEK_SET);
735 "application/pgp-signature"))
768 for (b = e_new->
body; b; b = b->
next)
826 if ((b == e_new->
body) && !protected_headers)
◆ mutt_enter_string()
int mutt_enter_string |
( |
char * |
buf, |
|
|
size_t |
buflen, |
|
|
int |
col, |
|
|
CompletionFlags |
flags |
|
) |
| |
Ask the user for a string.
- Parameters
-
- Return values
-
0 | if input was given |
-1 | if abort |
This function is for very basic input, currently used only by the built-in editor. It does not handle screen redrawing on resizes well, because there is no active menu for the built-in editor. Most callers should prefer mutt_get_field() instead.
Definition at line 147 of file enter.c.
157 clearok(stdscr,
true);
◆ mutt_enter_string_full()
int mutt_enter_string_full |
( |
char * |
buf, |
|
|
size_t |
buflen, |
|
|
int |
col, |
|
|
CompletionFlags |
flags, |
|
|
bool |
multiple, |
|
|
struct Mailbox * |
m, |
|
|
char *** |
files, |
|
|
int * |
numfiles, |
|
|
struct EnterState * |
state |
|
) |
| |
Ask the user for a string.
- Parameters
-
[in] | buf | Buffer to store the string |
[in] | buflen | Buffer length |
[in] | col | Initial cursor position |
[in] | flags | Flags, see CompletionFlags |
[in] | multiple | Allow multiple matches |
[in] | m | Mailbox |
[out] | files | List of files selected |
[out] | numfiles | Number of files selected |
[out] | state | Current state (if function is called repeatedly) |
- Return values
-
1 | Redraw the screen and call the function again |
0 | Selection made |
-1 | Aborted |
Definition at line 180 of file enter.c.
189 wchar_t *tempbuf = NULL;
194 memset(&mbstate, 0,
sizeof(mbstate));
264 rc = (
SigWinch && (ch == -2)) ? 1 : -1;
271 if ((ch != OP_EDITOR_COMPLETE) && (ch != OP_EDITOR_COMPLETE_QUERY))
276 case OP_EDITOR_HISTORY_UP:
287 case OP_EDITOR_HISTORY_DOWN:
298 case OP_EDITOR_HISTORY_SEARCH:
307 case OP_EDITOR_BACKSPACE:
338 case OP_EDITOR_KILL_LINE:
343 case OP_EDITOR_KILL_EOL:
347 case OP_EDITOR_BACKWARD_CHAR:
359 case OP_EDITOR_FORWARD_CHAR:
373 case OP_EDITOR_BACKWARD_WORD:
385 case OP_EDITOR_FORWARD_WORD:
403 case OP_EDITOR_CAPITALIZE_WORD:
404 case OP_EDITOR_UPCASE_WORD:
405 case OP_EDITOR_DOWNCASE_WORD:
418 if (ch == OP_EDITOR_DOWNCASE_WORD)
423 if (ch == OP_EDITOR_CAPITALIZE_WORD)
424 ch = OP_EDITOR_DOWNCASE_WORD;
430 case OP_EDITOR_DELETE_CHAR:
443 (state->
lastchar - i) *
sizeof(
wchar_t));
448 case OP_EDITOR_KILL_WORD:
453 while (i && iswspace(state->
wbuf[i - 1]))
457 if (iswalnum(state->
wbuf[i - 1]))
459 for (--i; (i > 0) && iswalnum(state->
wbuf[i - 1]); i--)
472 case OP_EDITOR_KILL_EOW:
485 if (iswalnum(state->
wbuf[i]))
488 for (; (i < state->
lastchar) && iswalnum(state->
wbuf[i]); i++)
499 (state->
lastchar - i) *
sizeof(
wchar_t));
504 case OP_EDITOR_MAILBOX_CYCLE:
526 case OP_EDITOR_COMPLETE:
527 case OP_EDITOR_COMPLETE_QUERY:
537 if (tempbuf && (templen == (state->
lastchar - i)) &&
538 (memcmp(tempbuf, state->
wbuf + i, (state->
lastchar - i) *
sizeof(
wchar_t)) == 0))
557 else if ((flags &
MUTT_ALIAS) && (ch == OP_EDITOR_COMPLETE))
562 (i > 0) && (state->
wbuf[i - 1] !=
',') && (state->
wbuf[i - 1] !=
':'); i--)
565 for (; (i < state->
lastchar) && (state->
wbuf[i] ==
' '); i++)
578 else if ((flags &
MUTT_LABEL) && (ch == OP_EDITOR_COMPLETE))
582 (i > 0) && (state->
wbuf[i - 1] !=
',') && (state->
wbuf[i - 1] !=
':'); i--)
585 for (; (i < state->
lastchar) && (state->
wbuf[i] ==
' '); i++)
598 else if ((flags &
MUTT_PATTERN) && (ch == OP_EDITOR_COMPLETE))
601 if (i && (state->
wbuf[i - 1] ==
'~'))
608 for (; (i > 0) && (state->
wbuf[i - 1] !=
'~'); i--)
611 if ((i > 0) && (i < state->
curpos) && (state->
wbuf[i - 1] ==
'~') &&
612 (state->
wbuf[i] ==
'y'))
628 else if ((flags &
MUTT_ALIAS) && (ch == OP_EDITOR_COMPLETE_QUERY))
633 for (; (i > 0) && (state->
wbuf[i - 1] !=
','); i--)
636 for (; (i < state->
curpos) && (state->
wbuf[i] ==
' '); i++)
650 size_t i = strlen(buf);
651 if ((i != 0) && (buf[i - 1] ==
'=') &&
665 if ((!tempbuf && !state->
lastchar) ||
666 (tempbuf && (templen == state->
lastchar) &&
667 (memcmp(tempbuf, state->
wbuf, state->
lastchar *
sizeof(
wchar_t)) == 0)))
691 memcpy(tempbuf, state->
wbuf, templen *
sizeof(
wchar_t));
701 size_t len = strlen(buf);
720 case OP_EDITOR_QUOTE_CHAR:
726 }
while (event.ch == -2);
735 case OP_EDITOR_TRANSPOSE_CHARS:
772 size_t k = mbrtowc(&wc, &c, 1, &mbstate);
773 if (k == (
size_t)(-2))
775 else if ((k != 0) && (k != 1))
777 memset(&mbstate, 0,
sizeof(mbstate));
792 if ((wc ==
'\r') || (wc ==
'\n'))
801 char **tfiles = NULL;
811 else if (wc && ((wc <
' ') ||
IsWPrint(wc)))
◆ mutt_get_postponed()
Recall a postponed message.
- Parameters
-
[in] | ctx | Context info, used when recalling a message to which we reply |
[in] | hdr | envelope/attachment info for recalled message |
[out] | cur | if message was a reply, 'cur' is set to the message which 'hdr' is in reply to |
[in] | fcc | fcc for the recalled message |
- Return values
-
-1 | Error/no messages |
0 | Normal exit |
SEND_REPLY | Recalled message is a reply |
Definition at line 331 of file postpone.c.
337 struct Email *e = NULL;
339 const char *p = NULL;
340 struct Context *ctx_post = NULL;
343 if (ctx && (ctx->
mailbox == m))
427 struct ListNode *np = NULL, *tmp = NULL;
475 char *t = strtok(np->
data + 11,
" \t\n");
479 t = strtok(NULL,
" \t\n");
◆ mutt_parse_crypt_hdr()
Parse a crypto header string.
- Parameters
-
p | Header string to parse |
set_empty_signas | Allow an empty "Sign as" |
crypt_app | App, e.g. APPLICATION_PGP |
- Return values
-
Definition at line 508 of file postpone.c.
510 char smime_cryptalg[1024] = { 0 };
511 char sign_as[1024] = { 0 };
519 for (; p[0] !=
'\0'; p++)
529 for (p += 2; (p[0] !=
'\0') && (p[0] !=
'>') &&
530 (q < (smime_cryptalg +
sizeof(smime_cryptalg) - 1));
564 for (p += 2; (p[0] !=
'\0') && (p[0] !=
'>'); p++)
601 (p[0] !=
'\0') && (*p !=
'>') && (q < (sign_as +
sizeof(sign_as) - 1));
627 smime_cryptalg, &errmsg);
638 (flags &
SEC_SIGN) && (set_empty_signas || *sign_as))
644 (flags &
SEC_SIGN) && (set_empty_signas || *sign_as))
◆ mutt_num_postponed()
int mutt_num_postponed |
( |
struct Mailbox * |
m, |
|
|
bool |
force |
|
) |
| |
Return the number of postponed messages.
- Parameters
-
m | currently selected mailbox |
force |
- false Use a cached value if costly to get a fresh count (IMAP)
- true Force check
|
- Return values
-
Definition at line 89 of file postpone.c.
93 static time_t LastModify = 0;
94 static char *OldPostponed = NULL;
148 if (S_ISDIR(st.st_mode))
165 if (LastModify < st.st_mtime)
170 LastModify = st.st_mtime;
◆ mutt_thread_set_flag()
Set a flag on an entire thread.
- Parameters
-
m | Mailbox |
e | Email |
flag | Flag to set, e.g. MUTT_DELETE |
bf | true: set the flag; false: clear the flag |
subthread | If true apply to all of the thread |
- Return values
-
Definition at line 377 of file flags.c.
◆ mutt_update_num_postponed()
void mutt_update_num_postponed |
( |
void |
| ) |
|
Force the update of the number of postponed messages.
Definition at line 203 of file postpone.c.
◆ mutt_is_quote_line()
int mutt_is_quote_line |
( |
char * |
line, |
|
|
regmatch_t * |
pmatch |
|
) |
| |
Is a line of message text a quote?
- Parameters
-
[in] | line | Line to test |
[out] | pmatch | Regex sub-matches |
- Return values
-
Checks if line matches the $quote_regex
and doesn't match $smileys
. This is used by the pager for calling classify_quote.
Definition at line 1047 of file pager.c.
1049 bool is_quote =
false;
1051 regmatch_t pmatch_internal[1], smatch[1];
1054 pmatch = pmatch_internal;
1060 if (smatch[0].rm_so > 0)
1062 char c = line[smatch[0].rm_so];
1063 line[smatch[0].rm_so] = 0;
1068 line[smatch[0].rm_so] = c;
◆ wcscasecmp()
int wcscasecmp |
( |
const wchar_t * |
a, |
|
|
const wchar_t * |
b |
|
) |
| |
Compare two wide-character strings, ignoring case.
- Parameters
-
a | First string |
b | Second string |
- Return values
-
-1 | a precedes b |
0 | a and b are identical |
1 | b precedes a |
Definition at line 41 of file wcscasecmp.c.
50 for (; *a || *b; a++, b++)
53 if ((i - towlower(*b)) != 0)
◆ mutt_reply_observer()
void ctx_free(struct Context **ptr)
Free a Context.
@ MENU_GENERIC
Generic selection list.
int msgno
Number displayed to the user.
char * subject
Email's subject.
int mutt_mb_wcswidth(const wchar_t *s, size_t n)
Measure the screen width of a string.
void mutt_hist_reset_state(enum HistoryClass hclass)
Move the 'current' position to the end of the History.
void mutt_beep(bool force)
Irritate the user.
enum MxStatus mx_mbox_check(struct Mailbox *m)
Check for new mail - Wrapper for MxOps::mbox_check()
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
AclFlags rights
ACL bits, see AclFlags.
bool noconv
Don't do character set conversion.
@ MUTT_FLAG
Flagged messages.
#define SEND_REPLY
Reply to sender.
static int ev_message(enum EvMessage action, struct Mailbox *m, struct Email *e)
Edit an email or view it in an external editor.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
FILE * fp_in
File to read from.
static void curses_segv_handler(int sig)
Catch a segfault and print a backtrace - Implements sig_handler_t.
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
void crypt_smime_getkeys(struct Envelope *env)
Wrapper for CryptModuleSpecs::smime_getkeys()
static struct Email * dlg_select_postponed_email(struct Context *ctx)
Create a Menu to select a postponed message.
void mutt_stamp_attachment(struct Body *a)
Timestamp an Attachment.
struct MuttWindow * MessageWindow
Message Window, ":set", etc.
@ SORT_THREADS
Sort by email threads.
Mapping between a user key and a function.
char * message_id
Message ID.
static void curses_exit_handler(int sig)
Notify the user and shutdown gracefully - Implements sig_handler_t.
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
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.
struct Email ** emails
Array of Emails.
static void dump_unbound(FILE *fp, const struct Binding *funcs, struct KeymapList *km_list, struct KeymapList *aux, int wraplen)
Write out all the operations with no key bindings.
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
@ XDG_CONFIG_DIRS
XDG system dir: /etc/xdg.
struct KeymapList Keymaps[MENU_MAX]
Array of Keymap keybindings, one for each Menu.
String manipulation buffer.
struct MuttThread * thread
Thread of Emails.
@ LL_DEBUG3
Log at debug level 3.
void mutt_hist_complete(char *buf, size_t buflen, enum HistoryClass hclass)
Complete a string from a history list.
#define STAILQ_REMOVE(head, elm, type, field)
int msg_deleted
Number of deleted messages.
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
#define MUTT_PATTERN
Pattern mode - only used for history classes.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
void mutt_buffer_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
#define SEC_AUTOCRYPT_OVERRIDE
(Autocrypt) Indicates manual set/unset of encryption
char * C_PgpSignAs
Config: Use this alternative key for signing messages.
struct Body * next
next attachment in the list
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
#define MUTT_ACL_DELETE
Delete a message.
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
const struct Binding * km_get_table(enum MenuType menu)
Lookup a menu's keybindings.
#define SEC_ENCRYPT
Email is encrypted.
#define CSR_SUCCESS
Action completed successfully.
struct Body * mutt_remove_multipart(struct Body *b)
Extract the multipart body if it exists.
#define SEC_SIGN
Email is signed.
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
#define MUTT_SEL_NO_FLAGS
No flags are set.
#define mutt_buffer_mktemp(buf)
SecurityFlags mutt_parse_crypt_hdr(const char *p, bool set_empty_signas, SecurityFlags crypt_app)
Parse a crypto header string.
@ EVM_VIEW
View the message.
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
LOFF_T offset
Where in the stream does this message begin?
struct Email * email
Email in the list.
Cached regular expression.
struct MuttWindow * AllDialogsWindow
Parent of all Dialogs.
int crypt_pgp_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur)
Wrapper for CryptModuleSpecs::decrypt_mime()
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
void mutt_hist_add(enum HistoryClass hclass, const char *str, bool save)
Add a string to a history.
char * mutt_str_dup(const char *str)
Copy a string, safely.
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
@ LL_DEBUG1
Log at debug level 1.
struct EnterState * mutt_enter_state_new(void)
Create a new EnterState.
@ ENTER_REDRAW_INIT
Go to end of line and redraw.
#define SORT_MASK
Mask for the sort id.
bool mutt_regex_capture(const struct Regex *regex, const char *str, size_t nmatch, regmatch_t matches[])
match a regex against a string, with provided options
static void dump_menu(FILE *fp, enum MenuType menu, int wraplen)
Write all the key bindings to a file.
int LastKey
contains the last key the user pressed
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
int nntp_complete(char *buf, size_t buflen)
Auto-complete NNTP newsgroups.
#define MUTT_LABEL
Do label completion.
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
struct Mailbox * mutt_mailbox_next(struct Mailbox *m_cur, struct Buffer *s)
incoming folders completion routine
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
@ ENTER_REDRAW_LINE
Redraw entire line.
#define STAILQ_EMPTY(head)
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
void mutt_body_free(struct Body **ptr)
Free a Body.
int query_complete(char *buf, size_t buflen, struct ConfigSubset *sub)
Perform auto-complete using an Address Query.
char * subtype
content-type subtype
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
#define STAILQ_FOREACH(var, head, field)
FILE * fp_out
File to write to.
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
static const char * xdg_env_vars[]
@ MUTT_READ
Messages that have been read.
bool C_CryptProtectedHeadersRead
Config: Display protected headers (Memory Hole) in the pager.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
struct MuttThread * parent
Parent of this Thread.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
struct MuttThread * child
Child of this Thread.
#define MUTT_ALIAS
Do alias "completion" by calling up the alias-menu.
int mutt_label_complete(char *buf, size_t buflen, int numtabs)
Complete a label name.
bool mutt_hist_at_scratch(enum HistoryClass hclass)
Is the current History position at the 'scratch' place?
char * C_SmimeSignAs
Config: Use this alternative key for signing messages.
void mutt_sig_unblock_system(bool restore)
Restore previously blocked signals.
bool old
Email is seen, but unread.
#define MUTT_FILE
Do file completion.
@ MUTT_PURGE
Messages to be purged (bypass trash)
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
SecurityFlags mutt_is_application_pgp(struct Body *m)
Does the message use PGP?
int imap_wait_keepalive(pid_t pid)
Wait for a process to change state.
HistoryClass
Type to differentiate different histories.
enum MailboxType type
Mailbox type.
#define MUTT_EFILE
Do file completion, plus incoming folders.
size_t mutt_buffer_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
#define SEND_POSTPONED
Recall a postponed email.
#define SEND_POSTPONED_FCC
Used by mutt_get_postponed() to signal that the x-mutt-fcc header field was present.
int mutt_do_pager(const char *banner, const char *tempfile, PagerFlags do_color, struct Pager *info)
Display some page-able text to the user.
size_t mutt_mb_width_ceiling(const wchar_t *s, size_t n, int w1)
Keep the end of the string on-screen.
#define MUTT_CHARCONV
Do character set conversions.
WHERE char * C_Folder
Config: Base folder for a set of mailboxes.
bool tagged
Email is tagged.
SecurityFlags mutt_is_multipart_encrypted(struct Body *b)
Does the message have encrypted parts?
int mutt_command_complete(char *buf, size_t buflen, int pos, int numtabs)
Complete a command name.
WHERE struct Regex * C_QuoteRegex
Config: Regex to match quoted text in a reply.
LOFF_T length
length (in bytes) of attachment
#define MUTT_SEL_FOLDER
Select a local directory.
bool changed
Mailbox has been modified.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
void mutt_rfc3676_space_unstuff(struct Email *e)
Remove RFC3676 space stuffing.
bool mutt_nm_tag_complete(char *buf, size_t buflen, int numtabs)
Complete to the nearest notmuch tag.
bool C_CryptOpportunisticEncrypt
Config: Enable encryption when the recipient's key is available.
bool mutt_mb_is_shell_char(wchar_t ch)
Is character not typically part of a pathname.
struct Email * message
Email this Thread refers to.
int cs_subset_str_string_set(const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err)
Set a config item by string.
int msg_count
Total number of messages.
const struct Regex * cs_subset_regex(const struct ConfigSubset *sub, const char *name)
Get a regex config item by name.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
char * mutt_str_skip_email_wsp(const char *s)
Skip over whitespace as defined by RFC5322.
void mutt_sig_init(sig_handler_t sig_fn, sig_handler_t exit_fn, sig_handler_t segv_fn)
Initialise the signal handling.
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size (CURSES)
#define MUTT_SEL_MULTI
Multi-selection is enabled.
static bool UpdateNumPostponed
int mutt_complete(char *buf, size_t buflen)
Attempt to complete a partial pathname.
@ MUTT_IMAP
'IMAP' Mailbox type
#define MUTT_NOSORT
Do not sort the mailbox after opening it.
const struct Mapping Menus[]
Menu name lookup table.
struct Body * parts
parts of a multipart or message/rfc822
An event such as a keypress.
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
size_t mutt_buffer_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
struct Envelope * env
Envelope information.
int imap_complete(char *buf, size_t buflen, const char *path)
Try to complete an IMAP folder path.
#define mutt_debug(LEVEL,...)
@ MUTT_REPLIED
Messages that have been replied to.
bool purge
Skip trash folder when deleting.
WHERE bool C_FlagSafe
Config: Protect flagged messages from deletion.
void mutt_set_header_color(struct Mailbox *m, struct Email *e)
Select a colour for a message.
int msg_flagged
Number of flagged messages.
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
FILE * fp
pointer to the message data
#define MUTT_QUIET
Do not print any messages.
bool flagged
Marked important?
int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *e_new, struct Email *e, bool resend)
Prepare a message template.
const char * mutt_str_getenv(const char *name)
Get an environment variable.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
struct ListHead chain
Mixmaster chain.
static void hardclose(struct Context **pctx)
try hard to close a mailbox
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
void mutt_hist_save_scratch(enum HistoryClass hclass, const char *str)
Save a temporary string to the History.
EnterRedrawFlags
redraw flags for mutt_enter_string_full()
bool trash
Message is marked as trashed on disk (used by the maildir_trash option)
#define MUTT_ACL_WRITE
Write to a message (for flagging or linking threads)
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
void mutt_adv_mktemp(struct Buffer *buf)
Create a temporary file.
void mutt_flushinp(void)
Empty all the keyboard buffers.
void mutt_param_delete(struct ParameterList *pl, const char *attribute)
Delete a matching Parameter.
struct WindowState state
Current state of the Window.
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
bool deleted
Email is deleted.
bool mutt_nm_query_complete(char *buf, size_t buflen, int pos, int numtabs)
Complete to the nearest notmuch tag.
#define MUTT_PASS
Password mode (no echo)
bool readonly
Don't allow changes to the mailbox.
static void curses_signal_handler(int sig)
Catch signals and relay the info to the main program - Implements sig_handler_t.
int imap_path_status(const char *path, bool queue)
Refresh the number of total and new messages.
struct ListHead userhdrs
user defined headers
Keep track when processing files.
char * d_filename
filename to be used for the content-disposition header.
@ MUTT_DELETE
Messages to be deleted.
WHERE short C_Sort
Config: Sort method for the index.
#define MUTT_NM_TAG
Notmuch tag +/- mode.
struct HashTable * mutt_make_id_hash(struct Mailbox *m)
Create a Hash Table for message-ids.
@ TYPE_TEXT
Type: 'text/*'.
static int my_addwch(wchar_t wc)
Display one wide character on screen.
Keep our place when entering a string.
@ MUTT_TAG
Tagged messages.
@ EVM_EDIT
Edit the message.
void mutt_buffer_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
WHERE char * C_SpoolFile
Config: Inbox.
Container for Accounts, Notifications.
#define SEC_INLINE
Email has an inline signature.
void crypt_opportunistic_encrypt(struct Email *e)
Can all recipients be determined.
int mutt_enter_string_full(char *buf, size_t buflen, int col, CompletionFlags flags, bool multiple, struct Mailbox *m, char ***files, int *numfiles, struct EnterState *state)
Ask the user for a string.
int mutt_mb_wcwidth(wchar_t wc)
Measure the screen width of a character.
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
WHERE unsigned char C_Delete
Config: Really delete messages, when the mailbox is closed.
size_t mutt_buffer_substrcpy(struct Buffer *buf, const char *beg, const char *end)
Copy a partial string into a Buffer.
static void replace_part(struct EnterState *state, size_t from, char *buf)
Search and replace on a buffer.
unsigned int type
content-type primary type, ContentType
WHERE char * C_Postponed
Config: Folder to store postponed messages.
struct Context * mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
MessageType
To set flags or match patterns.
WHERE bool C_AbortBackspace
Config: Hitting backspace against an empty prompt aborts the prompt.
@ HC_OTHER
Miscellaneous strings.
bool searched
Email has been searched.
#define MUTT_CMD
Do completion on previous word.
@ MENU_EDITOR
Text entry area.
int mutt_body_handler(struct Body *b, struct State *s)
Handler for the Body of an email.
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe()
size_t mutt_buffer_len(const struct Buffer *buf)
Calculate the length of a Buffer.
@ HC_CMD
External commands.
bool C_SmimeIsDefault
Config: Use SMIME rather than PGP by default.
#define MUTT_CLEAR
Clear input if printable character is pressed.
void mutt_refresh(void)
Force a refresh of the screen.
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
parses an RFC822 header
void mutt_select_file(char *file, size_t filelen, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
Let the user select a file.
struct ConfigSubset * sub
Inherited config items.
@ ENTER_REDRAW_NONE
Nothing to redraw.
#define MUTT_COMMAND
Do command completion.
int alias_complete(char *buf, size_t buflen, struct ConfigSubset *sub)
alias completion routine
char ** mutt_envlist_getlist(void)
Get the private environment.
bool use_disp
Content-Disposition uses filename= ?
struct MuttThread * next
Next sibling Thread.
static size_t plen
Length of cached packet.
void mutt_mb_wcstombs(char *dest, size_t dlen, const wchar_t *src, size_t slen)
Convert a string from wide to multibyte characters.
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
int msg_unread
Number of unread messages.
int msg_tagged
How many messages are tagged?
@ MUTT_MAILDIR
'Maildir' Mailbox type
struct Email * email
header information for message/rfc822
char * mutt_hist_prev(enum HistoryClass hclass)
Get the previous string in a History.
int mutt_var_value_complete(char *buf, size_t buflen, int pos)
Complete a variable/value.
int km_dokey(enum MenuType menu)
Determine what a keypress should do.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
void mx_fastclose_mailbox(struct Mailbox *m)
free up memory associated with the Mailbox
struct ParameterList parameter
parameters of the content-type
@ XDG_CONFIG_HOME
XDG home dir: ~/.config.
void mutt_decode_attachment(struct Body *b, struct State *s)
Decode an email's attachment.
int mx_msg_close(struct Mailbox *m, struct Message **msg)
Close a message.
StateFlags flags
Flags, e.g. MUTT_DISPLAY.
void mutt_pretty_mailbox(char *buf, size_t buflen)
Shorten a mailbox path using '~' or '='.
bool replied
Email has been replied to.
char * data
Pointer to data.
bool dlg_select_pattern(char *buf, size_t buflen)
Show menu to select a Pattern.
@ TYPE_MULTIPART
Type: 'multipart/*'.
The envelope/body of an email.
#define MUTT_ACL_SEEN
Change the 'seen' status of a message.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
#define mutt_message(...)
#define mutt_set_flag(m, e, flag, bf)
int msg_new
Number of new messages.
void mutt_enter_state_free(struct EnterState **ptr)
Free an EnterState.
const struct Binding OpGeneric[]
Key bindings for the generic menu.
@ HC_COMMAND
NeoMutt commands.
struct AddressList mail_followup_to
Email's 'mail-followup-to'.
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
char * mutt_hist_next(enum HistoryClass hclass)
Get the next string in a History.
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
bool crypt_valid_passphrase(SecurityFlags flags)
Check that we have a usable passphrase, ask if not.
void mutt_sig_block_system(void)
Block signals before calling exec()
#define SEC_NO_FLAGS
No flags are set.
SecurityFlags mutt_is_multipart_signed(struct Body *b)
Is a message signed?
size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, const char *buf)
Convert a string from multibyte to wide characters.
size_t mutt_buffer_concatn_path(struct Buffer *buf, const char *dir, size_t dirlen, const char *fname, size_t fnamelen)
Join a directory name and a filename.
#define MUTT_NM_QUERY
Notmuch query mode.
@ MENU_PAGER
Pager pager (email viewer)
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
struct HashTable * id_hash
Hash Table by msg id.
@ LL_DEBUG2
Log at debug level 2.
SecurityFlags mutt_is_application_smime(struct Body *m)
Does the message use S/MIME?
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
bool changed
Email has been edited.
A local copy of an email.
static const char * xdg_defaults[]
struct Envelope * mime_headers
Memory hole protected headers.
void mutt_emails_set_flag(struct Mailbox *m, struct EmailList *el, enum MessageType flag, bool bf)
Set flag on messages.
char * filename
when sending a message, this is the file to which this structure refers
struct Body * body
List of MIME parts.
WHERE bool OptNews
(pseudo) used to change reader mode
struct Message * mx_msg_open(struct Mailbox *m, int msgno)
return a stream pointer for a message
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)