Match a pattern against an email header.
flags: MUTT_MATCH_FULL_ADDRESS: match both personal and machine address cache: For repeated matches against the same Header, passing in non-NULL will store some of the cacheable pattern matches in this structure.
846{
847
848
849
851 {
880 return pat->
pat_not ? (!e->
old || e->
read) : (e->old && !e->read);
900 {
901 if (!e->body || !e->body->filename)
902 return false;
903 return pat->pat_not ^ msg_search_sendmode(e, pat);
904 }
905
906
907
908 if (!m)
909 return false;
910
915 if (!m)
916 return false;
918 {
919 return (pat->string_match) ? e->matched : false;
920 }
921 mutt_error(
_(
"error: server custom search only supported with IMAP"));
922 return false;
925 return false;
930 return false;
935 return false;
940 return false;
945 return false;
950 return false;
955 return false;
965 return false;
970 return false;
976 return false;
980 {
981 if (!e->env)
982 return false;
983
984
985 bool result;
986 if (cache)
987 {
988 int *cache_entry = pat->all_addr ? &cache->list_all : &cache->list_one;
989 if (!is_pattern_cache_set(*cache_entry))
990 {
991 set_pattern_cache_value(cache_entry,
992 mutt_is_list_recipient(pat->all_addr, e->env));
993 }
994 result = get_pattern_cache_value(*cache_entry);
995 }
996 else
997 {
998 result = mutt_is_list_recipient(pat->all_addr, e->env);
999 }
1001 }
1003 {
1005 return false;
1006
1007 bool result;
1008 if (cache)
1009 {
1012 {
1015 }
1017 }
1018 else
1019 {
1021 }
1023 }
1025 {
1027 return false;
1028
1029 bool result;
1030 if (cache)
1031 {
1034 {
1038 }
1040 }
1041 else
1042 {
1044 }
1046 }
1048 {
1050 return false;
1051
1052 bool result;
1053 if (cache)
1054 {
1057 {
1060 }
1062 }
1063 else
1064 {
1066 }
1068 }
1072
1074 {
1076 return false;
1077 }
1081 {
1083 return false;
1084 }
1088 {
1090 return false;
1091 }
1095 {
1097 return false;
1098 }
1102 return false;
1105 {
1107 }
1110 return false;
1115 {
1119 }
1121 if (!m || !msg)
1122 return false;
1130 return false;
1132 }
1133 mutt_error(
_(
"error: unknown op %d (report this error)"), pat->
op);
1134 return false;
1135}
int mutt_count_body_parts(struct Email *e, FILE *fp)
Count the MIME Body parts.
@ MUTT_IMAP
'IMAP' Mailbox type
@ 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.
#define SEC_GOODSIGN
Email has a valid signature.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
#define SEC_ENCRYPT
Email is encrypted.
#define PGP_KEY
Email contains a PGP key.
#define SEC_SIGN
Email is signed.
static bool msg_search(struct Pattern *pat, struct Email *e, struct Message *msg)
Search an email.
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.
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_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 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 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.
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 void set_pattern_cache_value(int *cache_entry, int value)
Sets a value in the PatternCache cache entry.
@ 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.
static int email_msgno(struct Email *e)
Helper to get the Email's message number.
LOFF_T length
length (in bytes) of attachment
char * data
Pointer to data.
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)
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.
FILE * fp
pointer to the message data
bool fake_thread
Emails grouped by Subject.
struct MuttThread * child
Child of this Thread.
bool duplicate_thread
Duplicated Email in Thread.
bool all_addr
All Addresses in the list must match.
struct PatternList * child
Arguments to logical operation.
long min
Minimum for range checks.
bool string_match
Check a string for a match.
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 pat_not
Pattern should be inverted (not)