70 {
"catchup", OP_CATCHUP },
71 {
"change-dir", OP_CHANGE_DIRECTORY },
72 {
"check-new", OP_CHECK_NEW },
73 {
"create-mailbox", OP_CREATE_MAILBOX },
74 {
"delete-mailbox", OP_DELETE_MAILBOX },
75 {
"descend-directory", OP_DESCEND_DIRECTORY },
76 {
"display-filename", OP_BROWSER_TELL },
77 {
"enter-mask", OP_ENTER_MASK },
79 {
"goto-folder", OP_BROWSER_GOTO_FOLDER },
80 {
"goto-parent", OP_GOTO_PARENT },
81 {
"mailbox-list", OP_MAILBOX_LIST },
82 {
"reload-active", OP_LOAD_ACTIVE },
83 {
"rename-mailbox", OP_RENAME_MAILBOX },
84 {
"select-new", OP_BROWSER_NEW_FILE },
86 {
"sort-reverse", OP_SORT_REVERSE },
87 {
"subscribe", OP_BROWSER_SUBSCRIBE },
88 {
"subscribe-pattern", OP_SUBSCRIBE_PATTERN },
89 {
"toggle-mailboxes", OP_TOGGLE_MAILBOXES },
90 {
"toggle-subscribed", OP_BROWSER_TOGGLE_LSUB },
91 {
"uncatchup", OP_UNCATCHUP },
92 {
"unsubscribe", OP_BROWSER_UNSUBSCRIBE },
93 {
"unsubscribe-pattern", OP_UNSUBSCRIBE_PATTERN },
94 {
"view-file", OP_BROWSER_VIEW_FILE },
104 { OP_BROWSER_GOTO_FOLDER,
"=" },
105 { OP_BROWSER_NEW_FILE,
"N" },
106 { OP_BROWSER_SUBSCRIBE,
"s" },
107 { OP_BROWSER_TELL,
"@" },
108 { OP_BROWSER_TOGGLE_LSUB,
"T" },
109 { OP_BROWSER_UNSUBSCRIBE,
"u" },
110 { OP_BROWSER_VIEW_FILE,
" " },
111 { OP_CHANGE_DIRECTORY,
"c" },
112 { OP_CREATE_MAILBOX,
"C" },
113 { OP_DELETE_MAILBOX,
"d" },
114 { OP_ENTER_MASK,
"m" },
116 { OP_GOTO_PARENT,
"p" },
117 { OP_MAILBOX_LIST,
"." },
118 { OP_RENAME_MAILBOX,
"r" },
120 { OP_SORT_REVERSE,
"O" },
121 { OP_TOGGLE_MAILBOXES,
"\t" },
184 if (!ffpa || !state || !menu)
201 if ((index < 0) || (index >= max))
204 int n = (count > 1) ? count : 1;
205 if ((index + n) > max)
208 for (
int i = 0; i < n; i++)
259 if (!ff || !ff->
name)
283 if (!ff || !ff->
name)
305 const bool subscribe = (
event->op == OP_BROWSER_SUBSCRIBE);
338 const int next = index + num;
378 mutt_message(
"set imap_list_subscribed = %s", c_imap_list_subscribed ?
"yes" :
"no");
404 else if (S_ISDIR(ff->
mode) ||
450 if (!ff || !ff->
name)
496 (event->
op == OP_CATCHUP));
505 if (next < priv->menu->max)
539 const int op =
event->op;
540 if (op == OP_CHANGE_DIRECTORY)
551 else if (op == OP_GOTO_PARENT)
553 const int count =
MAX(event->
count, 1);
554 for (
int i = 0; i < count; i++)
599 struct stat st = { 0 };
602 if (S_ISDIR(st.st_mode))
647 mutt_error(
_(
"Create is only supported for IMAP mailboxes"));
680 struct Mailbox *m,
int *num_failed)
691 if (!ff || !ff->
name)
706 *num_failed = failed;
738 mutt_error(
_(
"Delete is only supported for IMAP mailboxes"));
747 mutt_error(
_(
"Can't delete currently selected mailbox"));
754 char msg[128] = { 0 };
757 snprintf(msg,
sizeof(msg),
_(
"Really delete %d tagged mailboxes?"), num);
762 snprintf(msg,
sizeof(msg),
_(
"Really delete mailbox \"%s\"?"), ff->
name);
780 else if (deleted == 1)
860 char **tfiles = NULL;
879 *priv->
files = tfiles;
887 *priv->
files = tfiles;
900 int num =
event->count;
907 if ((num < 1) || (num > menu->
max))
926 if (event->
count > 0)
936 const int op =
event->op;
943 else if (S_ISDIR(ff->
mode) ||
975 if ((lastdirlen > 1) &&
1012 if (url && url->
path && (ff->
delim !=
'\0'))
1068 else if (op == OP_DESCEND_DIRECTORY)
1105 for (
size_t i = 0; i <
adata->groups_num; i++)
1151 mutt_error(
_(
"Rename is only supported for IMAP mailboxes"));
1180 const int op =
event->op;
1181 int reverse = (op == OP_SORT_REVERSE);
1185 _(
"Reverse sort by (d)ate, (a)lpha, si(z)e, d(e)scription, (c)ount, ne(w) count, or do(n)'t sort?") :
1187 _(
"Sort by (d)ate, (a)lpha, si(z)e, d(e)scription, (c)ount, ne(w) count, or do(n)'t sort?"),
1252 char tmp2[256] = { 0 };
1254 const int op =
event->op;
1256 if (op == OP_SUBSCRIBE_PATTERN)
1257 snprintf(tmp2,
sizeof(tmp2),
_(
"Subscribe pattern: "));
1259 snprintf(tmp2,
sizeof(tmp2),
_(
"Unsubscribe pattern: "));
1271 regerror(err, &rx, buf->
data, buf->
dsize);
1288 if (regexec(&rx, ff->
name, 0, NULL, 0) == 0)
1290 if (op == OP_SUBSCRIBE_PATTERN)
1297 if (op == OP_SUBSCRIBE_PATTERN)
1299 for (
size_t j = 0; j < adata->
groups_num; j++)
1304 if (regexec(&rx,
mdata->group, 0, NULL, 0) == 0)
1338 const int op =
event->op;
1339 if (op == OP_TOGGLE_MAILBOXES)
1344 if (op == OP_BROWSER_GOTO_FOLDER)
1446 if (!dlg || !dlg->
wdata)
1458 if (fn->
op == event->
op)
#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_REVERSE(elem, head)
Iterate backwards over all elements of the array.
#define ARRAY_REMOVE(head, elem)
Remove an entry from the array, shifting down the subsequent entries.
#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_FREE(head)
Release all memory.
#define ARRAY_FOREACH_FROM(elem, head, from)
Iterate from an index to the end.
#define ARRAY_GET(head, idx)
Return the element at index.
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
GUI display the mailboxes in a side panel.
int bool_str_toggle(struct ConfigSubset *sub, const char *name, struct Buffer *err)
Toggle the value of a bool.
int imap_browse(const char *path, struct BrowserState *state)
IMAP hook into the folder browser.
int imap_mailbox_create(const char *path)
Create a new IMAP mailbox.
int imap_mailbox_rename(const char *path)
Rename a mailbox.
const struct CompleteOps CompleteMailboxOps
Auto-Completion of Files / Mailboxes.
static void browser_apply_subscribe_imap(struct FolderFilePtrArray *ffpa, bool subscribe)
Subscribe/unsubscribe to IMAP mailboxes.
static struct NntpMboxData * browser_apply_catchup(struct FolderFilePtrArray *ffpa, struct Mailbox *m, struct NntpAccountData *adata, bool up)
(Un)catchup a working set of newsgroups
static int browser_apply_delete_mailbox(struct FolderFilePtrArray *ffpa, struct BrowserState *state, struct Mailbox *m, int *num_failed)
Delete a working set of IMAP mailboxes.
static const struct MenuOpSeq BrowserDefaultBindings[]
Key bindings for the file Browser Menu.
static void browser_apply_subscribe_nntp(struct FolderFilePtrArray *ffpa, struct NntpAccountData *adata, bool subscribe)
Subscribe/unsubscribe to NNTP newsgroups.
static const struct MenuFuncOp OpBrowser[]
Functions for the file Browser Menu.
void browser_init_keys(struct NeoMutt *n, struct SubMenu *sm_generic)
Initialise the Browser Keybindings - Implements ::init_keys_api.
static int browser_add_selection(struct FolderFilePtrArray *ffpa, struct BrowserState *state, struct Menu *menu, bool tagged, int count)
Build a working set of FolderFile pointers for an action.
void destroy_state(struct BrowserState *state)
Free the BrowserState.
int browser_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Browser function.
static const struct BrowserFunction BrowserFunctions[]
All the NeoMutt functions that the Browser supports.
Select a Mailbox from a list.
void browser_sort(struct BrowserState *state)
Sort the entries in the browser.
Browser private Module data.
Private state data for the Browser.
Browser sorting functions.
@ BROWSER_SORT_ALPHA
Sort by name.
@ BROWSER_SORT_UNSORTED
Sort into the raw order.
@ BROWSER_SORT_COUNT
Sort by total message count.
@ BROWSER_SORT_DATE
Sort by date.
@ BROWSER_SORT_NEW
Sort by count of new messages.
@ BROWSER_SORT_SIZE
Sort by size.
@ BROWSER_SORT_DESC
Sort by description.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
size_t buf_len(const struct Buffer *buf)
Calculate the length of 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_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string 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.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
size_t buf_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
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.
Convenience wrapper for the config headers.
#define CSR_RESULT(x)
Extract the result code from CSR_* flags.
#define CSR_SUCCESS
Action completed successfully.
#define SORT_REVERSE
Reverse the order of the sort.
Convenience wrapper for the core headers.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
MailboxType
Supported mailbox formats.
@ MUTT_MAILBOX_ERROR
Error occurred examining Mailbox.
@ MUTT_IMAP
'IMAP' Mailbox type
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
@ FR_SUCCESS
Valid function - successfully performed.
@ FR_DONE
Exit the Dialog.
@ FR_UNKNOWN
Unknown function.
@ FR_ERROR
Valid function - error occurred.
@ FR_NOT_IMPL
Invalid function - feature not enabled.
@ FR_NO_ACTION
Valid function - no action performed.
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.
void init_state(struct BrowserState *state)
Initialise a browser state.
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 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?
@ MUTT_COMP_NONE
No flags are set.
void mutt_body_free(struct Body **ptr)
Free a Body.
Structs that make up an email.
void mutt_unget_op(int op)
Return an operation to the input buffer.
@ MFF_DEPRECATED
Function is deprecated.
bool OptNews
(pseudo) used to change reader mode
static int op_jump(struct AliasFunctionData *fdata, const struct KeyEvent *event)
Jump to an index number - Implements alias_function_t -.
static int op_exit(struct AliasFunctionData *fdata, const struct KeyEvent *event)
exit this menu - Implements alias_function_t -
static int op_generic_select_entry(struct AliasFunctionData *fdata, const struct KeyEvent *event)
select the current entry - Implements alias_function_t -
static int op_sort(struct AliasFunctionData *fdata, const struct KeyEvent *event)
sort aliases - Implements alias_function_t -
static int op_browser_new_file(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Select a new file in this directory - Implements browser_function_t -.
static int op_rename_mailbox(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Rename the current mailbox (IMAP only) - Implements browser_function_t -.
static int op_create_mailbox(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Create a new mailbox (IMAP only) - Implements browser_function_t -.
static int op_browser_view_file(struct BrowserPrivateData *priv, const struct KeyEvent *event)
View file - Implements browser_function_t -.
static int op_mailbox_list(struct BrowserPrivateData *priv, const struct KeyEvent *event)
List mailboxes with new mail - Implements browser_function_t -.
static int op_catchup(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Mark all articles in newsgroup as read - Implements browser_function_t -.
static int op_browser_subscribe(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Subscribe to current mbox (IMAP/NNTP only) - Implements browser_function_t -.
static int op_delete_mailbox(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Delete the current mailbox (IMAP only) - Implements browser_function_t -.
static int op_load_active(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Load list of all newsgroups from NNTP server - Implements browser_function_t -.
static int op_enter_mask(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Enter a file mask - Implements browser_function_t -.
static int op_subscribe_pattern(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Subscribe to newsgroups matching a pattern - Implements browser_function_t -.
static int op_browser_tell(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Display the currently selected file's name - Implements browser_function_t -.
static int op_browser_toggle_lsub(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Toggle view all/subscribed mailboxes (IMAP only) - Implements browser_function_t -.
static int op_toggle_mailboxes(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Toggle whether to browse mailboxes or all files - Implements browser_function_t -.
static int op_change_directory(struct BrowserPrivateData *priv, const struct KeyEvent *event)
Change directories - Implements browser_function_t -.
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
int mw_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question -.
#define mutt_warning(...)
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox?
Convenience wrapper for the gui headers.
Read/write command history from/to a file.
@ HC_OTHER
Miscellaneous strings.
int imap_subscribe(const char *path, bool subscribe)
Subscribe to a mailbox.
int imap_delete_mailbox(struct Mailbox *m, char *path)
Delete a mailbox.
void km_menu_add_submenu(struct MenuDefinition *md, struct SubMenu *sm)
Add a SubMenu to a Menu Definition.
struct SubMenu * km_register_submenu(const struct MenuFuncOp functions[])
Register a submenu.
struct MenuDefinition * km_register_menu(int menu, const char *name)
Register a menu.
void km_menu_add_bindings(struct MenuDefinition *md, const struct MenuOpSeq bindings[])
Add Keybindings to a Menu.
@ LL_DEBUG3
Log at debug level 3.
#define FREE(x)
Free memory and set the pointer to NULL.
#define MUTT_MEM_CALLOC(n, type)
#define MAX(a, b)
Return the maximum of two values.
@ MODULE_ID_BROWSER
ModuleBrowser, Mailbox Browser
@ MODULE_ID_NNTP
ModuleNntp, Nntp
Convenience wrapper for the library headers.
size_t mutt_path_realpath(struct Buffer *path)
Resolve path, unraveling symlinks.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
int mutt_view_attachment(FILE *fp, struct Body *b, enum ViewAttachMode mode, struct Email *e, struct AttachCtx *actx, struct MuttWindow *win)
View an attachment.
@ MUTT_VA_REGULAR
View using default method.
bool mutt_mailbox_list(void)
Show a message with the list of mailboxes with new mail.
Mailbox helper functions.
void mutt_get_parent_path(const char *path, char *buf, size_t buflen)
Find the parent of a path (or mailbox)
void expand_path(struct Buffer *buf, bool regex)
Create the canonical path.
Some miscellaneous functions.
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Nntp-specific Account data.
Usenet network mailbox type; talk to an NNTP server.
void nntp_clear_cache(struct NntpAccountData *adata)
Clear the NNTP cache.
int nntp_active_fetch(struct NntpAccountData *adata, bool mark_new)
Fetch list of all newsgroups from server.
int nntp_newsrc_parse(struct NntpAccountData *adata)
Parse .newsrc file.
void nntp_newsrc_close(struct NntpAccountData *adata)
Unlock and close .newsrc file.
struct NntpMboxData * mutt_newsgroup_catchup(struct Mailbox *m, struct NntpAccountData *adata, char *group)
Catchup newsgroup.
int nntp_newsrc_update(struct NntpAccountData *adata)
Update .newsrc file.
struct NntpMboxData * mutt_newsgroup_subscribe(struct NntpAccountData *adata, char *group)
Subscribe newsgroup.
struct NntpMboxData * mutt_newsgroup_uncatchup(struct Mailbox *m, struct NntpAccountData *adata, char *group)
Uncatchup newsgroup.
struct NntpMboxData * mutt_newsgroup_unsubscribe(struct NntpAccountData *adata, char *group)
Unsubscribe newsgroup.
Nntp-specific Mailbox data.
const struct CompleteOps CompletePatternOps
Auto-Completion of Patterns.
Match patterns to emails.
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.
@ MUTT_NO
User answered 'No', or assume 'No'.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
enum QuadOption query_yesorno(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question.
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
Convenience wrapper for the send headers.
struct Body * mutt_make_file_attach(const char *path, struct ConfigSubset *sub)
Create a file attachment.
void * adata
Private data (for Mailbox backends)
int op
Op code, e.g. OP_MAIN_LIMIT.
browser_function_t function
Function to call.
Browser private Module data.
struct MenuDefinition * menu_browser
Browser menu definition.
struct Buffer last_dir
Browser: previous selected directory.
struct Buffer last_dir_backup
Browser: backup copy of the current directory.
Private state data for the Browser.
char *** files
Array of selected files.
struct Buffer * prefix
Folder prefix string.
struct Buffer * old_last_dir
Previous to last dir.
bool kill_prefix
Prefix is in use.
bool done
Should we close the Dialog?
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.
char goto_swapper[PATH_MAX]
Saved path after <goto-folder>
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.
size_t dsize
Length of data.
char * data
Pointer to data.
Input for the file completion function.
Browser entry representing a folder/dir.
bool selectable
Folder can be selected.
char delim
Path delimiter.
bool imap
This is an IMAP folder.
char * name
Name of file/dir/mailbox.
bool tagged
Folder is tagged.
char * desc
Description of mailbox.
mode_t mode
File permissions.
bool inferiors
Folder has children.
An event such as a keypress.
int count
Optional count prefix, e.g. 3 for 3j
int op
Function opcode, e.g. OP_HELP.
void * mdata
Driver specific data.
void * wdata
Private data.
Container for Accounts, Notifications.
char * home_dir
User's home directory.
struct ConfigSubset * sub
Inherited config items.
NNTP-specific Account data -.
struct NntpMboxData ** groups_list
List of newsgroups.
unsigned int groups_num
Number of newsgroups.
NNTP-specific Mailbox data -.
bool deleted
Newsgroup is deleted.
struct NntpAccountData * adata
Account data.
Nntp private Module data.
struct NntpAccountData * current_news_srv
Current NNTP news server.
Cached regular expression.
char * pattern
printable version
A parsed URL proto://user:password@host:port/path?a=1&b=2
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
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.
@ MENU_BROWSER
General file/mailbox browser.
struct Url * url_parse(const char *src)
Fill in Url.
void url_free(struct Url **ptr)
Free the contents of a URL.