105 {
N_(
"Quit"), OP_QUIT },
106 {
N_(
"Del"), OP_DELETE },
107 {
N_(
"Undel"), OP_UNDELETE },
108 {
N_(
"Save"), OP_SAVE },
109 {
N_(
"Mail"), OP_MAIL },
110 {
N_(
"Reply"), OP_REPLY },
111 {
N_(
"Group"), OP_GROUP_REPLY },
112 {
N_(
"Help"), OP_HELP },
121 {
N_(
"Quit"), OP_QUIT },
122 {
N_(
"Del"), OP_DELETE },
123 {
N_(
"Undel"), OP_UNDELETE },
124 {
N_(
"Save"), OP_SAVE },
125 {
N_(
"Post"), OP_POST },
126 {
N_(
"Followup"), OP_FOLLOWUP },
127 {
N_(
"Catchup"), OP_CATCHUP },
128 {
N_(
"Help"), OP_HELP },
149 mutt_error(
_(
"%s: Operation not permitted by ACL"), msg);
252 for (
int i = msgno + 1; i < m->
vcount; i++)
286 for (
int i = msgno - 1; i >= 0; i--)
322 for (
int i = 0; i < m->
vcount; i++)
345 bool reverse =
false;
361 if (reverse || (m->
vcount == 0))
374 if (!mv || !mv->
mailbox || !menu)
385 for (
int i = 0; i < m->
vcount; i++)
416 struct Email **save_new = NULL;
425 (lmt || c_uncollapse_new) && (num_new > 0))
428 for (
int i = oldcount; i < m->
msg_count; i++)
429 save_new[i - oldcount] = m->
emails[i];
467 if (c_uncollapse_new)
475 else if (oldcount > 0)
477 for (
int j = 0; j < num_new; j++)
562 for (
int i = 0; i < m->
vcount; i++)
628 char *new_last_folder = NULL;
652 if (monitor_remove_rc == 0)
658 FREE(&new_last_folder);
803 if (!menu || !menu->
mdata)
812 if (!m || (line < 0) || (line >= m->
email_max))
837 edgemsgno = m->
v2r[menu->
max - 1];
843 edgemsgno = m->
v2r[menu->
top];
877 flags &= ~MUTT_FORMAT_FORCESUBJ;
888 m, msg_in_pager, e, flags, NULL);
899 if (!m || (line < 0))
960 regmatch_t pmatch[cl->
match + 1];
962 if (regexec(&cl->
regex, buf + offset, cl->
match + 1, pmatch, 0) != 0)
965 int first = pmatch[cl->
match].rm_so + offset;
966 int last = pmatch[cl->
match].rm_eo + offset;
978 if (!found || (first < syntax[i].first) ||
979 ((first == syntax[i].first) && (last > syntax[i].last)))
983 syntax[i].attr_color = ac_merge;
984 syntax[i].first = first;
985 syntax[i].last = last;
992 offset = syntax[i].last;
1001 if ((chunks > 0) && (syntax[0].first > 0))
1006 if (len <= syntax[0].first)
1009 offset = syntax[0].first;
1012 for (i = 0; i < chunks; i++)
1017 if (len <= syntax[i].last)
1021 if ((i + 1) == chunks)
1027 next =
MIN(len, syntax[i + 1].first);
1031 offset = syntax[i].last;
1114 if (priv->
tag_prefix && (op != OP_TAG_PREFIX) &&
1115 (op != OP_TAG_PREFIX_COND) && (op !=
OP_TIMEOUT))
1166 mutt_error(
_(
"Mailbox was externally modified. Flags may be wrong."));
1180 if (c_new_mail_command)
1182 char cmd[1024] = { 0 };
1184 NONULL(c_new_mail_command));
1226 if (c_new_mail_command)
1228 char cmd[1024] = { 0 };
1230 NONULL(c_new_mail_command));
1249 const bool c_braille_friendly =
cs_subset_bool(shared->
sub,
"braille_friendly");
1255 else if (c_braille_friendly)
1274 clearok(stdscr,
true);
1295 if ((op == OP_TAG_PREFIX) || (op == OP_TAG_PREFIX_COND))
1313 if (op == OP_TAG_PREFIX)
1317 else if (op == OP_TAG_PREFIX_COND)
1399 ac_merge = ac_normal;
1417 dlg->
wdata = shared;
1428 dlg->
focus = panel_index;
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Color and attribute parsing.
struct RegexColorList * regex_colors_get_list(enum ColorId cid)
Return the RegexColorList for a colour id.
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
@ MT_COLOR_STATUS
Status bar (takes a pattern)
@ MT_COLOR_NORMAL
Plain text.
@ MT_COLOR_INDEX
Index: default colour.
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
size_t mutt_wstr_trunc(const char *src, size_t maxlen, size_t maxwid, size_t *width)
Work out how to truncate a widechar string.
void mutt_paddstr(struct MuttWindow *win, int n, const char *s)
Display a string on screen, padded if necessary.
void mutt_refresh(void)
Force a refresh of the screen.
void mutt_flush_macro_to_endcond(void)
Drop a macro from the input buffer.
void mutt_beep(bool force)
Irritate the user.
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
@ FR_DONE
Exit the Dialog.
@ FR_UNKNOWN
Unknown function.
bool check_acl(struct Mailbox *m, AclFlags acl, const char *msg)
Check the ACLs for a function.
struct Mailbox * mutt_index_menu(struct MuttWindow *dlg, struct Mailbox *m_init)
Display a list of emails.
const struct Mapping IndexNewsHelp[]
Help Bar for the News Index dialog.
void change_folder_mailbox(struct Menu *menu, struct Mailbox *m, int *oldcount, struct IndexSharedData *shared, bool read_only)
Change to a different Mailbox by pointer.
struct Mailbox * change_folder_notmuch(struct Menu *menu, char *buf, int buflen, int *oldcount, struct IndexSharedData *shared, bool read_only)
Change to a different Notmuch Mailbox by string.
void dlg_change_folder(struct MuttWindow *dlg, struct Mailbox *m)
Change the current folder, cautiously.
void update_index(struct Menu *menu, struct MailboxView *mv, enum MxStatus check, int oldcount, const struct IndexSharedData *shared)
Update the index.
void change_folder_string(struct Menu *menu, char *buf, size_t buflen, int *oldcount, struct IndexSharedData *shared, bool read_only)
Change to a different Mailbox by string.
void mutt_set_header_color(struct Mailbox *m, struct Email *e)
Select a colour for a message.
void mutt_draw_statusline(struct MuttWindow *win, int cols, const char *buf, size_t buflen)
Draw a highlighted status bar.
int find_first_message(struct MailboxView *mv)
Get index of first new message.
static const struct Mapping IndexHelp[]
Help Bar for the Index dialog.
static void update_index_threaded(struct MailboxView *mv, enum MxStatus check, int oldcount)
Update the index (if threaded)
void resort_index(struct MailboxView *mv, struct Menu *menu)
Resort the index.
int find_next_undeleted(struct MailboxView *mv, int msgno, bool uncollapse)
Find the next undeleted email.
static void update_index_unthreaded(struct MailboxView *mv, enum MxStatus check)
Update the index (if unthreaded)
void collapse_all(struct MailboxView *mv, struct Menu *menu, int toggle)
Collapse/uncollapse all threads.
int find_previous_undeleted(struct MailboxView *mv, int msgno, bool uncollapse)
Find the previous undeleted email.
struct MuttWindow * index_pager_init(void)
Allocate the Windows for the Index/Pager.
static void uncollapse_thread(struct MailboxView *mv, int index)
Open a collapsed thread.
Structs that make up an email.
bool mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, struct Mailbox *m, struct Email *e, struct PatternCache *cache)
Match a pattern against an email header.
bool OptNews
(pseudo) used to change reader mode
char * LastFolder
Previously selected mailbox.
bool OptAttachMsg
(pseudo) used by attach-message
bool OptSearchInvalid
(pseudo) used to invalidate the search pattern
char * CurrentFolder
Currently selected mailbox.
SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
bool OptNeedResort
(pseudo) used to force a re-sort
bool OptRedrawTree
(pseudo) redraw the thread tree
int sb_function_dispatcher(struct MuttWindow *win, int op)
Perform a Sidebar function - Implements function_dispatcher_t -.
int global_function_dispatcher(struct MuttWindow *win, int op)
Perform a Global function - Implements function_dispatcher_t -.
int menu_function_dispatcher(struct MuttWindow *win, int op)
Perform a Menu function - Implements function_dispatcher_t -.
int index_function_dispatcher(struct MuttWindow *win, int op)
Perform an Index function - Implements function_dispatcher_t -.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
static int index_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
void index_shared_data_free(struct MuttWindow *win, void **ptr)
Free Shared Index Data - Implements MuttWindow::wdata_free() -.
Convenience wrapper for the gui headers.
void mutt_make_string(char *buf, size_t buflen, int cols, const char *s, struct Mailbox *m, int inpgr, struct Email *e, MuttFormatFlags flags, const char *progress)
Create formatted strings using mailbox expandos.
String processing routines to generate the mail index.
void mutt_timeout_hook(void)
Execute any timeout hooks.
void mutt_folder_hook(const char *path, const char *desc)
Perform a folder hook.
Parse and execute user-defined hooks.
void index_shared_data_set_email(struct IndexSharedData *shared, struct Email *e)
Set the current Email for the Index and friends.
bool index_shared_data_is_cur_email(const struct IndexSharedData *shared, const struct Email *e)
Check whether an email is the currently selected Email.
struct IndexSharedData * index_shared_data_new(void)
Create new Index Data.
void index_shared_data_set_mview(struct IndexSharedData *shared, struct MailboxView *mv)
Set the MailboxView for the Index and friends.
Data shared between Index, Pager and Sidebar.
void index_adjust_sort_threads(const struct ConfigSubset *sub)
Adjust use_threads/sort/sort_aux.
struct MuttWindow * ipanel_new(bool status_on_top, struct IndexSharedData *shared)
Create the Windows for the Index panel.
int km_dokey(enum MenuType mtype)
Determine what a keypress should do.
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
@ LL_DEBUG5
Log at debug level 5.
@ LL_DEBUG1
Log at debug level 1.
void mailbox_gc_run(void)
Run the garbage-collection.
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
struct Mailbox * mailbox_find_name(const char *name)
Find the mailbox with a given name.
@ NT_MAILBOX_DELETE
Mailbox is about to be deleted.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
uint16_t AclFlags
ACL Rights - These show permission to...
MailboxType
Supported mailbox formats.
@ MUTT_MAILBOX_ERROR
Error occurred examining Mailbox.
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
struct AttrColor * merged_color_overlay(struct AttrColor *base, struct AttrColor *over)
Combine two colours.
int mutt_monitor_add(struct Mailbox *m)
Add a watch for a mailbox.
int mutt_monitor_remove(struct Mailbox *m)
Remove a watch for a mailbox.
Monitor files for changes.
void msgwin_set_text(enum ColorId cid, const char *text)
Set the text for the Message Window.
void msgwin_clear_text(void)
Clear the text in the Message Window.
Convenience wrapper for the library headers.
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
char * mutt_str_dup(const char *str)
Copy a string, safely.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
void mutt_curses_set_color(struct AttrColor *ac)
Set the colour and attributes for text.
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size (CURSES)
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
int mutt_mailbox_check(struct Mailbox *m_cur, CheckStatsFlags flags)
Check all all Mailboxes for new mail.
bool mutt_mailbox_notify(struct Mailbox *m_cur)
Notify the user if there's new mail.
Mailbox helper functions.
void mutt_thread_collapse(struct ThreadsContext *tctx, bool collapse)
Toggle collapse.
void mutt_draw_tree(struct ThreadsContext *tctx)
Draw a tree of threaded emails.
enum UseThreads mutt_thread_style(void)
Which threading style is active?
off_t mutt_set_vnum(struct Mailbox *m)
Set the virtual index number of all the messages in a mailbox.
bool mutt_thread_can_collapse(struct Email *e)
Check whether a thread can be collapsed.
int mutt_parent_message(struct Email *e, bool find_root)
Find the parent of a message.
Create/manipulate threading in emails.
UseThreads
Which threading style is active, $use_threads.
@ UT_THREADS
Normal threading (root above subthreads)
@ UT_REVERSE
Reverse threading (subthreads above root)
#define mutt_using_threads()
#define mutt_uncollapse_thread(e)
#define mutt_collapse_thread(e)
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
Write a partial string to a Window.
void window_invalidate_all(void)
Mark all windows as in need of repaint.
@ WT_DLG_INDEX
Index Dialog, index_pager_init()
@ WT_INDEX
A panel containing the Index Window.
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
@ WT_MENU
An Window containing a Menu.
@ MUTT_WIN_ORIENT_HORIZONTAL
Window uses all available horizontal space.
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
@ MUTT_WIN_SIZE_MAXIMISE
Window wants as much space as possible.
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
void mview_free(struct MailboxView **ptr)
Free a MailboxView.
bool mview_has_limit(const struct MailboxView *mv)
Is a limit active?
struct MailboxView * mview_new(struct Mailbox *m, struct Notify *parent)
Create a new MailboxView.
int mx_msg_padding_size(struct Mailbox *m)
Bytes of padding between messages - Wrapper for MxOps::msg_padding_size()
int mx_path_canon(char *buf, size_t buflen, const char *folder, enum MailboxType *type)
Canonicalise a mailbox path - Wrapper for MxOps::path_canon()
bool mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
enum MxStatus mx_mbox_check(struct Mailbox *m)
Check for new mail - Wrapper for MxOps::mbox_check()
enum MxStatus mx_mbox_close(struct Mailbox *m)
Save changes and close mailbox.
#define MUTT_READONLY
Open in read-only mode.
uint8_t OpenMailboxFlags
Flags for mutt_open_mailbox(), e.g. MUTT_NOSORT.
#define MUTT_MAILBOX_CHECK_NO_FLAGS
No flags are set.
#define MUTT_OPEN_NO_FLAGS
No flags are set.
#define MUTT_MAILBOX_CHECK_FORCE
Ignore MailboxTime and check for new mail.
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_snc(), and mbox_close()
@ MX_STATUS_ERROR
An error occurred.
@ MX_STATUS_OK
No changes.
@ MX_STATUS_FLAGS
Nondestructive flags change (IMAP)
@ MX_STATUS_REOPENED
Mailbox was reopened.
@ MX_STATUS_NEW_MAIL
New mail received in Mailbox.
Nntp-specific Account data.
Usenet network mailbox type; talk to an NNTP server.
void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct)
Make fully qualified url from newsgroup name.
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
void nm_db_debug_check(struct Mailbox *m)
Check if the database is open.
Notmuch virtual mailbox type.
char * nm_url_from_query(struct Mailbox *m, char *buf, size_t buflen)
Turn a query into a URL.
const char * opcodes_get_name(int op)
Get the name of an opcode.
All user-callable functions.
Match patterns to emails.
#define MUTT_MATCH_FULL_ADDRESS
Match the full address.
Prototypes for many functions.
int mutt_system(const char *cmd)
Run an external command.
#define STAILQ_FOREACH(var, head, field)
#define SLIST_FIRST(head)
#define SORT_MASK
Mask for the sort id.
SortType
Methods for sorting.
@ SORT_THREADS
Sort by email threads.
#define SORT_REVERSE
Reverse the order of the sort.
void mutt_sort_headers(struct MailboxView *mv, bool init)
Sort emails by their headers.
Assorted sorting methods.
void menu_status_line(char *buf, size_t buflen, struct IndexSharedData *shared, struct Menu *menu, int cols, const char *fmt)
Create the status line.
GUI display a user-configurable status line.
A curses colour and its attributes.
LOFF_T offset
offset where the actual data begins
LOFF_T length
length (in bytes) of attachment
long hdr_offset
Offset in stream where the headers begin.
struct ConnAccount account
Account details: username, password, etc.
The envelope/body of an email.
bool display_subject
Used for threading.
bool visible
Is this message part of the view?
bool limit_visited
Has the limit pattern been applied to this message?
bool collapsed
Is this message part of a collapsed thread?
struct Body * body
List of MIME parts.
char * tree
Character string to print thread tree.
bool old
Email is seen, but unread.
struct AttrColor * attr_color
Color-pair to use when displaying in the index.
LOFF_T offset
Where in the stream does this message begin?
int vnum
Virtual message number.
int msgno
Number displayed to the user.
bool deleted
Email is deleted.
int index
The absolute (unsorted) message number.
struct MuttThread * thread
Thread of Emails.
An Event that happened to a Mailbox.
struct Mailbox * mailbox
The Mailbox this Event relates to.
Private state data for the Index.
struct MuttWindow * win_index
Window for the Index.
int newcount
New count of Emails in the Mailbox.
struct IndexSharedData * shared
Shared Index data.
bool tag_prefix
tag-prefix has been pressed
bool do_mailbox_notify
Do we need to notify the user of new mail?
bool attach_msg
Are we in "attach message" mode?
struct Menu * menu
Menu controlling the index.
int oldcount
Old count of Emails in the Mailbox.
Data shared between Index, Pager and Sidebar.
struct Mailbox * mailbox
Current Mailbox.
struct ConfigSubset * sub
Config set to use.
struct MailboxView * mailbox_view
Current Mailbox view.
struct Notify * notify
Notifications: NotifyIndex, IndexSharedData.
bool collapsed
Are all threads collapsed?
struct Menu * menu
Needed for pattern compilation.
off_t vsize
Size (in bytes) of the messages shown.
struct PatternList * limit_pattern
Compiled limit pattern.
struct ThreadsContext * threads
Threads context.
int msg_in_pager
Message currently shown in the pager.
struct Mailbox * mailbox
Current Mailbox.
int vcount
The number of virtual messages.
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
int * v2r
Mapping from virtual to real msgno.
int msg_count
Total number of messages.
AclFlags rights
ACL bits, see AclFlags.
int email_max
Size of emails array.
enum MailboxType type
Mailbox type.
struct Email ** emails
Array of Emails.
char * name
A short name for the Mailbox.
struct Notify * notify
Notifications: NotifyMailbox, EventMailbox.
struct Buffer pathbuf
Path of the Mailbox.
void * compress_info
Compressed mbox module private data.
int msg_tagged
How many messages are tagged?
bool verbose
Display status messages?
struct ConfigSubset * sub
Inherited config items.
Mapping between user-readable string and a constant.
struct MuttThread * parent
Parent of this Thread.
struct MuttThread * prev
Previous sibling Thread.
struct Email * message
Email this Thread refers to.
const struct Mapping * help_data
Data for the Help Bar.
struct WindowState state
Current state of the Window.
struct MuttWindow * focus
Focused Window.
void * wdata
Private data.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
void(* wdata_free)(struct MuttWindow *win, void **ptr)
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
Container for Accounts, Notifications.
struct Notify * notify
Notifications handler.
struct ConfigSubset * sub
Inherited config items.
struct Connection * conn
Connection to NNTP Server.
Data passed to a notification function.
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
void * global_data
Data from notify_observer_add()
Cache commonly-used patterns.
A regular expression and a color to highlight a line.
regex_t regex
Compiled regex.
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
struct AttrColor attr_color
Colour and attributes to apply.
int match
Substring to match, 0 for old behaviour.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
@ MENU_INDEX
Index panel (list of emails)