NeoMutt  2024-12-12-19-ge4b57e
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
flags.c
Go to the documentation of this file.
1
30#include "config.h"
31#include <stddef.h>
32#include "private.h"
33#include "mutt/lib.h"
34#include "mutt.h"
35#include "lib.h"
36
40const struct PatternFlags Flags[] = {
41 // clang-format off
42 { 'A', MUTT_ALL, 0, EAT_NONE,
43 // L10N: Pattern Completion Menu description for ~A
44 N_("all messages") },
46 // L10N: Pattern Completion Menu description for ~b
47 N_("messages whose body matches EXPR") },
49 // L10N: Pattern Completion Menu description for ~B
50 N_("messages whose body or headers match EXPR") },
51 { 'c', MUTT_PAT_CC, 0, EAT_REGEX,
52 // L10N: Pattern Completion Menu description for ~c
53 N_("messages whose CC header matches EXPR") },
55 // L10N: Pattern Completion Menu description for ~C
56 N_("messages whose recipient matches EXPR") },
57 { 'd', MUTT_PAT_DATE, 0, EAT_DATE,
58 // L10N: Pattern Completion Menu description for ~d
59 N_("messages sent in DATERANGE") },
60 { 'D', MUTT_DELETED, 0, EAT_NONE,
61 // L10N: Pattern Completion Menu description for ~D
62 N_("deleted messages") },
63 { 'e', MUTT_PAT_SENDER, 0, EAT_REGEX,
64 // L10N: Pattern Completion Menu description for ~e
65 N_("messages whose Sender header matches EXPR") },
66 { 'E', MUTT_EXPIRED, 0, EAT_NONE,
67 // L10N: Pattern Completion Menu description for ~E
68 N_("expired messages") },
69 { 'f', MUTT_PAT_FROM, 0, EAT_REGEX,
70 // L10N: Pattern Completion Menu description for ~f
71 N_("messages whose From header matches EXPR") },
72 { 'F', MUTT_FLAG, 0, EAT_NONE,
73 // L10N: Pattern Completion Menu description for ~F
74 N_("flagged messages") },
76 // L10N: Pattern Completion Menu description for ~g
77 N_("cryptographically signed messages") },
79 // L10N: Pattern Completion Menu description for ~G
80 N_("cryptographically encrypted messages") },
82 // L10N: Pattern Completion Menu description for ~h
83 N_("messages whose header matches EXPR") },
84 { 'H', MUTT_PAT_HORMEL, 0, EAT_REGEX,
85 // L10N: Pattern Completion Menu description for ~H
86 N_("messages whose spam tag matches EXPR") },
87 { 'i', MUTT_PAT_ID, 0, EAT_REGEX,
88 // L10N: Pattern Completion Menu description for ~i
89 N_("messages whose Message-ID matches EXPR") },
91 // L10N: Pattern Completion Menu description for ~I
92 N_("messages whose Message-ID is included in the results returned from an external search program") },
93 { 'k', MUTT_PAT_PGP_KEY, 0, EAT_NONE,
94 // L10N: Pattern Completion Menu description for ~k
95 N_("messages which contain PGP key") },
96 { 'K', MUTT_PAT_BCC, 0, EAT_REGEX,
97 // L10N: Pattern Completion Menu description for ~K
98 N_("messages whose BCC header matches EXPR") },
99 { 'l', MUTT_PAT_LIST, 0, EAT_NONE,
100 // L10N: Pattern Completion Menu description for ~l
101 N_("messages addressed to known mailing lists") },
102 { 'L', MUTT_PAT_ADDRESS, 0, EAT_REGEX,
103 // L10N: Pattern Completion Menu description for ~L
104 N_("messages whose From/Sender/To/CC matches EXPR") },
106 // L10N: Pattern Completion Menu description for ~m
107 N_("messages whose number is in RANGE") },
109 // L10N: Pattern Completion Menu description for ~M
110 N_("messages with a Content-Type matching EXPR") },
111 { 'n', MUTT_PAT_SCORE, 0, EAT_RANGE,
112 // L10N: Pattern Completion Menu description for ~n
113 N_("messages whose score is in RANGE") },
114 { 'N', MUTT_NEW, 0, EAT_NONE,
115 // L10N: Pattern Completion Menu description for ~N
116 N_("new messages") },
117 { 'O', MUTT_OLD, 0, EAT_NONE,
118 // L10N: Pattern Completion Menu description for ~O
119 N_("old messages") },
121 // L10N: Pattern Completion Menu description for ~p
122 N_("messages addressed to you") },
124 // L10N: Pattern Completion Menu description for ~P
125 N_("messages from you") },
126 { 'Q', MUTT_REPLIED, 0, EAT_NONE,
127 // L10N: Pattern Completion Menu description for ~Q
128 N_("messages which have been replied to") },
130 // L10N: Pattern Completion Menu description for ~r
131 N_("messages received in DATERANGE") },
132 { 'R', MUTT_READ, 0, EAT_NONE,
133 // L10N: Pattern Completion Menu description for ~R
134 N_("already read messages") },
135 { 's', MUTT_PAT_SUBJECT, 0, EAT_REGEX,
136 // L10N: Pattern Completion Menu description for ~s
137 N_("messages whose Subject header matches EXPR") },
138 { 'S', MUTT_SUPERSEDED, 0, EAT_NONE,
139 // L10N: Pattern Completion Menu description for ~S
140 N_("superseded messages") },
141 { 't', MUTT_PAT_TO, 0, EAT_REGEX,
142 // L10N: Pattern Completion Menu description for ~t
143 N_("messages whose To header matches EXPR") },
144 { 'T', MUTT_TAG, 0, EAT_NONE,
145 // L10N: Pattern Completion Menu description for ~T
146 N_("tagged messages") },
148 // L10N: Pattern Completion Menu description for ~u
149 N_("messages addressed to subscribed mailing lists") },
150 { 'U', MUTT_UNREAD, 0, EAT_NONE,
151 // L10N: Pattern Completion Menu description for ~U
152 N_("unread messages") },
153 { 'v', MUTT_PAT_COLLAPSED, 0, EAT_NONE,
154 // L10N: Pattern Completion Menu description for ~v
155 N_("messages in collapsed threads") },
157 // L10N: Pattern Completion Menu description for ~V
158 N_("cryptographically verified messages") },
160 // L10N: Pattern Completion Menu description for ~w
161 N_("newsgroups matching EXPR") },
162 { 'x', MUTT_PAT_REFERENCE, 0, EAT_REGEX,
163 // L10N: Pattern Completion Menu description for ~x
164 N_("messages whose References header matches EXPR") },
166 // L10N: Pattern Completion Menu description for ~X
167 N_("messages with RANGE attachments") },
168 { 'y', MUTT_PAT_XLABEL, 0, EAT_REGEX,
169 // L10N: Pattern Completion Menu description for ~y
170 N_("messages whose X-Label header matches EXPR") },
172 // L10N: Pattern Completion Menu description for ~Y
173 N_("messages whose tags match EXPR") },
174 { 'z', MUTT_PAT_SIZE, 0, EAT_RANGE,
175 // L10N: Pattern Completion Menu description for ~z
176 N_("messages whose size is in RANGE") },
177 { '=', MUTT_PAT_DUPLICATED, 0, EAT_NONE,
178 // L10N: Pattern Completion Menu description for ~=
179 N_("duplicated messages") },
181 // L10N: Pattern Completion Menu description for ~$
182 N_("unreferenced messages") },
183 { '#', MUTT_PAT_BROKEN, 0, EAT_NONE,
184 // L10N: Pattern Completion Menu description for ~#
185 N_("broken threads") },
187 // L10N: Pattern Completion Menu description for =/
188 N_("IMAP custom server-side search for STRING") },
189 { 0, 0, 0, EAT_NONE, NULL, },
190 // clang-format on
191};
192
198const struct PatternFlags *lookup_tag(char tag)
199{
200 for (int i = 0; Flags[i].tag; i++)
201 if (Flags[i].tag == tag)
202 return &Flags[i];
203 return NULL;
204}
205
211const struct PatternFlags *lookup_op(int op)
212{
213 for (int i = 0; Flags[i].tag; i++)
214 if (Flags[i].op == op)
215 return (&Flags[i]);
216 return NULL;
217}
Convenience wrapper for the library headers.
#define N_(a)
Definition: message.h:32
Many unsorted constants and some structs.
@ MUTT_ALL
All messages.
Definition: mutt.h:68
@ MUTT_SUPERSEDED
Superseded messages.
Definition: mutt.h:84
@ MUTT_EXPIRED
Expired messages.
Definition: mutt.h:83
@ MUTT_READ
Messages that have been read.
Definition: mutt.h:73
@ MUTT_OLD
Old messages.
Definition: mutt.h:71
@ MUTT_TAG
Tagged messages.
Definition: mutt.h:80
@ MUTT_FLAG
Flagged messages.
Definition: mutt.h:79
@ MUTT_DELETED
Deleted messages.
Definition: mutt.h:78
@ MUTT_NEW
New messages.
Definition: mutt.h:70
@ MUTT_UNREAD
Unread messages.
Definition: mutt.h:74
@ MUTT_REPLIED
Messages that have been replied to.
Definition: mutt.h:72
const struct PatternFlags Flags[]
Lookup table for all patterns.
Definition: flags.c:40
const struct PatternFlags * lookup_tag(char tag)
Lookup a pattern modifier.
Definition: flags.c:198
const struct PatternFlags * lookup_op(int op)
Lookup the Pattern Flags for an op.
Definition: flags.c:211
#define MUTT_PC_SEND_MODE_SEARCH
Allow send-mode body searching.
Definition: lib.h:71
#define MUTT_PC_FULL_MSG
Enable body and header matching.
Definition: lib.h:69
@ MUTT_PAT_HEADER
Pattern matches email's header.
Definition: lib.h:156
@ MUTT_PAT_WHOLE_MSG
Pattern matches raw email text.
Definition: lib.h:158
@ MUTT_PAT_BROKEN
Message is part of a broken thread.
Definition: lib.h:152
@ MUTT_PAT_ID_EXTERNAL
Message-Id is among results from an external query.
Definition: lib.h:154
@ MUTT_PAT_REFERENCE
Pattern matches 'References:' or 'In-Reply-To:' field.
Definition: lib.h:163
@ MUTT_PAT_FROM
Pattern matches 'From:' field.
Definition: lib.h:147
@ MUTT_PAT_DRIVER_TAGS
Pattern matches message tags.
Definition: lib.h:176
@ MUTT_PAT_COLLAPSED
Thread is collapsed.
Definition: lib.h:145
@ MUTT_PAT_CRYPT_VERIFIED
Message is crypographically verified.
Definition: lib.h:171
@ MUTT_PAT_HORMEL
Pattern matches email's spam score.
Definition: lib.h:157
@ MUTT_PAT_SUBJECT
Pattern matches 'Subject:' field.
Definition: lib.h:146
@ MUTT_PAT_LIST
Email is on mailing list.
Definition: lib.h:165
@ MUTT_PAT_NEWSGROUPS
Pattern matches newsgroup.
Definition: lib.h:179
@ MUTT_PAT_PERSONAL_RECIP
Email is addressed to the user.
Definition: lib.h:167
@ MUTT_PAT_CC
Pattern matches 'Cc:' field.
Definition: lib.h:143
@ MUTT_PAT_SUBSCRIBED_LIST
Email is on subscribed mailing list.
Definition: lib.h:166
@ MUTT_PAT_SERVERSEARCH
Server-side pattern matches.
Definition: lib.h:175
@ MUTT_PAT_RECIPIENT
User is a recipient of the email.
Definition: lib.h:164
@ MUTT_PAT_CRYPT_ENCRYPT
Message is encrypted.
Definition: lib.h:172
@ MUTT_PAT_UNREFERENCED
Message is unreferenced in the thread.
Definition: lib.h:151
@ MUTT_PAT_CRYPT_SIGN
Message is signed.
Definition: lib.h:170
@ MUTT_PAT_MESSAGE
Pattern matches message number.
Definition: lib.h:160
@ MUTT_PAT_DATE
Pattern matches 'Date:' field.
Definition: lib.h:148
@ MUTT_PAT_XLABEL
Pattern matches keyword/label.
Definition: lib.h:174
@ MUTT_PAT_SCORE
Pattern matches email's score.
Definition: lib.h:161
@ MUTT_PAT_MIMEATTACH
Pattern matches number of attachments.
Definition: lib.h:177
@ MUTT_PAT_DUPLICATED
Duplicate message.
Definition: lib.h:150
@ MUTT_PAT_PERSONAL_FROM
Email is from the user.
Definition: lib.h:168
@ MUTT_PAT_TO
Pattern matches 'To:' field.
Definition: lib.h:142
@ MUTT_PAT_BCC
Pattern matches 'Bcc:' field.
Definition: lib.h:144
@ MUTT_PAT_SENDER
Pattern matches sender.
Definition: lib.h:159
@ MUTT_PAT_DATE_RECEIVED
Pattern matches date received.
Definition: lib.h:149
@ MUTT_PAT_ADDRESS
Pattern matches any address field.
Definition: lib.h:169
@ MUTT_PAT_MIMETYPE
Pattern matches MIME type.
Definition: lib.h:178
@ MUTT_PAT_PGP_KEY
Message has PGP key.
Definition: lib.h:173
@ MUTT_PAT_ID
Pattern matches email's Message-Id.
Definition: lib.h:153
@ MUTT_PAT_SIZE
Pattern matches email's size.
Definition: lib.h:162
@ MUTT_PAT_BODY
Pattern matches email's body.
Definition: lib.h:155
@ EAT_NONE
No arguments required.
Definition: private.h:52
@ EAT_RANGE
Process a number (range)
Definition: private.h:55
@ EAT_MESSAGE_RANGE
Process a message number (range)
Definition: private.h:56
@ EAT_DATE
Process a date (range)
Definition: private.h:54
@ EAT_QUERY
Process a query string.
Definition: private.h:57
@ EAT_REGEX
Process a regex.
Definition: private.h:53
GUI display the mailboxes in a side panel.
Key value store.
Mapping between user character and internal constant.
Definition: private.h:64
char tag
Character used to represent this operation, e.g. 'A' for '~A'.
Definition: private.h:65
int op
Operation to perform, e.g. MUTT_PAT_SCORE.
Definition: private.h:66