NeoMutt  2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
commands.c
Go to the documentation of this file.
1
23
29
30#include "config.h"
31#include <stdbool.h>
32#include <stdio.h>
33#include <string.h>
34#include "mutt/lib.h"
35#include "config/lib.h"
36#include "email/lib.h"
37#include "core/lib.h"
38#include "gui/lib.h"
39#include "commands.h"
40#include "commands/lib.h"
41#include "ncrypt/lib.h"
42#include "parse/lib.h"
43#include "module_data.h"
44
49{
50 const char *major;
52 const char *minor;
53 regex_t minor_regex;
54};
55
63void attachmatch_free(struct AttachMatch **ptr)
64{
65 if (!ptr || !*ptr)
66 return;
67
68 struct AttachMatch *am = *ptr;
69 regfree(&am->minor_regex);
70 FREE(&am->major);
71 FREE(ptr);
72}
73
79{
80 return MUTT_MEM_CALLOC(1, struct AttachMatch);
81}
82
90static bool count_body_parts_check(struct ListHead *checklist, struct Body *b, bool dflt)
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}
119
121#define MIME_DEPTH_MAX 50
122
129static int count_body_parts(struct Body *b, int depth)
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}
219
226int mutt_count_body_parts(struct Email *e, FILE *fp)
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}
261
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}
282
291static enum CommandResult parse_attach_list(const struct Command *cmd, struct Buffer *line,
292 struct ListHead *head, struct Buffer *err)
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}
371
380static enum CommandResult parse_unattach_list(const struct Command *cmd, struct Buffer *line,
381 struct ListHead *head, struct Buffer *err)
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}
444
452static int print_attach_list(struct ListHead *h, const char op, const char *name)
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}
464
472enum CommandResult parse_attachments(const struct Command *cmd, struct Buffer *line,
473 const struct ParseContext *pc, struct ParseError *pe)
474{
476 ASSERT(md);
477
478 struct Buffer *err = pe->message;
479
480 if (!MoreArgs(line))
481 {
482 buf_printf(err, _("%s: too few arguments"), cmd->name);
483 return MUTT_CMD_WARNING;
484 }
485
486 struct Buffer *token = buf_pool_get();
488
490
491 char *category = token->data;
492 char op = *category++;
493
494 if (op == '?')
495 {
496 mutt_endwin();
497 fflush(stdout);
498 printf("\n%s\n\n", _("Current attachments settings:"));
499 print_attach_list(&md->attach_allow, '+', "A");
500 print_attach_list(&md->attach_exclude, '-', "A");
501 print_attach_list(&md->inline_allow, '+', "I");
502 print_attach_list(&md->inline_exclude, '-', "I");
504
505 rc = MUTT_CMD_SUCCESS;
506 goto done;
507 }
508
509 if ((op != '+') && (op != '-'))
510 {
511 op = '+';
512 category--;
513 }
514
515 struct ListHead *head = NULL;
516 if (mutt_istr_startswith("attachment", category))
517 {
518 if (op == '+')
519 head = &md->attach_allow;
520 else
521 head = &md->attach_exclude;
522 }
523 else if (mutt_istr_startswith("inline", category))
524 {
525 if (op == '+')
526 head = &md->inline_allow;
527 else
528 head = &md->inline_exclude;
529 }
530 else
531 {
532 buf_strcpy(err, _("attachments: invalid disposition"));
533 goto done;
534 }
535
536 rc = parse_attach_list(cmd, line, head, err);
537
538done:
539 buf_pool_release(&token);
540 return rc;
541}
542
550enum CommandResult parse_unattachments(const struct Command *cmd, struct Buffer *line,
551 const struct ParseContext *pc, struct ParseError *pe)
552{
553 struct Buffer *err = pe->message;
554
555 if (!MoreArgs(line))
556 {
557 buf_printf(err, _("%s: too few arguments"), cmd->name);
558 return MUTT_CMD_WARNING;
559 }
560
562 ASSERT(md);
563
564 struct Buffer *token = buf_pool_get();
566
567 char op;
568 const char *p = NULL;
569 struct ListHead *head = NULL;
570
572
573 p = buf_string(token);
574 op = *p++;
575
576 if (op == '*')
577 {
582
583 mutt_debug(LL_NOTIFY, "NT_ATTACH_DELETE_ALL\n");
585
586 rc = MUTT_CMD_SUCCESS;
587 goto done;
588 }
589
590 if ((op != '+') && (op != '-'))
591 {
592 op = '+';
593 p--;
594 }
595 if (mutt_istr_startswith("attachment", p))
596 {
597 if (op == '+')
598 head = &md->attach_allow;
599 else
600 head = &md->attach_exclude;
601 }
602 else if (mutt_istr_startswith("inline", p))
603 {
604 if (op == '+')
605 head = &md->inline_allow;
606 else
607 head = &md->inline_exclude;
608 }
609 else
610 {
611 buf_strcpy(err, _("unattachments: invalid disposition"));
612 goto done;
613 }
614
615 rc = parse_unattach_list(cmd, line, head, err);
616
617done:
618 buf_pool_release(&token);
619 return rc;
620}
621
627void mutt_parse_mime_message(struct Email *e, FILE *fp)
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}
644
652enum CommandResult parse_mime_lookup(const struct Command *cmd, struct Buffer *line,
653 const struct ParseContext *pc, struct ParseError *pe)
654{
656 ASSERT(md);
657
658 return parse_stailq(cmd, line, &md->mime_lookup, pc, pe);
659}
660
668enum CommandResult parse_unmime_lookup(const struct Command *cmd, struct Buffer *line,
669 const struct ParseContext *pc, struct ParseError *pe)
670{
672 ASSERT(md);
673
674 return parse_unstailq(cmd, line, &md->mime_lookup, pc, pe);
675}
676
680const struct Command AttachCommands[] = {
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};
static int print_attach_list(struct ListHead *h, const char op, const char *name)
Print a list of attachments.
Definition commands.c:452
static enum CommandResult parse_unattach_list(const struct Command *cmd, struct Buffer *line, struct ListHead *head, struct Buffer *err)
Parse the "unattachments" command.
Definition commands.c:380
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
Definition commands.c:627
static int count_body_parts(struct Body *b, int depth)
Count the MIME Body parts.
Definition commands.c:129
void mutt_attachments_reset(struct MailboxView *mv)
Reset the attachment count for all Emails.
Definition commands.c:266
struct AttachMatch * attachmatch_new(void)
Create a new AttachMatch.
Definition commands.c:78
#define MIME_DEPTH_MAX
Maximum MIME nesting depth for counting body parts.
Definition commands.c:121
static enum CommandResult parse_attach_list(const struct Command *cmd, struct Buffer *line, struct ListHead *head, struct Buffer *err)
Parse the "attachments" command.
Definition commands.c:291
int mutt_count_body_parts(struct Email *e, FILE *fp)
Count the MIME Body parts.
Definition commands.c:226
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
const struct Command AttachCommands[]
Attach Commands.
Definition commands.c:680
Handle the attachments command.
@ NT_ATTACH_DELETE
Attachment regex has been deleted.
Definition commands.h:45
@ NT_ATTACH_DELETE_ALL
All Attachment regexes have been deleted.
Definition commands.h:46
@ NT_ATTACH_ADD
Attachment regex has been added.
Definition commands.h:44
Attach private Module data.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition buffer.c:161
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
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition buffer.c:395
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition buffer.c:571
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
#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
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
@ MUTT_CMD_WARNING
Warning: Help given to the user.
Definition command.h:39
NeoMutt Commands.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
SecurityFlags crypt_query(struct Body *b)
Check out the type of encryption used.
Definition crypt.c:687
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
Definition curs_lib.c:173
void mutt_endwin(void)
Shutdown curses.
Definition curs_lib.c:151
void mutt_body_free(struct Body **ptr)
Free a Body.
Definition body.c:58
Structs that make up an email.
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
Definition parse.c:1833
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
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_stailq(const struct Command *cmd, struct Buffer *line, struct ListHead *list, const struct ParseContext *pc, struct ParseError *pe)
Parse a list command - Implements Command::parse() -.
Definition stailq.c:52
enum CommandResult parse_unstailq(const struct Command *cmd, struct Buffer *line, struct ListHead *list, const struct ParseContext *pc, struct ParseError *pe)
Parse an unlist command - Implements Command::parse() -.
Definition stailq.c:85
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
void attachmatch_free(struct AttachMatch **ptr)
Free an AttachMatch - Implements list_free_t -.
Definition commands.c:63
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
Convenience wrapper for the gui headers.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition list.c:65
void mutt_list_free_type(struct ListHead *h, list_free_t fn)
Free a List of type.
Definition list.c:144
void(* list_free_t)(void **ptr)
Definition list.h:50
@ LL_DEBUG3
Log at debug level 3.
Definition logging2.h:47
@ LL_DEBUG5
Log at debug level 5.
Definition logging2.h:49
@ 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_CALLOC(n, type)
Definition memory.h:52
#define MUTT_MEM_MALLOC(n, type)
Definition memory.h:53
ContentType
Content-Type.
Definition mime.h:30
@ TYPE_MESSAGE
Type: 'message/*'.
Definition mime.h:35
@ TYPE_MULTIPART
Type: 'multipart/*'.
Definition mime.h:37
@ TYPE_ANY
Type: '' or '.'.
Definition mime.h:40
@ 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
Convenience wrapper for the library headers.
#define N_(a)
Definition message.h:32
#define _(a)
Definition message.h:28
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
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition string.c:674
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition string.c:257
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
Definition string.c:246
API for encryption/signing of emails.
#define WithCrypto
Definition lib.h:124
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:585
@ NT_ATTACH
Attachment command changed, NotifyAttach.
Definition notify_type.h:39
Text parsing functions.
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 STAILQ_REMOVE(head, elm, type, field)
Definition queue.h:441
#define STAILQ_FOREACH(var, head, field)
Definition queue.h:390
#define STAILQ_EMPTY(head)
Definition queue.h:382
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition queue.h:400
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
Definition regex3.h:49
#define ASSERT(COND)
Definition signal2.h:59
An attachment matching a regex for attachment counter.
Definition commands.c:49
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
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
struct ListHead mime_lookup
List of mime types that that shouldn't use the mailcap entry.
Definition module_data.h:39
struct Notify * attachments_notify
Notifications: NotifyAttach.
Definition module_data.h:37
The body of an email.
Definition body.h:36
struct Body * parts
parts of a multipart or message/rfc822
Definition body.h:73
struct Body * next
next attachment in the list
Definition body.h:72
char * subtype
content-type subtype
Definition body.h:61
unsigned int type
content-type primary type, ContentType
Definition body.h:40
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
const char * name
Name of the Command.
Definition command.h:159
The envelope/body of an email.
Definition email.h:39
bool attach_valid
true when the attachment count is valid
Definition email.h:100
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition email.h:43
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
A List node for strings.
Definition list.h:37
char * data
String.
Definition list.h:38
View of a Mailbox.
Definition mview.h:40
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
Container for Accounts, Notifications.
Definition neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Context for config parsing (history/backtrace)
Definition pcontext.h:34
Detailed error information from config parsing.
Definition perror.h:34
struct Buffer * message
Error message.
Definition perror.h:35