80 return (regexec(pat->
p.
regex, buf, 0, NULL, 0) == 0);
101 mutt_error(
_(
"error: unknown op %d (report this error)"),
op);
125 struct stat st = { 0 };
131 if (c_thorough_search)
134 struct State state = { 0 };
138 state.
fp_out = open_memstream(&temp, &tempsize);
191 fp = fmemopen(temp, tempsize,
"r");
214 mutt_perror(
_(
"Error checking length of temporary file"));
218 len = (long) st.st_size;
267 char buf[1024] = { 0 };
270 if (!fgets(buf,
sizeof(buf), fp))
283 if (c_thorough_search)
399 struct Tag *tag = NULL;
400 bool matched =
false;
425 struct AddressList *al = va_arg(ap,
struct AddressList *);
473 struct AddressList *als[] = { &env->
to, &env->
cc };
476 struct AddressList *al = als[i];
529 struct AddressList *al = va_arg(ap,
struct AddressList *);
559 int left,
int up,
int right,
int down)
639 char buf[256] = { 0 };
640 snprintf(buf,
sizeof(buf),
"%s/%s",
TYPE(b), b->
subtype);
690 *cache_entry = (value != 0) ? 2 : 1;
701 return cache_entry == 2;
711 return cache_entry != 0;
919 mutt_error(
_(
"error: server custom search only supported with IMAP"));
1129 mutt_error(
_(
"error: unknown op %d (report this error)"), pat->
op);
1152 if (needs_msg && !msg)
bool(* addr_predicate_t)(const struct Address *a)
struct Address * alias_reverse_lookup(const struct Address *addr)
Does the user have an alias for the given address.
bool mutt_addr_is_user(const struct Address *addr)
Does the address belong to the user.
Representation of a single alias to an email address.
GUI display the mailboxes in a side panel.
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
int mutt_count_body_parts(struct Email *e, FILE *fp)
Count the MIME Body parts.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
bool eval_date_minmax(struct Pattern *pat, const char *s, struct Buffer *err)
Evaluate a date-range pattern against 'now'.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
int mutt_copy_header(FILE *fp_in, struct Email *e, FILE *fp_out, CopyHeaderFlags chflags, const char *prefix, int wraplen)
Copy Email header.
Duplicate the structure of an entire email.
#define CH_DECODE
Do RFC2047 header decoding.
#define CH_FROM
Retain the "From " message separator?
Convenience wrapper for the core headers.
@ MUTT_IMAP
'IMAP' Mailbox type
bool crypt_valid_passphrase(SecurityFlags flags)
Check that we have a usable passphrase, ask if not.
Structs that make up an email.
size_t mutt_rfc822_read_line(FILE *fp, struct Buffer *buf)
Read a header line from a file.
static bool msg_search(struct Pattern *pat, struct Email *e, struct Message *msg)
Search an email.
static bool pattern_needs_msg(const struct Mailbox *m, const struct Pattern *pat)
Check whether a pattern needs a full message.
static int match_user(bool all_addr, int n,...)
Matches the user's email Address.
static int match_threadcomplete(struct PatternList *pat, PatternExecFlags flags, struct Mailbox *m, struct MuttThread *t, int left, int up, int right, int down)
Match a Pattern against an email thread.
bool mutt_pattern_alias_exec(struct Pattern *pat, PatternExecFlags flags, struct AliasView *av, struct PatternCache *cache)
Match a pattern against an alias.
static void print_crypt_pattern_op_error(int op)
Print an error for a disabled crypto pattern.
static int match_threadparent(struct PatternList *pat, PatternExecFlags flags, struct Mailbox *m, struct MuttThread *t)
Match Pattern against an email's parent.
static bool match_content_type(const struct Pattern *pat, struct Body *b)
Match a Pattern against an Attachment's Content-Type.
static bool perform_alias_and(struct PatternList *pat, PatternExecFlags flags, struct AliasView *av, struct PatternCache *cache)
Perform a logical AND on a set of Patterns.
static bool match_mime_content_type(const struct Pattern *pat, struct Email *e, FILE *fp)
Match a Pattern against an email's Content-Type.
static int match_threadchildren(struct PatternList *pat, PatternExecFlags flags, struct Mailbox *m, struct MuttThread *t)
Match Pattern against an email's children.
static bool match_reference(struct Pattern *pat, struct ListHead *refs)
Match references against a Pattern.
static int match_addrlist(struct Pattern *pat, bool match_personal, int n,...)
match a pattern against an address list
static bool mutt_is_predicate_recipient(bool all_addr, struct Envelope *env, addr_predicate_t p)
Test an Envelopes Addresses using a predicate function.
static bool patmatch(const struct Pattern *pat, const char *buf)
Compare a string to a Pattern.
static int is_pattern_cache_set(int cache_entry)
Is a given Pattern cached?
static int perform_alias_or(struct PatternList *pat, PatternExecFlags flags, struct AliasView *av, struct PatternCache *cache)
Perform a logical OR on a set of Patterns.
static bool match_tags(struct Pattern *pat, struct TagList *tags)
match a pattern against a tags list
bool mutt_is_subscribed_list_recipient(bool all_addr, struct Envelope *env)
Matches subscribed mailing lists.
static int perform_or(struct PatternList *pat, PatternExecFlags flags, struct Mailbox *m, struct Email *e, struct Message *msg, struct PatternCache *cache)
Perform a logical OR on a set of Patterns.
bool mutt_is_list_recipient(bool all_addr, struct Envelope *env)
Matches known mailing lists.
static bool match_update_dynamic_date(struct Pattern *pat)
Update a dynamic date pattern.
static bool perform_and(struct PatternList *pat, PatternExecFlags flags, struct Mailbox *m, struct Email *e, struct Message *msg, struct PatternCache *cache)
Perform a logical AND on a set of Patterns.
static bool get_pattern_cache_value(int cache_entry)
Get pattern cache value.
static bool pattern_exec(struct Pattern *pat, PatternExecFlags flags, struct Mailbox *m, struct Email *e, struct Message *msg, struct PatternCache *cache)
Match a pattern against an email header.
static void set_pattern_cache_value(int *cache_entry, int value)
Sets a value in the PatternCache cache entry.
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.
static int msg_search_sendmode(struct Email *e, struct Pattern *pat)
Search in send-mode.
char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, ReadLineFlags flags)
Read a line from a file.
bool mutt_file_seek(FILE *fp, LOFF_T offset, int whence)
Wrapper for fseeko with error handling.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
#define MUTT_RL_NO_FLAGS
No flags are set.
bool mutt_group_match(struct Group *g, const char *s)
Does a string match an entry in a Group?
bool mutt_is_mail_list(const struct Address *addr)
Is this the email address of a mailing list? - Implements addr_predicate_t -.
bool mutt_is_subscribed_list(const struct Address *addr)
Is this the email address of a user-subscribed mailing list? - Implements addr_predicate_t -.
Shared code for the Alias and Query Dialogs.
int mutt_body_handler(struct Body *b, struct State *state)
Handler for the Body of an email.
Decide how to display email content.
struct ListNode * mutt_list_find(const struct ListHead *h, const char *data)
Find a string in a List.
#define mutt_array_size(x)
Convenience wrapper for the library headers.
#define STATE_CHARCONV
Do character set conversions.
const char * mutt_istr_find(const char *haystack, const char *needle)
Find first occurrence of string (ignoring case)
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Many unsorted constants and some structs.
@ MUTT_SUPERSEDED
Superseded messages.
@ MUTT_EXPIRED
Expired messages.
@ MUTT_READ
Messages that have been read.
@ MUTT_TAG
Tagged messages.
@ MUTT_FLAG
Flagged messages.
@ MUTT_DELETED
Deleted messages.
@ MUTT_UNREAD
Unread messages.
@ MUTT_REPLIED
Messages that have been replied to.
int mx_msg_close(struct Mailbox *m, struct Message **ptr)
Close a message.
struct Message * mx_msg_open(struct Mailbox *m, struct Email *e)
Return a stream pointer for a message.
API for encryption/signing of emails.
#define SEC_GOODSIGN
Email has a valid signature.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
#define SEC_ENCRYPT
Email is encrypted.
#define SEC_SIGN
Email is signed.
const struct PatternFlags * lookup_op(int op)
Lookup the Pattern Flags for an op.
@ MUTT_PAT_HEADER
Pattern matches email's header.
@ MUTT_PAT_WHOLE_MSG
Pattern matches raw email text.
@ MUTT_PAT_BROKEN
Message is part of a broken thread.
@ MUTT_PAT_ID_EXTERNAL
Message-Id is among results from an external query.
@ MUTT_PAT_OR
Either pattern can match.
@ MUTT_PAT_CHILDREN
Pattern matches a child email.
@ MUTT_PAT_PARENT
Pattern matches parent.
@ MUTT_PAT_REFERENCE
Pattern matches 'References:' or 'In-Reply-To:' field.
@ MUTT_PAT_FROM
Pattern matches 'From:' field.
@ MUTT_PAT_DRIVER_TAGS
Pattern matches message tags.
@ MUTT_PAT_COLLAPSED
Thread is collapsed.
@ MUTT_PAT_CRYPT_VERIFIED
Message is crypographically verified.
@ MUTT_PAT_HORMEL
Pattern matches email's spam score.
@ MUTT_PAT_SUBJECT
Pattern matches 'Subject:' field.
@ MUTT_PAT_LIST
Email is on mailing list.
@ MUTT_PAT_NEWSGROUPS
Pattern matches newsgroup.
@ MUTT_PAT_PERSONAL_RECIP
Email is addressed to the user.
@ MUTT_PAT_CC
Pattern matches 'Cc:' field.
@ MUTT_PAT_SUBSCRIBED_LIST
Email is on subscribed mailing list.
@ MUTT_PAT_SERVERSEARCH
Server-side pattern matches.
@ MUTT_PAT_RECIPIENT
User is a recipient of the email.
@ MUTT_PAT_CRYPT_ENCRYPT
Message is encrypted.
@ MUTT_PAT_UNREFERENCED
Message is unreferenced in the thread.
@ MUTT_PAT_CRYPT_SIGN
Message is signed.
@ MUTT_PAT_MESSAGE
Pattern matches message number.
@ MUTT_PAT_AND
Both patterns must match.
@ MUTT_PAT_DATE
Pattern matches 'Date:' field.
@ MUTT_PAT_XLABEL
Pattern matches keyword/label.
@ MUTT_PAT_SCORE
Pattern matches email's score.
@ MUTT_PAT_MIMEATTACH
Pattern matches number of attachments.
@ MUTT_PAT_DUPLICATED
Duplicate message.
@ MUTT_PAT_PERSONAL_FROM
Email is from the user.
@ MUTT_PAT_TO
Pattern matches 'To:' field.
@ MUTT_PAT_BCC
Pattern matches 'Bcc:' field.
@ MUTT_PAT_SENDER
Pattern matches sender.
@ MUTT_PAT_DATE_RECEIVED
Pattern matches date received.
@ MUTT_PAT_ADDRESS
Pattern matches any address field.
@ MUTT_PAT_MIMETYPE
Pattern matches MIME type.
@ MUTT_PAT_PGP_KEY
Message has PGP key.
@ MUTT_PAT_ID
Pattern matches email's Message-Id.
@ MUTT_PAT_THREAD
Pattern matches email thread.
@ MUTT_PAT_SIZE
Pattern matches email's size.
@ MUTT_PAT_BODY
Pattern matches email's body.
#define MUTT_MATCH_FULL_ADDRESS
Match the full address.
uint8_t PatternExecFlags
Flags for mutt_pattern_exec(), e.g. MUTT_MATCH_FULL_ADDRESS.
static int email_msgno(struct Email *e)
Helper to get the Email's message number.
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 SLIST_FOREACH(var, head, field)
#define TAILQ_FOREACH(var, head, field)
#define STAILQ_FOREACH(var, head, field)
#define SLIST_FIRST(head)
Convenience wrapper for the send headers.
struct Buffer * personal
Real name of address.
struct Buffer * mailbox
Mailbox and host address.
GUI data wrapping an Alias.
struct Alias * alias
Alias.
char * comment
Free-form comment string.
struct AddressList addr
List of Addresses the Alias expands to.
struct Body * parts
parts of a multipart or message/rfc822
LOFF_T offset
offset where the actual data begins
LOFF_T length
length (in bytes) of attachment
struct Body * next
next attachment in the list
char * subtype
content-type subtype
char * filename
When sending a message, this is the file to which this structure refers.
String manipulation buffer.
char * data
Pointer to data.
The envelope/body of an email.
bool matched
Search matches this Email.
struct Envelope * env
Envelope information.
bool collapsed
Is this message part of a collapsed thread?
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
struct Body * body
List of MIME parts.
bool old
Email is seen, but unread.
size_t num_hidden
Number of hidden messages in this view (only valid when collapsed is set)
LOFF_T offset
Where in the stream does this message begin?
bool flagged
Marked important?
time_t date_sent
Time when the message was sent (UTC)
bool replied
Email has been replied to.
bool expired
Already expired?
struct TagList tags
For drivers that support server tagging.
bool deleted
Email is deleted.
bool tagged
Email is tagged.
bool superseded
Got superseded?
time_t received
Time when the message was placed in the mailbox.
struct MuttThread * thread
Thread of Emails.
char *const subject
Email's subject.
struct AddressList to
Email's 'To' list.
char * message_id
Message ID.
char * newsgroups
List of newsgroups.
struct AddressList cc
Email's 'Cc' list.
struct AddressList sender
Email's sender.
struct ListHead references
message references (in reverse order)
struct Buffer spam
Spam header.
struct ListHead in_reply_to
in-reply-to header content
struct AddressList bcc
Email's 'Bcc' list.
struct AddressList from
Email's 'From' list.
enum MailboxType type
Mailbox type.
A local copy of an email.
FILE * fp
pointer to the message data
struct Message::@0 flags
Flags for the Message.
struct MuttThread * parent
Parent of this Thread.
struct MuttThread * prev
Previous sibling Thread.
bool fake_thread
Emails grouped by Subject.
struct MuttThread * child
Child of this Thread.
struct Email * message
Email this Thread refers to.
bool duplicate_thread
Duplicated Email in Thread.
struct MuttThread * next
Next sibling Thread.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
Cache commonly-used patterns.
Mapping between user character and internal constant.
char tag
Character used to represent this operation, e.g. 'A' for '~A'.
int op
Operation to perform, e.g. MUTT_PAT_SCORE.
A simple (non-regex) pattern.
bool group_match
Check a group of Addresses.
bool all_addr
All Addresses in the list must match.
struct Group * group
Address group if group_match is set.
struct PatternList * child
Arguments to logical operation.
long min
Minimum for range checks.
bool string_match
Check a string for a match.
regex_t * regex
Compiled regex, for non-pattern matching.
struct ListHead multi_cases
Multiple strings for ~I pattern.
char * str
String, if string_match is set.
bool is_alias
Is there an alias for this Address?
bool ign_case
Ignore case for local string_match searches.
long max
Maximum for range checks.
bool dynamic
Evaluate date ranges at run time.
short op
Operation, e.g. MUTT_PAT_SCORE.
bool sendmode
Evaluate searches in send-mode.
bool is_multi
Multiple case (only for ~I pattern now)
bool pat_not
Pattern should be inverted (not)
Keep track when processing files.
StateFlags flags
Flags, e.g. STATE_DISPLAY.
FILE * fp_out
File to write to.
FILE * fp_in
File to read from.
#define mutt_file_mkstemp()