32#include "docs/makedoc_defs.h"
75 {
"catchup", OP_CATCHUP },
76 {
"change-dir", OP_CHANGE_DIRECTORY },
77 {
"check-new", OP_CHECK_NEW },
78 {
"create-mailbox", OP_CREATE_MAILBOX },
79 {
"delete-mailbox", OP_DELETE_MAILBOX },
80 {
"descend-directory", OP_DESCEND_DIRECTORY },
81 {
"display-filename", OP_BROWSER_TELL },
82 {
"enter-mask", OP_ENTER_MASK },
84 {
"goto-folder", OP_BROWSER_GOTO_FOLDER },
85 {
"goto-parent", OP_GOTO_PARENT },
86 {
"mailbox-list", OP_MAILBOX_LIST },
87 {
"reload-active", OP_LOAD_ACTIVE },
88 {
"rename-mailbox", OP_RENAME_MAILBOX },
89 {
"select-new", OP_BROWSER_NEW_FILE },
91 {
"sort-reverse", OP_SORT_REVERSE },
92 {
"subscribe", OP_BROWSER_SUBSCRIBE },
93 {
"subscribe-pattern", OP_SUBSCRIBE_PATTERN },
94 {
"toggle-mailboxes", OP_TOGGLE_MAILBOXES },
95 {
"toggle-subscribed", OP_BROWSER_TOGGLE_LSUB },
96 {
"uncatchup", OP_UNCATCHUP },
97 {
"unsubscribe", OP_BROWSER_UNSUBSCRIBE },
98 {
"unsubscribe-pattern", OP_UNSUBSCRIBE_PATTERN },
99 {
"view-file", OP_BROWSER_VIEW_FILE },
101 {
"buffy-list", OP_MAILBOX_LIST },
109 { OP_BROWSER_GOTO_FOLDER,
"=" },
110 { OP_BROWSER_NEW_FILE,
"N" },
111 { OP_BROWSER_SUBSCRIBE,
"s" },
112 { OP_BROWSER_TELL,
"@" },
113 { OP_BROWSER_TOGGLE_LSUB,
"T" },
114 { OP_BROWSER_UNSUBSCRIBE,
"u" },
115 { OP_BROWSER_VIEW_FILE,
" " },
116 { OP_CHANGE_DIRECTORY,
"c" },
117 { OP_CREATE_MAILBOX,
"C" },
118 { OP_DELETE_MAILBOX,
"d" },
119 { OP_ENTER_MASK,
"m" },
121 { OP_GOTO_PARENT,
"p" },
122 { OP_MAILBOX_LIST,
"." },
123 { OP_RENAME_MAILBOX,
"r" },
125 { OP_SORT_REVERSE,
"O" },
126 { OP_TOGGLE_MAILBOXES,
"\t" },
199 if (op == OP_BROWSER_SUBSCRIBE)
274 else if (S_ISDIR(ff->
mode) ||
316 if (op == OP_CATCHUP)
325 if (index < priv->menu->max)
358 if (op == OP_CHANGE_DIRECTORY)
369 else if (op == OP_GOTO_PARENT)
411 struct stat st = { 0 };
414 if (S_ISDIR(st.st_mode))
457 mutt_error(
_(
"Create is only supported for IMAP mailboxes"));
488 mutt_error(
_(
"Delete is only supported for IMAP mailboxes"));
492 char msg[128] = { 0 };
499 mutt_error(
_(
"Can't delete currently selected mailbox"));
503 snprintf(msg,
sizeof(msg),
_(
"Really delete mailbox \"%s\"?"), ff->
name);
600 char **tfiles = NULL;
619 *priv->
files = tfiles;
627 *priv->
files = tfiles;
652 if (S_ISDIR(ff->
mode) ||
719 if (url && url->
path && (ff->
delim !=
'\0'))
775 else if (op == OP_DESCEND_DIRECTORY)
811 for (
size_t i = 0; i <
adata->groups_num; i++)
815 mdata->deleted =
true;
853 mutt_error(
_(
"Rename is only supported for IMAP mailboxes"));
884 int reverse = (op == OP_SORT_REVERSE);
888 _(
"Reverse sort by (d)ate, (a)lpha, si(z)e, d(e)scription, (c)ount, ne(w) count, or do(n)'t sort?") :
890 _(
"Sort by (d)ate, (a)lpha, si(z)e, d(e)scription, (c)ount, ne(w) count, or do(n)'t sort?"),
954 char tmp2[256] = { 0 };
957 if (op == OP_SUBSCRIBE_PATTERN)
958 snprintf(tmp2,
sizeof(tmp2),
_(
"Subscribe pattern: "));
960 snprintf(tmp2,
sizeof(tmp2),
_(
"Unsubscribe pattern: "));
972 regerror(err, &rx, buf->
data, buf->
dsize);
989 if (regexec(&rx, ff->
name, 0, NULL, 0) == 0)
991 if (op == OP_SUBSCRIBE_PATTERN)
998 if (op == OP_SUBSCRIBE_PATTERN)
1000 for (
size_t j = 0; j < adata->
groups_num; j++)
1005 if (regexec(&rx,
mdata->group, 0, NULL, 0) == 0)
1037 if (op == OP_TOGGLE_MAILBOXES)
1042 if (op == OP_BROWSER_GOTO_FOLDER)
#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_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.
static const char * Not_available_in_this_menu
Error message for unavailable functions.
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.
const struct CompleteOps CompleteMailboxOps
Auto-Completion of Files / Mailboxes.
int browser_function_dispatcher(struct MuttWindow *win, int op)
Perform a Browser function.
const struct MenuOpSeq BrowserDefaultBindings[]
Key bindings for the file Browser Menu.
const struct MenuFuncOp OpBrowser[]
Functions for the file Browser Menu.
void destroy_state(struct BrowserState *state)
Free the BrowserState.
static const struct BrowserFunction BrowserFunctions[]
All the NeoMutt functions that the Browser supports.
void browser_sort(struct BrowserState *state)
Sort the entries in the browser.
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.
Convenience wrapper for the config headers.
char * HomeDir
User's home directory.
#define CSR_SUCCESS
Action completed successfully.
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.
void mutt_unget_op(int op)
Return an operation to the input buffer.
@ 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.
void init_state(struct BrowserState *state, struct Menu *menu)
Initialise a browser state.
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.
struct Buffer LastDir
Browser: previous selected directory.
struct Buffer LastDirBackup
Browser: backup copy of the current directory.
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?
void mutt_body_free(struct Body **ptr)
Free a Body.
Structs that make up an email.
bool OptNews
(pseudo) used to change reader mode
static int op_generic_select_entry(struct AliasMenuData *mdata, int op)
select the current entry - Implements alias_function_t -
static int op_exit(struct AliasMenuData *mdata, int op)
exit this menu - Implements alias_function_t -
static int op_sort(struct AliasMenuData *mdata, int op)
sort aliases - Implements alias_function_t -
static int op_browser_view_file(struct BrowserPrivateData *priv, int op)
View file - Implements browser_function_t -.
static int op_browser_new_file(struct BrowserPrivateData *priv, int op)
Select a new file in this directory - Implements browser_function_t -.
static int op_enter_mask(struct BrowserPrivateData *priv, int op)
Enter a file mask - Implements browser_function_t -.
static int op_subscribe_pattern(struct BrowserPrivateData *priv, int op)
Subscribe to newsgroups matching a pattern - Implements browser_function_t -.
static int op_catchup(struct BrowserPrivateData *priv, int op)
Mark all articles in newsgroup as read - Implements browser_function_t -.
static int op_rename_mailbox(struct BrowserPrivateData *priv, int op)
Rename the current mailbox (IMAP only) - Implements browser_function_t -.
static int op_browser_subscribe(struct BrowserPrivateData *priv, int op)
Subscribe to current mbox (IMAP/NNTP only) - Implements browser_function_t -.
static int op_browser_toggle_lsub(struct BrowserPrivateData *priv, int op)
Toggle view all/subscribed mailboxes (IMAP only) - Implements browser_function_t -.
static int op_create_mailbox(struct BrowserPrivateData *priv, int op)
Create a new mailbox (IMAP only) - Implements browser_function_t -.
static int op_delete_mailbox(struct BrowserPrivateData *priv, int op)
Delete the current mailbox (IMAP only) - Implements browser_function_t -.
static int op_load_active(struct BrowserPrivateData *priv, int op)
Load list of all newsgroups from NNTP server - Implements browser_function_t -.
static int op_toggle_mailboxes(struct BrowserPrivateData *priv, int op)
Toggle whether to browse mailboxes or all files - Implements browser_function_t -.
static int op_browser_tell(struct BrowserPrivateData *priv, int op)
Display the currently selected file's name - Implements browser_function_t -.
static int op_mailbox_list(struct BrowserPrivateData *priv, int op)
List mailboxes with new mail - Implements browser_function_t -.
static int op_change_directory(struct BrowserPrivateData *priv, int op)
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_message(...)
#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() -.
Convenience wrapper for the gui headers.
Read/write command history from/to a file.
@ HC_OTHER
Miscellaneous strings.
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.
int imap_subscribe(const char *path, bool subscribe)
Subscribe to a mailbox.
int imap_delete_mailbox(struct Mailbox *m, char *path)
Delete a mailbox.
@ LL_DEBUG3
Log at debug level 3.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
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)
Many unsorted constants and some structs.
#define MUTT_COMP_NO_FLAGS
No flags are set.
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 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.
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 NntpAccountData * CurrentNewsSrv
Current NNTP news server.
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.
@ SORT_SUBJECT
Sort by the email's subject.
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
@ SORT_SIZE
Sort by the size of the email.
@ SORT_DESC
Sort by the folder's description.
@ SORT_DATE
Sort by the date the email was sent.
@ SORT_COUNT
Sort by number of emails in a folder.
@ SORT_UNREAD
Sort by the number of unread emails.
#define SORT_REVERSE
Reverse the order of the sort.
void * adata
Private data (for Mailbox backends)
int op
Op code, e.g. OP_MAIN_LIMIT.
browser_function_t function
Function to call.
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.
void * mdata
Driver specific data.
void * wdata
Private data.
struct MuttWindow * parent
Parent Window.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
NNTP-specific Account data -.
NNTP-specific Mailbox data -.
struct NntpAccountData * adata
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.
struct Url * url_parse(const char *src)
Fill in Url.
void url_free(struct Url **ptr)
Free the contents of a URL.