103 if ((*str ==
'\\') || (*str ==
'"'))
117 bool do_simple =
true;
121 if ((p[0] ==
'\\') && (p[1] !=
'\0'))
123 else if ((p[0] ==
'~') || (p[0] ==
'=') || (p[0] ==
'%'))
245 struct Progress *progress = NULL;
252 false, NULL, NULL, NULL) != 0) ||
262 bool match_all =
false;
263 struct PatternList *pat = NULL;
287 progress =
progress_new(
_(
"Executing command on matching messages..."),
312 mdata->
limit = simple;
318 menu->
max = vcounter;
349 struct Buffer *err = NULL;
351 struct Progress *progress = NULL;
358 false, NULL, NULL, NULL) != 0) ||
427 for (
int i = 0; i < m->
vcount; i++)
495 struct Progress *progress = NULL;
496 struct Buffer *buf = NULL;
499 if ((*
LastSearch ==
'\0') || ((op != OP_SEARCH_NEXT) && (op != OP_SEARCH_OPPOSITE)))
505 _(
"Reverse search for: "),
507 NULL, NULL, NULL) != 0) ||
513 if ((op == OP_SEARCH) || (op == OP_SEARCH_NEXT))
566 if (op == OP_SEARCH_OPPOSITE)
571 for (
int i = cur + incr, j = 0; j != m->
vcount; j++)
573 const char *msg = NULL;
580 msg =
_(
"Search wrapped to top");
591 msg =
_(
"Search wrapped to bottom");
655 struct Progress *progress = NULL;
657 const struct AliasViewArray *ava = &mdata->
ava;
658 struct Buffer *buf = NULL;
661 if ((*
LastSearch ==
'\0') || ((op != OP_SEARCH_NEXT) && (op != OP_SEARCH_OPPOSITE)))
667 _(
"Reverse search for: "),
669 NULL, NULL, NULL) != 0) ||
675 if ((op == OP_SEARCH) || (op == OP_SEARCH_NEXT))
726 if (op == OP_SEARCH_OPPOSITE)
731 for (
int i = cur + incr, j = 0; j !=
ARRAY_SIZE(ava); j++)
733 const char *msg = NULL;
740 msg =
_(
"Search wrapped to top");
751 msg =
_(
"Search wrapped to bottom");
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
#define ARRAY_SIZE(head)
The number of elements stored.
#define ARRAY_GET(head, idx)
Return the element at index.
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
struct Buffer * mutt_buffer_init(struct Buffer *buf)
Initialise a new Buffer.
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t mutt_buffer_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
char * mutt_buffer_strdup(const struct Buffer *buf)
Copy a Buffer's string.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
struct PatternList * mutt_pattern_comp(struct Mailbox *m, struct Menu *menu, const char *s, PatternCompFlags flags, struct Buffer *err)
Create a Pattern.
void mutt_pattern_free(struct PatternList **pat)
Free a Pattern.
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.
Convenience wrapper for the core headers.
Structs that make up an email.
int mutt_buffer_get_field(const char *field, struct Buffer *buf, CompletionFlags complete, bool multiple, struct Mailbox *m, char ***files, int *numfiles)
Ask the user for a string.
bool mutt_pattern_alias_exec(struct Pattern *pat, PatternExecFlags flags, struct AliasView *av, struct PatternCache *cache)
Match a pattern against an alias.
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.
void mutt_file_expand_fmt(struct Buffer *dest, const char *fmt, const char *src)
Replace s in a string with a filename.
bool OptSearchInvalid
(pseudo) used to invalidate the search pattern
SIG_ATOMIC_VOLATILE_T SigInt
true after SIGINT is received
bool OptSearchReverse
(pseudo) used by ci_search_command
#define mutt_message(...)
Shared code for the Alias and Query Dialogs.
bool imap_search(struct Mailbox *m, const struct PatternList *pat)
Find messages in mailbox matching a pattern.
@ MUTT_IMAP
'IMAP' Mailbox type
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
Convenience wrapper for the library headers.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
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_PATTERN
Pattern mode (in pattern dialog)
@ MUTT_UNDELETE
Messages to be un-deleted.
@ MUTT_LIMIT
Messages in limited view.
@ MUTT_UNTAG
Messages to be un-tagged.
@ MUTT_PURGE
Messages to be purged (bypass trash)
@ MUTT_TAG
Tagged messages.
@ MUTT_DELETE
Messages to be deleted.
#define MUTT_COMP_CLEAR
Clear input if printable character is pressed.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
The "currently-open" mailbox.
int mx_msg_padding_size(struct Mailbox *m)
Bytes of padding between messages - Wrapper for MxOps::msg_padding_size()
All user-callable functions.
uint8_t PatternCompFlags
Flags for mutt_pattern_comp(), e.g. MUTT_PC_FULL_MSG.
#define MUTT_PC_FULL_MSG
Enable body and header matching.
#define MUTT_MATCH_FULL_ADDRESS
Match the full address.
#define MUTT_ALIAS_SIMPLESEARCH
@ RANGE_K_REL
Relative range.
@ RANGE_K_ABS
Absolute range.
@ RANGE_K_LT
Less-than range.
@ RANGE_K_BARE
Single symbol.
@ RANGE_K_GT
Greater-than range.
static struct PatternList * SearchPattern
current search pattern
int mutt_search_alias_command(struct Menu *menu, int cur, int op)
Perform a search.
bool(* eat_arg_t)(struct Pattern *pat, PatternCompFlags flags, struct Buffer *s, struct Buffer *err)
static char LastSearchExpn[1024]
expanded version of LastSearch
static void quote_simple(const char *str, struct Buffer *buf)
Apply simple quoting to a string.
static char LastSearch[256]
last pattern searched for
bool mutt_limit_current_thread(struct MailboxView *mv, struct Email *e)
Limit the email view to the current thread.
struct RangeRegex RangeRegexes[]
Set of Regexes for various range types.
static struct MuttThread * top_of_thread(struct Email *e)
Find the first email in the current thread.
int mutt_pattern_alias_func(char *prompt, struct AliasMenuData *mdata, struct Menu *menu)
Perform some Pattern matching for Alias.
void mutt_check_simple(struct Buffer *buf, const char *simple)
Convert a simple search into a real request.
int mutt_pattern_func(struct MailboxView *mv, int op, char *prompt)
Perform some Pattern matching.
int mutt_search_command(struct Mailbox *m, struct Menu *menu, int cur, int op)
Perform a search.
static unsigned char * pbuf
Cached PGP data packet.
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
@ MUTT_PROGRESS_READ
Progress tracks elements, according to $read_inc
void progress_free(struct Progress **ptr)
Free a Progress Bar.
bool progress_update(struct Progress *progress, size_t pos, int percent)
Update the state of the progress bar.
struct Progress * progress_new(const char *msg, enum ProgressType type, size_t size)
Create a new Progress Bar.
Prototypes for many functions.
#define mutt_set_flag(m, e, flag, bf)
#define SLIST_FIRST(head)
GUI data wrapping an Alias.
bool is_visible
Is visible?
bool is_matched
Search matches this Alias.
bool is_searched
Alias has been searched.
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.
String manipulation buffer.
size_t dsize
Length of data.
char * data
Pointer to data.
The envelope/body of an email.
bool searched
Email has been searched.
bool matched
Search matches this Email.
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.
size_t num_hidden
Number of hidden messages in this view (only valid when collapsed is set)
int vnum
Virtual message number.
struct MuttThread * thread
Thread of Emails.
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 Mailbox * mailbox
Current Mailbox.
char * pattern
Limit pattern string.
int vcount
The number of virtual messages.
int * v2r
Mapping from virtual to real msgno.
int msg_count
Total number of messages.
enum MailboxType type
Mailbox type.
struct Email ** emails
Array of Emails.
struct MuttThread * parent
Parent of this Thread.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
A simple (non-regex) pattern.
Regular expression representing a range.