NeoMutt  2025-12-11-435-g4ac674
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 (struct AttachMatch **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 121 of file commands.c.

Function Documentation

◆ attachmatch_new()

struct AttachMatch * attachmatch_new ( void )

Create a new AttachMatch.

Return values
ptrNew AttachMatch

Definition at line 78 of file commands.c.

79{
80 return MUTT_MEM_CALLOC(1, struct AttachMatch);
81}
#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()

static 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 90 of file commands.c.

91{
92 /* If list is null, use default behavior. */
93 if (!checklist || STAILQ_EMPTY(checklist))
94 {
95 return false;
96 }
97
98 struct AttachMatch *a = NULL;
99 struct ListNode *np = NULL;
100 STAILQ_FOREACH(np, checklist, entries)
101 {
102 a = (struct AttachMatch *) np->data;
103 mutt_debug(LL_DEBUG3, "%s %d/%s ?? %s/%s [%d]... ", dflt ? "[OK] " : "[EXCL] ",
104 b->type, b->subtype ? b->subtype : "*", a->major, a->minor, a->major_int);
105 if (((a->major_int == TYPE_ANY) || (a->major_int == b->type)) &&
106 (!b->subtype || (regexec(&a->minor_regex, b->subtype, 0, NULL, 0) == 0)))
107 {
108 mutt_debug(LL_DEBUG3, "yes\n");
109 return true;
110 }
111 else
112 {
113 mutt_debug(LL_DEBUG3, "no\n");
114 }
115 }
116
117 return false;
118}
#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()

static 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 129 of file commands.c.

130{
131 if (!b || (depth >= MIME_DEPTH_MAX))
132 return 0;
133
135 ASSERT(md);
136
137 int count = 0;
138
139 for (struct Body *bp = b; bp; bp = bp->next)
140 {
141 /* Initial disposition is to count and not to recurse this part. */
142 bool shallcount = true; /* default */
143 bool shallrecurse = false;
144
145 mutt_debug(LL_DEBUG5, "desc=\"%s\"; fn=\"%s\", type=\"%d/%s\"\n",
146 bp->description ? bp->description : ("none"),
147 bp->filename ? bp->filename :
148 bp->d_filename ? bp->d_filename :
149 "(none)",
150 bp->type, bp->subtype ? bp->subtype : "*");
151
152 if (bp->type == TYPE_MESSAGE)
153 {
154 shallrecurse = true;
155
156 /* If it's an external body pointer, don't recurse it. */
157 if (mutt_istr_equal(bp->subtype, "external-body"))
158 shallrecurse = false;
159 }
160 else if (bp->type == TYPE_MULTIPART)
161 {
162 /* Always recurse multiparts, except multipart/alternative. */
163 shallrecurse = true;
164 if (mutt_istr_equal(bp->subtype, "alternative"))
165 {
166 const bool c_count_alternatives = cs_subset_bool(NeoMutt->sub, "count_alternatives");
167 shallrecurse = c_count_alternatives;
168 }
169 }
170
171 if ((bp->disposition == DISP_INLINE) && (bp->type != TYPE_MULTIPART) &&
172 (bp->type != TYPE_MESSAGE) && (bp == b))
173 {
174 shallcount = false; /* ignore fundamental inlines */
175 }
176
177 /* If this body isn't scheduled for enumeration already, don't bother
178 * profiling it further. */
179 if (shallcount)
180 {
181 /* Turn off shallcount if message type is not in ok list,
182 * or if it is in except list. Check is done separately for
183 * inlines vs. attachments. */
184
185 if (bp->disposition == DISP_ATTACH)
186 {
187 if (!count_body_parts_check(&md->attach_allow, bp, true))
188 shallcount = false; /* attach not allowed */
189 if (count_body_parts_check(&md->attach_exclude, bp, false))
190 shallcount = false; /* attach excluded */
191 }
192 else
193 {
194 if (!count_body_parts_check(&md->inline_allow, bp, true))
195 shallcount = false; /* inline not allowed */
196 if (count_body_parts_check(&md->inline_exclude, bp, false))
197 shallcount = false; /* excluded */
198 }
199 }
200
201 if (shallcount)
202 count++;
203 bp->attach_qualifies = shallcount;
204
205 mutt_debug(LL_DEBUG3, "%p shallcount = %d\n", (void *) bp, shallcount);
206
207 if (shallrecurse)
208 {
209 mutt_debug(LL_DEBUG3, "%p pre count = %d\n", (void *) bp, count);
210 bp->attach_count = count_body_parts(bp->parts, depth + 1);
211 count += bp->attach_count;
212 mutt_debug(LL_DEBUG3, "%p post count = %d\n", (void *) bp, count);
213 }
214 }
215
216 mutt_debug(LL_DEBUG3, "return %d\n", (count < 0) ? 0 : count);
217 return (count < 0) ? 0 : count;
218}
static int count_body_parts(struct Body *b, int depth)
Count the MIME Body parts.
Definition commands.c:129
#define MIME_DEPTH_MAX
Maximum MIME nesting depth for counting body parts.
Definition commands.c:121
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:90
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:674
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:585
#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:33
struct ListHead attach_exclude
List of attachment types to be ignored.
Definition module_data.h:34
struct ListHead inline_allow
List of inline types to counted.
Definition module_data.h:35
struct ListHead inline_exclude
List of inline types to ignore.
Definition module_data.h:36
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 226 of file commands.c.

227{
228 if (!e)
229 return 0;
230
232 ASSERT(md);
233
234 bool keep_parts = false;
235
236 if (e->attach_valid)
237 return e->attach_total;
238
239 if (e->body->parts)
240 keep_parts = true;
241 else
243
246 {
248 }
249 else
250 {
251 e->attach_total = 0;
252 }
253
254 e->attach_valid = true;
255
256 if (!keep_parts)
258
259 return e->attach_total;
260}
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
Definition commands.c:627
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 266 of file commands.c.

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

◆ parse_attach_list()

static 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 291 of file commands.c.

293{
294 struct AttachMatch *a = NULL;
295 char *p = NULL;
296 char *tmpminor = NULL;
297 size_t len;
298 struct Buffer *token = buf_pool_get();
300
302 ASSERT(md);
303
304 do
305 {
307
308 if (buf_is_empty(token))
309 continue;
310
311 a = attachmatch_new();
312
313 /* some cheap hacks that I expect to remove */
314 if (mutt_istr_equal(token->data, "any"))
315 a->major = mutt_str_dup("*/.*");
316 else if (mutt_istr_equal(token->data, "none"))
317 a->major = mutt_str_dup("cheap_hack/this_should_never_match");
318 else
319 a->major = buf_strdup(token);
320
321 p = strchr(a->major, '/');
322 if (p)
323 {
324 *p = '\0';
325 p++;
326 a->minor = p;
327 }
328 else
329 {
330 a->minor = "unknown";
331 }
332
333 len = strlen(a->minor);
334 tmpminor = MUTT_MEM_MALLOC(len + 3, char);
335 strcpy(&tmpminor[1], a->minor);
336 tmpminor[0] = '^';
337 tmpminor[len + 1] = '$';
338 tmpminor[len + 2] = '\0';
339
341 int rc_regex = REG_COMP(&a->minor_regex, tmpminor, REG_ICASE);
342
343 FREE(&tmpminor);
344
345 if (rc_regex != 0)
346 {
347 regerror(rc_regex, &a->minor_regex, err->data, err->dsize);
348 buf_fix_dptr(err);
349 FREE(&a->major);
350 FREE(&a);
351 goto done;
352 }
353
354 mutt_debug(LL_DEBUG3, "added %s/%s [%d]\n", a->major, a->minor, a->major_int);
355
356 mutt_list_insert_tail(head, (char *) a);
357 } while (MoreArgs(line));
358
359 if (!a)
360 goto done;
361
362 mutt_debug(LL_NOTIFY, "NT_ATTACH_ADD: %s/%s\n", a->major, a->minor);
364
365 rc = MUTT_CMD_SUCCESS;
366
367done:
368 buf_pool_release(&token);
369 return rc;
370}
struct AttachMatch * attachmatch_new(void)
Create a new AttachMatch.
Definition commands.c:78
@ 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:291
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
Definition buffer.c:182
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition buffer.c:571
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:371
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:31
#define TOKEN_NO_FLAGS
No flags are set.
Definition extract.h:45
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:37
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()

static 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 380 of file commands.c.

382{
383 struct Buffer *token = buf_pool_get();
384
386 ASSERT(md);
387
388 struct AttachMatch *a = NULL;
389 char *tmp = NULL;
390 char *minor = NULL;
391
392 do
393 {
395 FREE(&tmp);
396
397 if (mutt_istr_equal(token->data, "any"))
398 tmp = mutt_str_dup("*/.*");
399 else if (mutt_istr_equal(token->data, "none"))
400 tmp = mutt_str_dup("cheap_hack/this_should_never_match");
401 else
402 tmp = buf_strdup(token);
403
404 minor = strchr(tmp, '/');
405 if (minor)
406 {
407 *minor = '\0';
408 minor++;
409 }
410 else
411 {
412 minor = "unknown";
413 }
414 const enum ContentType major = mutt_check_mime_type(tmp);
415
416 struct ListNode *np = NULL, *tmp2 = NULL;
417 STAILQ_FOREACH_SAFE(np, head, entries, tmp2)
418 {
419 a = (struct AttachMatch *) np->data;
420 mutt_debug(LL_DEBUG3, "check %s/%s [%d] : %s/%s [%d]\n", a->major,
421 a->minor, a->major_int, tmp, minor, major);
422 if ((a->major_int == major) && mutt_istr_equal(minor, a->minor))
423 {
424 mutt_debug(LL_DEBUG3, "removed %s/%s [%d]\n", a->major, a->minor, a->major_int);
425 mutt_debug(LL_NOTIFY, "NT_ATTACH_DELETE: %s/%s\n", a->major, a->minor);
426
427 regfree(&a->minor_regex);
428 FREE(&a->major);
429 STAILQ_REMOVE(head, np, ListNode, entries);
430 FREE(&np->data);
431 FREE(&np);
432 }
433 }
434
435 } while (MoreArgs(line));
436
437 FREE(&tmp);
438
440
441 buf_pool_release(&token);
442 return MUTT_CMD_SUCCESS;
443}
@ 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()

static 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 452 of file commands.c.

453{
454 struct ListNode *np = NULL;
455 STAILQ_FOREACH(np, h, entries)
456 {
457 printf("attachments %c%s %s/%s\n", op, name,
458 ((struct AttachMatch *) np->data)->major,
459 ((struct AttachMatch *) np->data)->minor);
460 }
461
462 return 0;
463}
+ 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 627 of file commands.c.

628{
629 const bool right_type = (e->body->type == TYPE_MESSAGE) ||
630 (e->body->type == TYPE_MULTIPART);
631 const bool not_parsed = (e->body->parts == NULL);
632
633 if (right_type && fp && not_parsed)
634 {
635 mutt_parse_part(fp, e->body);
636 if (WithCrypto)
637 {
638 e->security = crypt_query(e->body);
639 }
640 }
641
642 e->attach_valid = false;
643}
SecurityFlags crypt_query(struct Body *b)
Check out the type of encryption used.
Definition crypt.c:687
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
Definition parse.c:1833
#define WithCrypto
Definition lib.h:124
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_NO_FLAGS },
}
#define CF_SYNONYM
Command is a synonym for another command.
Definition command.h:49
#define CF_NO_FLAGS
No flags are set.
Definition command.h:48
@ CMD_MIME_LOOKUP
:mime-lookup
Definition command.h:95
@ CMD_ATTACHMENTS
:attachments
Definition command.h:65
@ CMD_UNMIME_LOOKUP
:unmime-lookup
Definition command.h:138
@ CMD_NONE
No Command.
Definition command.h:59
@ CMD_UNATTACHMENTS
:unattachments
Definition command.h:126
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:472
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:668
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:550
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:652
#define N_(a)
Definition message.h:32

Attach Commands.

Definition at line 680 of file commands.c.

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