112 {
N_(
"Exit"), OP_EXIT },
113 {
N_(
"Chdir"), OP_CHANGE_DIRECTORY },
114 {
N_(
"Goto"), OP_BROWSER_GOTO_FOLDER },
115 {
N_(
"Mask"), OP_ENTER_MASK },
116 {
N_(
"Help"), OP_HELP },
124 {
N_(
"Exit"), OP_EXIT },
125 {
N_(
"List"), OP_TOGGLE_MAILBOXES },
126 {
N_(
"Subscribe"), OP_BROWSER_SUBSCRIBE },
127 {
N_(
"Unsubscribe"), OP_BROWSER_UNSUBSCRIBE },
128 {
N_(
"Catchup"), OP_CATCHUP },
129 {
N_(
"Mask"), OP_ENTER_MASK },
130 {
N_(
"Help"), OP_HELP },
147 static bool done =
false;
174 struct stat st = { 0 };
181 rc = S_ISDIR(st.st_mode);
199 const char *name,
const char *desc,
200 const struct stat *st,
struct Mailbox *m,
void *
data)
211 ff.
mode = st->st_mode;
212 ff.
mtime = st->st_mtime;
213 ff.
size = st->st_size;
216 ff.
nlink = st->st_nlink;
266 const char *dirname,
const char *prefix)
277 for (
unsigned int i = 0; i < adata->
groups_num; i++)
293 struct stat st = { 0 };
295 struct dirent *de = NULL;
297 while (stat(dirname, &st) == -1)
302 char *c = strrchr(dirname,
'/');
304 if (c && (c > dirname))
314 if (!S_ISDIR(st.st_mode))
336 while ((de = readdir(dir)))
355 if (S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode))
357 else if (!S_ISREG(st.st_mode))
394 struct stat st = { 0 };
396 struct Buffer *mailbox = NULL;
405 for (
unsigned int i = 0; i <
adata->groups_num; i++)
409 (
mdata->subscribed && (
mdata->unread || !c_show_only_unread))))
443 if (c_browser_abbreviate_mailboxes)
465 if ((!S_ISREG(st.st_mode)) && (!S_ISDIR(st.st_mode)) && (!S_ISLNK(st.st_mode)))
470 struct stat st2 = { 0 };
478 if (st2.st_mtime > st.st_mtime)
479 st.st_mtime = st2.st_mtime;
500 struct BrowserEntryArray *entry = &priv->
state.
entry;
502 return regexec(rx,
ARRAY_GET(entry, line)->desc, 0, NULL, 0);
506 return regexec(rx, search_on, 0, NULL, 0);
518 struct BrowserEntryArray *entry = &bstate->
entry;
588 char title[256] = { 0 };
592 if (index >= menu->
max)
596 if (menu->
top > index)
605 snprintf(title,
sizeof(title),
_(
"Subscribed newsgroups"));
609 snprintf(title,
sizeof(title),
_(
"Newsgroups on server [%s]"),
617 snprintf(title,
sizeof(title),
_(
"Mailboxes [%d]"),
629 snprintf(title,
sizeof(title),
_(
"Subscribed [%s], File mask: %s"),
634 snprintf(title,
sizeof(title),
_(
"Directory [%s], File mask: %s"),
665 bool matched =
false;
693 struct BrowserEntryArray *entry = &priv->
state.
entry;
695 if (S_ISDIR(ff->
mode) ||
809 if (ev_w->
win != win_menu)
854 char ***files,
int *numfiles)
876 for (
size_t i = 0; i <
adata->groups_num; i++)
908 for (; (i > 0) && ((
buf_string(file))[i] !=
'/'); i--)
948 bool browser_track =
false;
956 browser_track =
true;
992 else if (c_spool_file)
1037 const struct Mapping *help_data = NULL;
1107 }
while (!priv->
done);
#define ARRAY_RESERVE(head, num)
Reserve memory for the array.
#define ARRAY_FIRST(head)
Convenience method to get the first element.
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
#define ARRAY_EMPTY(head)
Check if an array is empty.
#define ARRAY_SIZE(head)
The number of elements stored.
#define ARRAY_INIT(head)
Initialize an array.
#define ARRAY_GET(head, idx)
Return the element at index.
int imap_browse(const char *path, struct BrowserState *state)
IMAP hook into the folder browser.
const struct ExpandoRenderCallback FolderRenderCallbacks[]
Callbacks for Browser Expandos.
int browser_function_dispatcher(struct MuttWindow *win, int op)
Perform a Browser function.
#define MUTT_SEL_MAILBOX
Select a mailbox.
void browser_sort(struct BrowserState *state)
Sort the entries in the browser.
#define MUTT_SEL_FOLDER
Select a local directory.
#define MUTT_SEL_MULTI
Multi-selection is enabled.
uint8_t SelectFileFlags
Flags for mutt_select_file(), e.g. MUTT_SEL_MAILBOX.
struct BrowserPrivateData * browser_private_data_new(void)
Create new Browser Data.
@ BROWSER_SORT_ALPHA
Sort alphabetically by name.
@ BROWSER_SORT_UNSORTED
Sort into the raw order.
@ BROWSER_SORT_DESC
Sort by description.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
size_t buf_addstr_n(struct Buffer *buf, const char *s, size_t len)
Add a string to a Buffer, expanding it if necessary.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
size_t buf_strcpy_n(struct Buffer *buf, const char *s, size_t len)
Copy a string into a Buffer.
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
size_t buf_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
const struct Regex * cs_subset_regex(const struct ConfigSubset *sub, const char *name)
Get a regex config item by name.
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.
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
Convenience wrapper for the config headers.
#define SORT_MASK
Mask for the sort id.
Convenience wrapper for the core headers.
@ NT_MAILBOX_DELETE
Mailbox is about to be deleted.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
@ MUTT_MMDF
'mmdf' Mailbox type
@ MUTT_POP
'POP3' Mailbox type
@ MUTT_MH
'MH' Mailbox type
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
@ MUTT_IMAP
'IMAP' Mailbox type
@ MUTT_MBOX
'mbox' Mailbox type
@ MUTT_MAILBOX_ANY
Match any Mailbox type.
@ MUTT_MAILDIR
'Maildir' Mailbox type
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
@ FR_UNKNOWN
Unknown function.
int examine_directory(struct Mailbox *m, struct Menu *menu, struct BrowserState *state, const char *dirname, const char *prefix)
Get list of all files/newsgroups with mask.
void init_menu(struct BrowserState *state, struct Menu *menu, struct Mailbox *m, struct MuttWindow *sbar)
Set up a new menu.
static void init_lastdir(void)
Initialise the browser directories.
static const struct Mapping FolderNewsHelp[]
Help Bar for the NNTP Mailbox browser dialog.
struct Buffer LastDir
Browser: previous selected directory.
void mutt_browser_select_dir(const char *f)
Remember the last directory selected.
void init_state(struct BrowserState *state)
Initialise a browser state.
struct Buffer LastDirBackup
Browser: backup copy of the current directory.
static const struct Mapping FolderHelp[]
Help Bar for the File/Dir/Mailbox browser dialog.
void browser_add_folder(const struct Menu *menu, struct BrowserState *state, const char *name, const char *desc, const struct stat *st, struct Mailbox *m, void *data)
Add a folder to the browser list.
void mutt_browser_cleanup(void)
Clean up working Buffers.
void browser_highlight_default(struct BrowserState *state, struct Menu *menu)
Decide which browser item should be highlighted.
int examine_mailboxes(struct Mailbox *m, struct Menu *menu, struct BrowserState *state)
Get list of mailboxes/subscribed newsgroups.
bool link_is_dir(const char *folder, const char *path)
Does this symlink point to a directory?
Structs that make up an email.
EmailSortType
Methods for sorting Emails.
int expando_filter(const struct Expando *exp, const struct ExpandoRenderCallback *erc, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando and run the result through a filter.
const struct ExpandoRenderCallback GroupIndexRenderCallbacks[]
Callbacks for Nntp Browser Expandos.
DIR * mutt_file_opendir(const char *path, enum MuttOpenDirMode mode)
Open a directory.
@ MUTT_OPENDIR_NONE
Plain opendir()
int km_dokey(enum MenuType mtype, GetChFlags flags)
Determine what a keypress should do.
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
bool OptNews
(pseudo) used to change reader mode
char * CurrentFolder
Currently selected mailbox.
int menu_tagging_dispatcher(struct MuttWindow *win, int op)
Perform tagging operations on the Menu - 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 -.
void dlg_browser(struct Buffer *file, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
Let the user select a file -.
#define mutt_debug(LEVEL,...)
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe() -.
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
static int browser_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
void browser_private_data_free(struct BrowserPrivateData **ptr)
Free Private Browser Data - Implements MuttWindow::wdata_free() -.
Convenience wrapper for the gui headers.
void simple_dialog_free(struct MuttWindow **ptr)
Destroy a simple index Dialog.
struct SimpleDialogWindows simple_dialog_new(enum MenuType mtype, enum WindowType wtype, const struct Mapping *help_data)
Create a simple index Dialog.
void imap_clean_path(char *path, size_t plen)
Cleans an IMAP path using imap_fix_path.
#define GETCH_NO_FLAGS
No flags are set.
@ LL_DEBUG5
Log at debug level 5.
@ LL_DEBUG1
Log at debug level 1.
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.
const char * mutt_path_getcwd(struct Buffer *cwd)
Get the current working directory.
bool mutt_regex_match(const struct Regex *regex, const char *str)
Shorthand to mutt_regex_capture()
char * mutt_str_dup(const char *str)
Copy a string, safely.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
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.
Mailbox helper functions.
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
@ WT_DLG_BROWSER
Browser Dialog, dlg_browser()
@ NT_WINDOW_DELETE
Window is about to be deleted.
void mutt_get_parent_path(const char *path, char *buf, size_t buflen)
Find the parent of a path (or mailbox)
void buf_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Some miscellaneous functions.
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
#define MUTT_MAILBOX_CHECK_NO_FLAGS
No flags are set.
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
Nntp-specific Account data.
Usenet network mailbox type; talk to an NNTP server.
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Nntp-specific Mailbox data.
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
const char * opcodes_get_name(int op)
Get the name of an opcode.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
#define STAILQ_HEAD_INITIALIZER(head)
#define STAILQ_FOREACH(var, head, field)
#define TAILQ_EMPTY(head)
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
void * adata
Private data (for Mailbox backends)
Private state data for the Browser.
char *** files
Array of selected files.
struct Buffer * prefix
Folder prefix string.
bool kill_prefix
Prefix is in use.
bool done
Should we close the Dialog?
bool folder
Select folders.
int last_selected_mailbox
Index of last selected Mailbox.
int * numfiles
Number of selected files.
struct Mailbox * mailbox
Mailbox.
struct BrowserState state
State containing list of files/dir/mailboxes.
struct Buffer * file
Buffer for the result.
bool multiple
Allow multiple selections.
struct MuttWindow * sbar
Status Bar.
State of the file/mailbox browser.
char * folder
Folder name.
bool is_mailbox_list
Viewing mailboxes.
struct BrowserEntryArray entry
Array of files / dirs / mailboxes.
bool imap_browse
IMAP folder.
String manipulation buffer.
char * data
Pointer to data.
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
char host[128]
Server to login to.
struct ConnAccount account
Account details: username, password, etc.
const char * name
Name of config item that changed.
An Event that happened to a Mailbox.
struct Mailbox * mailbox
The Mailbox this Event relates to.
An Event that happened to a Window.
struct MuttWindow * win
Window that changed.
WindowNotifyFlags flags
Attributes of Window that changed.
Browser entry representing a folder/dir.
bool imap
This is an IMAP folder.
bool has_mailbox
This is a mailbox.
char * name
Name of file/dir/mailbox.
bool tagged
Folder is tagged.
gid_t gid
File's Group ID.
bool has_new_mail
true if mailbox has "new mail"
bool poll_new_mail
Check mailbox for new mail.
bool notify_user
User will be notified of new mail.
nlink_t nlink
Number of hard links.
char * desc
Description of mailbox.
struct NntpMboxData * nd
Extra NNTP data.
int gen
Unique id, used for (un)sorting.
time_t mtime
Modification time.
int msg_count
total number of messages
mode_t mode
File permissions.
int msg_unread
number of unread messages
A folder/dir in the browser.
struct FolderFile * ff
File / Dir / Mailbox.
struct Mailbox * mailbox
Mailbox in the list.
bool has_new
Mailbox has new mail.
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
int msg_count
Total number of messages.
enum MailboxType type
Mailbox type.
bool poll_new_mail
Check for new mail.
void * mdata
Driver specific data.
char * name
A short name for the Mailbox.
bool notify_user
Notify the user of new mail.
bool visible
True if a result of "mailboxes".
int msg_unread
Number of unread messages.
int gen
Generation number, for sorting.
Mapping between user-readable string and a constant.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Container for Accounts, Notifications.
struct AccountList accounts
List of all Accounts.
struct Notify * notify
Notifications handler.
struct ConfigSubset * sub
Inherited config items.
NNTP-specific Account data -.
struct NntpMboxData ** groups_list
struct Connection * conn
Connection to NNTP Server.
NNTP-specific Mailbox data -.
struct NntpAccountData * adata
Data passed to a notification function.
void * event_data
Data from notify_send()
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()
Cached regular expression.
char * pattern
printable version
Tuple for the results of simple_dialog_new()
struct MuttWindow * sbar
Simple Bar.
struct MuttWindow * dlg
Main Dialog Window.
@ MENU_FOLDER
General file/mailbox browser.