NeoMutt  2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
commands.c File Reference

Handle the attachments command. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "commands.h"
#include "commands/lib.h"
#include "ncrypt/lib.h"
#include "parse/lib.h"
#include "module_data.h"
Include dependency graph for commands.c:

Go to the source code of this file.

Data Structures

struct  AttachMatch
 An attachment matching a regex for attachment counter. More...

Macros

#define MIME_DEPTH_MAX   50
 Maximum MIME nesting depth for counting body parts.

Functions

void attachmatch_free (void **ptr)
 Free an AttachMatch - Implements list_free_t -.
struct AttachMatchattachmatch_new (void)
 Create a new AttachMatch.
static bool count_body_parts_check (struct ListHead *checklist, struct Body *b, bool dflt)
 Compares mime types to the ok and except lists.
static int count_body_parts (struct Body *b, int depth)
 Count the MIME Body parts.
int mutt_count_body_parts (struct Email *e, FILE *fp)
 Count the MIME Body parts.
void mutt_attachments_reset (struct MailboxView *mv)
 Reset the attachment count for all Emails.
static enum CommandResult parse_attach_list (const struct Command *cmd, struct Buffer *line, struct ListHead *head, struct Buffer *err)
 Parse the "attachments" command.
static enum CommandResult parse_unattach_list (const struct Command *cmd, struct Buffer *line, struct ListHead *head, struct Buffer *err)
 Parse the "unattachments" command.
static int print_attach_list (struct ListHead *h, const char op, const char *name)
 Print a list of attachments.
enum CommandResult parse_attachments (const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
 Parse the 'attachments' command - Implements Command::parse() -.
enum CommandResult parse_unattachments (const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
 Parse the 'unattachments' command - Implements Command::parse() -.
void mutt_parse_mime_message (struct Email *e, FILE *fp)
 Parse a MIME email.
enum CommandResult parse_mime_lookup (const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
 Parse the 'mime-lookup' command - Implements Command::parse() -.
enum CommandResult parse_unmime_lookup (const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
 Parse the 'unmime-lookup' command - Implements Command::parse() -.

Variables

const struct Command AttachCommands []
 Attach Commands.

Detailed Description

Handle the attachments command.

Authors
  • Pietro Cerutti
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file commands.c.

Macro Definition Documentation

◆ MIME_DEPTH_MAX

#define MIME_DEPTH_MAX   50

Maximum MIME nesting depth for counting body parts.

Definition at line 122 of file commands.c.

Function Documentation

◆ attachmatch_new()

struct AttachMatch * attachmatch_new ( void )

Create a new AttachMatch.

Return values
ptrNew AttachMatch

Definition at line 79 of file commands.c.

80{
81 return MUTT_MEM_CALLOC(1, struct AttachMatch);
82}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
An attachment matching a regex for attachment counter.
Definition commands.c:49
Here is the caller graph for this function:

◆ count_body_parts_check()

bool count_body_parts_check ( struct ListHead * checklist,
struct Body * b,
bool dflt )
static

Compares mime types to the ok and except lists.

Parameters
checklistList of AttachMatch
bEmail Body
dfltLog whether the matches are OK, or Excluded
Return values
trueAttachment should be counted

Definition at line 91 of file commands.c.

92{
93 /* If list is null, use default behavior. */
94 if (!checklist || STAILQ_EMPTY(checklist))
95 {
96 return false;
97 }
98
99 struct AttachMatch *a = NULL;
100 struct ListNode *np = NULL;
101 STAILQ_FOREACH(np, checklist, entries)
102 {
103 a = (struct AttachMatch *) np->data;
104 mutt_debug(LL_DEBUG3, "%s %d/%s ?? %s/%s [%d]... ", dflt ? "[OK] " : "[EXCL] ",
105 b->type, b->subtype ? b->subtype : "*", a->major, a->minor, a->major_int);
106 if (((a->major_int == TYPE_ANY) || (a->major_int == b->type)) &&
107 (!b->subtype || (regexec(&a->minor_regex, b->subtype, 0, NULL, 0) == 0)))
108 {
109 mutt_debug(LL_DEBUG3, "yes\n");
110 return true;
111 }
112 else
113 {
114 mutt_debug(LL_DEBUG3, "no\n");
115 }
116 }
117
118 return false;
119}
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
@ LL_DEBUG3
Log at debug level 3.
Definition logging2.h:47
@ TYPE_ANY
Type: '' or '.'.
Definition mime.h:40
#define STAILQ_FOREACH(var, head, field)
Definition queue.h:390
#define STAILQ_EMPTY(head)
Definition queue.h:382
const char * minor
Minor mime type, e.g. "html".
Definition commands.c:52
regex_t minor_regex
Minor mime type regex.
Definition commands.c:53
const char * major
Major mime type, e.g. "text".
Definition commands.c:50
enum ContentType major_int
Major mime type, e.g. TYPE_TEXT.
Definition commands.c:51
char * subtype
content-type subtype
Definition body.h:61
unsigned int type
content-type primary type, ContentType
Definition body.h:40
A List node for strings.
Definition list.h:37
char * data
String.
Definition list.h:38
Here is the caller graph for this function:

◆ count_body_parts()

int count_body_parts ( struct Body * b,
int depth )
static

Count the MIME Body parts.

Parameters
bBody of email
depthCurrent recursion depth
Return values
numNumber of MIME Body parts

Definition at line 130 of file commands.c.

131{
132 if (!b || (depth >= MIME_DEPTH_MAX))
133 return 0;
134
136 ASSERT(mod_data);
137
138 int count = 0;
139
140 for (struct Body *bp = b; bp; bp = bp->next)
141 {
142 /* Initial disposition is to count and not to recurse this part. */
143 bool shallcount = true; /* default */
144 bool shallrecurse = false;
145
146 mutt_debug(LL_DEBUG5, "desc=\"%s\"; fn=\"%s\", type=\"%d/%s\"\n",
147 bp->description ? bp->description : ("none"),
148 bp->filename ? bp->filename :
149 bp->d_filename ? bp->d_filename :
150 "(none)",
151 bp->type, bp->subtype ? bp->subtype : "*");
152
153 if (bp->type == TYPE_MESSAGE)
154 {
155 shallrecurse = true;
156
157 /* If it's an external body pointer, don't recurse it. */
158 if (mutt_istr_equal(bp->subtype, "external-body"))
159 shallrecurse = false;
160 }
161 else if (bp->type == TYPE_MULTIPART)
162 {
163 /* Always recurse multiparts, except multipart/alternative. */
164 shallrecurse = true;
165 if (mutt_istr_equal(bp->subtype, "alternative"))
166 {
167 const bool c_count_alternatives = cs_subset_bool(NeoMutt->sub, "count_alternatives");
168 shallrecurse = c_count_alternatives;
169 }
170 }
171
172 if ((bp->disposition == DISP_INLINE) && (bp->type != TYPE_MULTIPART) &&
173 (bp->type != TYPE_MESSAGE) && (bp == b))
174 {
175 shallcount = false; /* ignore fundamental inlines */
176 }
177
178 /* If this body isn't scheduled for enumeration already, don't bother
179 * profiling it further. */
180 if (shallcount)
181 {
182 /* Turn off shallcount if message type is not in ok list,
183 * or if it is in except list. Check is done separately for
184 * inlines vs. attachments. */
185
186 if (bp->disposition == DISP_ATTACH)
187 {
188 if (!count_body_parts_check(&mod_data->attach_allow, bp, true))
189 shallcount = false; /* attach not allowed */
190 if (count_body_parts_check(&mod_data->attach_exclude, bp, false))
191 shallcount = false; /* attach excluded */
192 }
193 else
194 {
195 if (!count_body_parts_check(&mod_data->inline_allow, bp, true))
196 shallcount = false; /* inline not allowed */
197 if (count_body_parts_check(&mod_data->inline_exclude, bp, false))
198 shallcount = false; /* excluded */
199 }
200 }
201
202 if (shallcount)
203 count++;
204 bp->attach_qualifies = shallcount;
205
206 mutt_debug(LL_DEBUG3, "%p shallcount = %d\n", (void *) bp, shallcount);
207
208 if (shallrecurse)
209 {
210 mutt_debug(LL_DEBUG3, "%p pre count = %d\n", (void *) bp, count);
211 bp->attach_count = count_body_parts(bp->parts, depth + 1);
212 count += bp->attach_count;
213 mutt_debug(LL_DEBUG3, "%p post count = %d\n", (void *) bp, count);
214 }
215 }
216
217 mutt_debug(LL_DEBUG3, "return %d\n", (count < 0) ? 0 : count);
218 return (count < 0) ? 0 : count;
219}
static int count_body_parts(struct Body *b, int depth)
Count the MIME Body parts.
Definition commands.c:130
#define MIME_DEPTH_MAX
Maximum MIME nesting depth for counting body parts.
Definition commands.c:122
static bool count_body_parts_check(struct ListHead *checklist, struct Body *b, bool dflt)
Compares mime types to the ok and except lists.
Definition commands.c:91
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
@ LL_DEBUG5
Log at debug level 5.
Definition logging2.h:49
@ TYPE_MESSAGE
Type: 'message/*'.
Definition mime.h:35
@ TYPE_MULTIPART
Type: 'multipart/*'.
Definition mime.h:37
@ DISP_ATTACH
Content is attached.
Definition mime.h:63
@ DISP_INLINE
Content is inline.
Definition mime.h:62
@ MODULE_ID_ATTACH
ModuleAttach, Attachments
Definition module_api.h:49
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition string.c:678
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:666
#define ASSERT(COND)
Definition signal2.h:59
Attach private Module data.
Definition module_data.h:32
struct ListHead attach_allow
List of attachment types to be counted.
Definition module_data.h:34
struct ListHead attach_exclude
List of attachment types to be ignored.
Definition module_data.h:35
struct ListHead inline_allow
List of inline types to counted.
Definition module_data.h:36
struct ListHead inline_exclude
List of inline types to ignore.
Definition module_data.h:37
The body of an email.
Definition body.h:36
struct Body * next
next attachment in the list
Definition body.h:72
Container for Accounts, Notifications.
Definition neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mutt_count_body_parts()

int mutt_count_body_parts ( struct Email * e,
FILE * fp )

Count the MIME Body parts.

Parameters
eEmail
fpFile to parse
Return values
numNumber of MIME Body parts

Definition at line 227 of file commands.c.

228{
229 if (!e)
230 return 0;
231
233 ASSERT(mod_data);
234
235 bool keep_parts = false;
236
237 if (e->attach_valid)
238 return e->attach_total;
239
240 if (e->body->parts)
241 keep_parts = true;
242 else
244
245 if (!STAILQ_EMPTY(&mod_data->attach_allow) || !STAILQ_EMPTY(&mod_data->attach_exclude) ||
246 !STAILQ_EMPTY(&mod_data->inline_allow) || !STAILQ_EMPTY(&mod_data->inline_exclude))
247 {
249 }
250 else
251 {
252 e->attach_total = 0;
253 }
254
255 e->attach_valid = true;
256
257 if (!keep_parts)
259
260 return e->attach_total;
261}
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
Definition commands.c:629
void mutt_body_free(struct Body **ptr)
Free a Body.
Definition body.c:58
struct Body * parts
parts of a multipart or message/rfc822
Definition body.h:73
bool attach_valid
true when the attachment count is valid
Definition email.h:100
struct Body * body
List of MIME parts.
Definition email.h:69
short attach_total
Number of qualifying attachments in message, if attach_valid.
Definition email.h:115
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mutt_attachments_reset()

void mutt_attachments_reset ( struct MailboxView * mv)

Reset the attachment count for all Emails.

Parameters
mvMailbox view

Definition at line 267 of file commands.c.

268{
269 if (!mv || !mv->mailbox)
270 return;
271
272 struct Mailbox *m = mv->mailbox;
273
274 for (int i = 0; i < m->msg_count; i++)
275 {
276 struct Email *e = m->emails[i];
277 if (!e)
278 break;
279 e->attach_valid = false;
280 e->attach_total = 0;
281 }
282}
The envelope/body of an email.
Definition email.h:39
struct Mailbox * mailbox
Current Mailbox.
Definition mview.h:51
A mailbox.
Definition mailbox.h:81
int msg_count
Total number of messages.
Definition mailbox.h:90
struct Email ** emails
Array of Emails.
Definition mailbox.h:98
Here is the caller graph for this function:

◆ parse_attach_list()

enum CommandResult parse_attach_list ( const struct Command * cmd,
struct Buffer * line,
struct ListHead * head,
struct Buffer * err )
static

Parse the "attachments" command.

Parameters
cmdCommand being parsed
lineBuffer containing the attachments command
headList of AttachMatch to add to
errBuffer for error messages
Return values
CommandResultResult e.g. MUTT_CMD_SUCCESS

Definition at line 292 of file commands.c.

294{
295 struct AttachMatch *a = NULL;
296 char *p = NULL;
297 char *tmpminor = NULL;
298 size_t len;
299 struct Buffer *token = buf_pool_get();
301
303 ASSERT(mod_data);
304
305 do
306 {
307 parse_extract_token(token, line, TOKEN_NONE);
308
309 if (buf_is_empty(token))
310 continue;
311
312 a = attachmatch_new();
313
314 /* some cheap hacks that I expect to remove */
315 if (mutt_istr_equal(token->data, "any"))
316 a->major = mutt_str_dup("*/.*");
317 else if (mutt_istr_equal(token->data, "none"))
318 a->major = mutt_str_dup("cheap_hack/this_should_never_match");
319 else
320 a->major = buf_strdup(token);
321
322 p = strchr(a->major, '/');
323 if (p)
324 {
325 *p = '\0';
326 p++;
327 a->minor = p;
328 }
329 else
330 {
331 a->minor = "unknown";
332 }
333
334 len = strlen(a->minor);
335 tmpminor = MUTT_MEM_MALLOC(len + 3, char);
336 memcpy(&tmpminor[1], a->minor, len);
337 tmpminor[0] = '^';
338 tmpminor[len + 1] = '$';
339 tmpminor[len + 2] = '\0';
340
342 int rc_regex = REG_COMP(&a->minor_regex, tmpminor, REG_ICASE);
343
344 FREE(&tmpminor);
345
346 if (rc_regex != 0)
347 {
348 regerror(rc_regex, &a->minor_regex, err->data, err->dsize);
349 buf_fix_dptr(err);
350 FREE(&a->major);
351 FREE(&a);
352 goto done;
353 }
354
355 mutt_debug(LL_DEBUG3, "added %s/%s [%d]\n", a->major, a->minor, a->major_int);
356
357 mutt_list_insert_tail(head, (char *) a);
358 } while (MoreArgs(line));
359
360 if (!a)
361 goto done;
362
363 mutt_debug(LL_NOTIFY, "NT_ATTACH_ADD: %s/%s\n", a->major, a->minor);
365
366 rc = MUTT_CMD_SUCCESS;
367
368done:
369 buf_pool_release(&token);
370 return rc;
371}
struct AttachMatch * attachmatch_new(void)
Create a new AttachMatch.
Definition commands.c:79
@ NT_ATTACH_ADD
Attachment regex has been added.
Definition commands.h:44
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition buffer.c:298
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
Definition buffer.c:189
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition buffer.c:577
CommandResult
Error codes for command_t parse functions.
Definition command.h:37
@ MUTT_CMD_SUCCESS
Success: Command worked.
Definition command.h:40
@ MUTT_CMD_ERROR
Error: Can't help the user.
Definition command.h:38
enum ContentType mutt_check_mime_type(const char *s)
Check a MIME type string.
Definition parse.c:380
int parse_extract_token(struct Buffer *dest, struct Buffer *line, TokenFlags flags)
Extract one token from a string.
Definition extract.c:49
#define MoreArgs(buf)
Definition extract.h:32
@ TOKEN_NONE
No flags are set.
Definition extract.h:50
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition list.c:65
@ LL_NOTIFY
Log of notifications.
Definition logging2.h:50
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MUTT_MEM_MALLOC(n, type)
Definition memory.h:53
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition notify.c:173
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition string.c:257
@ NT_ATTACH
Attachment command changed, NotifyAttach.
Definition notify_type.h:39
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
Definition regex3.h:49
struct Notify * attachments_notify
Notifications: NotifyAttach.
Definition module_data.h:38
String manipulation buffer.
Definition buffer.h:36
size_t dsize
Length of data.
Definition buffer.h:39
char * data
Pointer to data.
Definition buffer.h:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_unattach_list()

enum CommandResult parse_unattach_list ( const struct Command * cmd,
struct Buffer * line,
struct ListHead * head,
struct Buffer * err )
static

Parse the "unattachments" command.

Parameters
cmdCommand being parsed
lineBuffer containing the unattachments command
headList of AttachMatch to remove from
errBuffer for error messages
Return values
MUTT_CMD_SUCCESSAlways

Definition at line 381 of file commands.c.

383{
384 struct Buffer *token = buf_pool_get();
385
387 ASSERT(mod_data);
388
389 struct AttachMatch *a = NULL;
390 char *tmp = NULL;
391 char *minor = NULL;
392
393 do
394 {
395 parse_extract_token(token, line, TOKEN_NONE);
396 FREE(&tmp);
397
398 if (mutt_istr_equal(token->data, "any"))
399 tmp = mutt_str_dup("*/.*");
400 else if (mutt_istr_equal(token->data, "none"))
401 tmp = mutt_str_dup("cheap_hack/this_should_never_match");
402 else
403 tmp = buf_strdup(token);
404
405 minor = strchr(tmp, '/');
406 if (minor)
407 {
408 *minor = '\0';
409 minor++;
410 }
411 else
412 {
413 minor = "unknown";
414 }
415 const enum ContentType major = mutt_check_mime_type(tmp);
416
417 struct ListNode *np = NULL;
418 struct ListNode *tmp2 = NULL;
419 STAILQ_FOREACH_SAFE(np, head, entries, tmp2)
420 {
421 a = (struct AttachMatch *) np->data;
422 mutt_debug(LL_DEBUG3, "check %s/%s [%d] : %s/%s [%d]\n", a->major,
423 a->minor, a->major_int, tmp, minor, major);
424 if ((a->major_int == major) && mutt_istr_equal(minor, a->minor))
425 {
426 mutt_debug(LL_DEBUG3, "removed %s/%s [%d]\n", a->major, a->minor, a->major_int);
427 mutt_debug(LL_NOTIFY, "NT_ATTACH_DELETE: %s/%s\n", a->major, a->minor);
428
429 regfree(&a->minor_regex);
430 FREE(&a->major);
431 STAILQ_REMOVE(head, np, ListNode, entries);
432 FREE(&np->data);
433 FREE(&np);
434 }
435 }
436
437 } while (MoreArgs(line));
438
439 FREE(&tmp);
440
442
443 buf_pool_release(&token);
444 return MUTT_CMD_SUCCESS;
445}
@ NT_ATTACH_DELETE
Attachment regex has been deleted.
Definition commands.h:45
ContentType
Content-Type.
Definition mime.h:30
#define STAILQ_REMOVE(head, elm, type, field)
Definition queue.h:441
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition queue.h:400
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_attach_list()

int print_attach_list ( struct ListHead * h,
const char op,
const char * name )
static

Print a list of attachments.

Parameters
hList of attachments
opOperation, e.g. '+', '-'
nameAttached/Inline, 'A', 'I'
Return values
0Always

Definition at line 454 of file commands.c.

455{
456 struct ListNode *np = NULL;
457 STAILQ_FOREACH(np, h, entries)
458 {
459 printf("attachments %c%s %s/%s\n", op, name,
460 ((struct AttachMatch *) np->data)->major,
461 ((struct AttachMatch *) np->data)->minor);
462 }
463
464 return 0;
465}
Here is the caller graph for this function:

◆ mutt_parse_mime_message()

void mutt_parse_mime_message ( struct Email * e,
FILE * fp )

Parse a MIME email.

Parameters
eEmail
fpFile to parse

Definition at line 629 of file commands.c.

630{
631 const bool right_type = (e->body->type == TYPE_MESSAGE) ||
632 (e->body->type == TYPE_MULTIPART);
633 const bool not_parsed = (e->body->parts == NULL);
634
635 if (right_type && fp && not_parsed)
636 {
637 mutt_parse_part(fp, e->body);
638 if (WithCrypto)
639 {
640 e->security = crypt_query(e->body);
641 }
642 }
643
644 e->attach_valid = false;
645}
SecurityFlags crypt_query(struct Body *b)
Check out the type of encryption used.
Definition crypt.c:693
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
Definition parse.c:1982
#define WithCrypto
Definition lib.h:132
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition email.h:43
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ AttachCommands

const struct Command AttachCommands[]
Initial value:
= {
N_("Set attachment counting rules"),
N_("attachments { + | - }<disposition> <mime-type> [ <mime-type> ... ] | ?"),
"mimesupport.html#attachments" },
N_("Map specified MIME types/subtypes to display handlers"),
N_("mime-lookup <mime-type>[/<mime-subtype> ] [ ... ]"),
"mimesupport.html#mime-lookup" },
N_("Remove attachment counting rules"),
N_("unattachments { * | { + | - }<disposition> <mime-type> [ ... ] }"),
"mimesupport.html#attachments" },
N_("Remove custom MIME-type handlers"),
N_("unmime-lookup { * | [ <mime-type>[/<mime-subtype> ] ... ] }"),
"mimesupport.html#mime-lookup" },
{ "mime_lookup", CMD_NONE, NULL, "mime-lookup", NULL, NULL, CF_SYNONYM },
{ "unmime_lookup", CMD_NONE, NULL, "unmime-lookup", NULL, NULL, CF_SYNONYM },
{ NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NONE },
}
@ CF_SYNONYM
Command is a synonym for another command.
Definition command.h:50
@ CF_NONE
No flags are set.
Definition command.h:49
@ CMD_MIME_LOOKUP
:mime-lookup
Definition command.h:98
@ CMD_ATTACHMENTS
:attachments
Definition command.h:68
@ CMD_UNMIME_LOOKUP
:unmime-lookup
Definition command.h:141
@ CMD_NONE
No Command.
Definition command.h:62
@ CMD_UNATTACHMENTS
:unattachments
Definition command.h:129
enum CommandResult parse_attachments(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'attachments' command - Implements Command::parse() -.
Definition commands.c:474
enum CommandResult parse_unmime_lookup(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'unmime-lookup' command - Implements Command::parse() -.
Definition commands.c:670
enum CommandResult parse_unattachments(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'unattachments' command - Implements Command::parse() -.
Definition commands.c:552
enum CommandResult parse_mime_lookup(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'mime-lookup' command - Implements Command::parse() -.
Definition commands.c:654
#define N_(a)
Definition message.h:32

Attach Commands.

Definition at line 682 of file commands.c.

682 {
683 // clang-format off
684 { "attachments", CMD_ATTACHMENTS, parse_attachments,
685 N_("Set attachment counting rules"),
686 N_("attachments { + | - }<disposition> <mime-type> [ <mime-type> ... ] | ?"),
687 "mimesupport.html#attachments" },
688 { "mime-lookup", CMD_MIME_LOOKUP, parse_mime_lookup,
689 N_("Map specified MIME types/subtypes to display handlers"),
690 N_("mime-lookup <mime-type>[/<mime-subtype> ] [ ... ]"),
691 "mimesupport.html#mime-lookup" },
692 { "unattachments", CMD_UNATTACHMENTS, parse_unattachments,
693 N_("Remove attachment counting rules"),
694 N_("unattachments { * | { + | - }<disposition> <mime-type> [ ... ] }"),
695 "mimesupport.html#attachments" },
696 { "unmime-lookup", CMD_UNMIME_LOOKUP, parse_unmime_lookup,
697 N_("Remove custom MIME-type handlers"),
698 N_("unmime-lookup { * | [ <mime-type>[/<mime-subtype> ] ... ] }"),
699 "mimesupport.html#mime-lookup" },
700
701 // Deprecated
702 { "mime_lookup", CMD_NONE, NULL, "mime-lookup", NULL, NULL, CF_SYNONYM },
703 { "unmime_lookup", CMD_NONE, NULL, "unmime-lookup", NULL, NULL, CF_SYNONYM },
704
705 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NONE },
706 // clang-format on
707};