NeoMutt  2022-04-29-249-gaae397
Teaching an old dog new tricks
DOXYGEN
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 { 'l', MUTT_PAT_LIST, 0, EAT_NONE,
97 // L10N: Pattern Completion Menu description for ~l
98 N_("messages addressed to known mailing lists") },
99 { 'L', MUTT_PAT_ADDRESS, 0, EAT_REGEX,
100 // L10N: Pattern Completion Menu description for ~L
101 N_("messages whose From/Sender/To/CC matches EXPR") },
103 // L10N: Pattern Completion Menu description for ~m
104 N_("messages whose number is in RANGE") },
106 // L10N: Pattern Completion Menu description for ~M
107 N_("messages with a Content-Type matching EXPR") },
108 { 'n', MUTT_PAT_SCORE, 0, EAT_RANGE,
109 // L10N: Pattern Completion Menu description for ~n
110 N_("messages whose score is in RANGE") },
111 { 'N', MUTT_NEW, 0, EAT_NONE,
112 // L10N: Pattern Completion Menu description for ~N
113 N_("new messages") },
114 { 'O', MUTT_OLD, 0, EAT_NONE,
115 // L10N: Pattern Completion Menu description for ~O
116 N_("old messages") },
118 // L10N: Pattern Completion Menu description for ~p
119 N_("messages addressed to you") },
121 // L10N: Pattern Completion Menu description for ~P
122 N_("messages from you") },
123 { 'Q', MUTT_REPLIED, 0, EAT_NONE,
124 // L10N: Pattern Completion Menu description for ~Q
125 N_("messages which have been replied to") },
127 // L10N: Pattern Completion Menu description for ~r
128 N_("messages received in DATERANGE") },
129 { 'R', MUTT_READ, 0, EAT_NONE,
130 // L10N: Pattern Completion Menu description for ~R
131 N_("already read messages") },
132 { 's', MUTT_PAT_SUBJECT, 0, EAT_REGEX,
133 // L10N: Pattern Completion Menu description for ~s
134 N_("messages whose Subject header matches EXPR") },
135 { 'S', MUTT_SUPERSEDED, 0, EAT_NONE,
136 // L10N: Pattern Completion Menu description for ~S
137 N_("superseded messages") },
138 { 't', MUTT_PAT_TO, 0, EAT_REGEX,
139 // L10N: Pattern Completion Menu description for ~t
140 N_("messages whose To header matches EXPR") },
141 { 'T', MUTT_TAG, 0, EAT_NONE,
142 // L10N: Pattern Completion Menu description for ~T
143 N_("tagged messages") },
145 // L10N: Pattern Completion Menu description for ~u
146 N_("messages addressed to subscribed mailing lists") },
147 { 'U', MUTT_UNREAD, 0, EAT_NONE,
148 // L10N: Pattern Completion Menu description for ~U
149 N_("unread messages") },
150 { 'v', MUTT_PAT_COLLAPSED, 0, EAT_NONE,
151 // L10N: Pattern Completion Menu description for ~v
152 N_("messages in collapsed threads") },
154 // L10N: Pattern Completion Menu description for ~V
155 N_("cryptographically verified messages") },
156#ifdef USE_NNTP
158 // L10N: Pattern Completion Menu description for ~w
159 N_("newsgroups matching EXPR") },
160#endif
161 { 'x', MUTT_PAT_REFERENCE, 0, EAT_REGEX,
162 // L10N: Pattern Completion Menu description for ~x
163 N_("messages whose References header matches EXPR") },
165 // L10N: Pattern Completion Menu description for ~X
166 N_("messages with RANGE attachments") },
167 { 'y', MUTT_PAT_XLABEL, 0, EAT_REGEX,
168 // L10N: Pattern Completion Menu description for ~y
169 N_("messages whose X-Label header matches EXPR") },
171 // L10N: Pattern Completion Menu description for ~Y
172 N_("messages whose tags match EXPR") },
173 { 'z', MUTT_PAT_SIZE, 0, EAT_RANGE,
174 // L10N: Pattern Completion Menu description for ~z
175 N_("messages whose size is in RANGE") },
176 { '=', MUTT_PAT_DUPLICATED, 0, EAT_NONE,
177 // L10N: Pattern Completion Menu description for ~=
178 N_("duplicated messages") },
180 // L10N: Pattern Completion Menu description for ~$
181 N_("unreferenced messages") },
182 { '#', MUTT_PAT_BROKEN, 0, EAT_NONE,
183 // L10N: Pattern Completion Menu description for ~#
184 N_("broken threads") },
186 // L10N: Pattern Completion Menu description for =/
187 N_("IMAP custom server-side search for STRING") },
188 { 0, 0, 0, EAT_NONE, NULL, },
189 // clang-format on
190};
191
197const struct PatternFlags *lookup_tag(char tag)
198{
199 for (int i = 0; Flags[i].tag; i++)
200 if (Flags[i].tag == tag)
201 return &Flags[i];
202 return NULL;
203}
204
210const struct PatternFlags *lookup_op(int op)
211{
212 for (int i = 0; Flags[i].tag; i++)
213 if (Flags[i].op == op)
214 return (&Flags[i]);
215 return NULL;
216}
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:88
@ MUTT_SUPERSEDED
Superseded messages.
Definition: mutt.h:104
@ MUTT_EXPIRED
Expired messages.
Definition: mutt.h:103
@ MUTT_READ
Messages that have been read.
Definition: mutt.h:93
@ MUTT_OLD
Old messages.
Definition: mutt.h:91
@ MUTT_TAG
Tagged messages.
Definition: mutt.h:100
@ MUTT_FLAG
Flagged messages.
Definition: mutt.h:99
@ MUTT_DELETED
Deleted messages.
Definition: mutt.h:98
@ MUTT_NEW
New messages.
Definition: mutt.h:90
@ MUTT_UNREAD
Unread messages.
Definition: mutt.h:94
@ MUTT_REPLIED
Messages that have been replied to.
Definition: mutt.h:92
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:197
const struct PatternFlags * lookup_op(int op)
Lookup the Pattern Flags for an op.
Definition: flags.c:210
#define MUTT_PC_SEND_MODE_SEARCH
Allow send-mode body searching.
Definition: lib.h:64
#define MUTT_PC_FULL_MSG
Enable body and header matching.
Definition: lib.h:62
@ MUTT_PAT_HEADER
Pattern matches email's header.
Definition: lib.h:148
@ MUTT_PAT_WHOLE_MSG
Pattern matches raw email text.
Definition: lib.h:150
@ MUTT_PAT_BROKEN
Message is part of a broken thread.
Definition: lib.h:144
@ MUTT_PAT_ID_EXTERNAL
Message-Id is among results from an external query.
Definition: lib.h:146
@ MUTT_PAT_REFERENCE
Pattern matches 'References:' or 'In-Reply-To:' field.
Definition: lib.h:155
@ MUTT_PAT_FROM
Pattern matches 'From:' field.
Definition: lib.h:139
@ MUTT_PAT_DRIVER_TAGS
Pattern matches message tags.
Definition: lib.h:168
@ MUTT_PAT_COLLAPSED
Thread is collapsed.
Definition: lib.h:137
@ MUTT_PAT_CRYPT_VERIFIED
Message is crypographically verified.
Definition: lib.h:163
@ MUTT_PAT_HORMEL
Pattern matches email's spam score.
Definition: lib.h:149
@ MUTT_PAT_SUBJECT
Pattern matches 'Subject:' field.
Definition: lib.h:138
@ MUTT_PAT_LIST
Email is on mailing list.
Definition: lib.h:157
@ MUTT_PAT_NEWSGROUPS
Pattern matches newsgroup.
Definition: lib.h:172
@ MUTT_PAT_PERSONAL_RECIP
Email is addressed to the user.
Definition: lib.h:159
@ MUTT_PAT_CC
Pattern matches 'Cc:' field.
Definition: lib.h:136
@ MUTT_PAT_SUBSCRIBED_LIST
Email is on subscribed mailing list.
Definition: lib.h:158
@ MUTT_PAT_SERVERSEARCH
Server-side pattern matches.
Definition: lib.h:167
@ MUTT_PAT_RECIPIENT
User is a recipient of the email.
Definition: lib.h:156
@ MUTT_PAT_CRYPT_ENCRYPT
Message is encrypted.
Definition: lib.h:164
@ MUTT_PAT_UNREFERENCED
Message is unreferenced in the thread.
Definition: lib.h:143
@ MUTT_PAT_CRYPT_SIGN
Message is signed.
Definition: lib.h:162
@ MUTT_PAT_MESSAGE
Pattern matches message number.
Definition: lib.h:152
@ MUTT_PAT_DATE
Pattern matches 'Date:' field.
Definition: lib.h:140
@ MUTT_PAT_XLABEL
Pattern matches keyword/label.
Definition: lib.h:166
@ MUTT_PAT_SCORE
Pattern matches email's score.
Definition: lib.h:153
@ MUTT_PAT_MIMEATTACH
Pattern matches number of attachments.
Definition: lib.h:169
@ MUTT_PAT_DUPLICATED
Duplicate message.
Definition: lib.h:142
@ MUTT_PAT_PERSONAL_FROM
Email is from the user.
Definition: lib.h:160
@ MUTT_PAT_TO
Pattern matches 'To:' field.
Definition: lib.h:135
@ MUTT_PAT_SENDER
Pattern matches sender.
Definition: lib.h:151
@ MUTT_PAT_DATE_RECEIVED
Pattern matches date received.
Definition: lib.h:141
@ MUTT_PAT_ADDRESS
Pattern matches any address field.
Definition: lib.h:161
@ MUTT_PAT_MIMETYPE
Pattern matches MIME type.
Definition: lib.h:170
@ MUTT_PAT_PGP_KEY
Message has PGP key.
Definition: lib.h:165
@ MUTT_PAT_ID
Pattern matches email's Message-Id.
Definition: lib.h:145
@ MUTT_PAT_SIZE
Pattern matches email's size.
Definition: lib.h:154
@ MUTT_PAT_BODY
Pattern matches email's body.
Definition: lib.h:147
@ EAT_NONE
No arguments required.
Definition: private.h:48
@ EAT_RANGE
Process a number (range)
Definition: private.h:51
@ EAT_MESSAGE_RANGE
Process a message number (range)
Definition: private.h:52
@ EAT_DATE
Process a date (range)
Definition: private.h:50
@ EAT_QUERY
Process a query string.
Definition: private.h:53
@ EAT_REGEX
Process a regex.
Definition: private.h:49
GUI display the mailboxes in a side panel.
Key value store.
Mapping between user character and internal constant.
Definition: private.h:60
int tag
Character used to represent this operation, e.g. 'A' for '~A'.
Definition: private.h:61
int op
Operation to perform, e.g. MUTT_PAT_SCORE.
Definition: private.h:62