121#define MIME_DEPTH_MAX 50
139 for (
struct Body *bp = b; bp; bp = bp->
next)
142 bool shallcount =
true;
143 bool shallrecurse =
false;
146 bp->description ? bp->description : (
"none"),
147 bp->filename ? bp->filename :
148 bp->d_filename ? bp->d_filename :
150 bp->type, bp->subtype ? bp->subtype :
"*");
158 shallrecurse =
false;
167 shallrecurse = c_count_alternatives;
203 bp->attach_qualifies = shallcount;
211 count += bp->attach_count;
217 return (count < 0) ? 0 : count;
234 bool keep_parts =
false;
292 struct ListHead *head,
struct Buffer *err)
296 char *tmpminor = NULL;
321 p = strchr(a->
major,
'/');
330 a->
minor =
"unknown";
333 len = strlen(a->
minor);
335 strcpy(&tmpminor[1], a->
minor);
337 tmpminor[len + 1] =
'$';
338 tmpminor[len + 2] =
'\0';
381 struct ListHead *head,
struct Buffer *err)
400 tmp =
mutt_str_dup(
"cheap_hack/this_should_never_match");
404 minor = strchr(tmp,
'/');
416 struct ListNode *np = NULL, *tmp2 = NULL;
457 printf(
"attachments %c%s %s/%s\n", op, name,
491 char *category = token->
data;
492 char op = *category++;
498 printf(
"\n%s\n\n",
_(
"Current attachments settings:"));
509 if ((op !=
'+') && (op !=
'-'))
515 struct ListHead *head = NULL;
532 buf_strcpy(err,
_(
"attachments: invalid disposition"));
568 const char *p = NULL;
569 struct ListHead *head = NULL;
590 if ((op !=
'+') && (op !=
'-'))
611 buf_strcpy(err,
_(
"unattachments: invalid disposition"));
631 const bool not_parsed = (e->
body->
parts == NULL);
633 if (right_type && fp && not_parsed)
683 N_(
"Set attachment counting rules"),
684 N_(
"attachments { + | - }<disposition> <mime-type> [ <mime-type> ... ] | ?"),
685 "mimesupport.html#attachments" },
687 N_(
"Map specified MIME types/subtypes to display handlers"),
688 N_(
"mime-lookup <mime-type>[/<mime-subtype> ] [ ... ]"),
689 "mimesupport.html#mime-lookup" },
691 N_(
"Remove attachment counting rules"),
692 N_(
"unattachments { * | { + | - }<disposition> <mime-type> [ ... ] }"),
693 "mimesupport.html#attachments" },
695 N_(
"Remove custom MIME-type handlers"),
696 N_(
"unmime-lookup { * | [ <mime-type>[/<mime-subtype> ] ... ] }"),
697 "mimesupport.html#mime-lookup" },
static int print_attach_list(struct ListHead *h, const char op, const char *name)
Print a list of attachments.
static enum CommandResult parse_unattach_list(const struct Command *cmd, struct Buffer *line, struct ListHead *head, struct Buffer *err)
Parse the "unattachments" command.
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
static int count_body_parts(struct Body *b, int depth)
Count the MIME Body parts.
void mutt_attachments_reset(struct MailboxView *mv)
Reset the attachment count for all Emails.
struct AttachMatch * attachmatch_new(void)
Create a new AttachMatch.
#define MIME_DEPTH_MAX
Maximum MIME nesting depth for counting body parts.
static enum CommandResult parse_attach_list(const struct Command *cmd, struct Buffer *line, struct ListHead *head, struct Buffer *err)
Parse the "attachments" command.
int mutt_count_body_parts(struct Email *e, FILE *fp)
Count the MIME Body parts.
static bool count_body_parts_check(struct ListHead *checklist, struct Body *b, bool dflt)
Compares mime types to the ok and except lists.
const struct Command AttachCommands[]
Attach Commands.
Handle the attachments command.
@ NT_ATTACH_DELETE
Attachment regex has been deleted.
@ NT_ATTACH_DELETE_ALL
All Attachment regexes have been deleted.
@ NT_ATTACH_ADD
Attachment regex has been added.
Attach private Module data.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
#define CF_SYNONYM
Command is a synonym for another command.
#define CF_NO_FLAGS
No flags are set.
@ CMD_MIME_LOOKUP
:mime-lookup
@ CMD_ATTACHMENTS
:attachments
@ CMD_UNMIME_LOOKUP
:unmime-lookup
@ CMD_UNATTACHMENTS
:unattachments
CommandResult
Error codes for command_t parse functions.
@ MUTT_CMD_SUCCESS
Success: Command worked.
@ MUTT_CMD_ERROR
Error: Can't help the user.
@ MUTT_CMD_WARNING
Warning: Help given to the user.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
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.
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
void mutt_endwin(void)
Shutdown curses.
void mutt_body_free(struct Body **ptr)
Free a Body.
Structs that make up an email.
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
enum ContentType mutt_check_mime_type(const char *s)
Check a MIME type string.
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_unmime_lookup(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'unmime-lookup' 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() -.
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() -.
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() -.
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() -.
void attachmatch_free(struct AttachMatch **ptr)
Free an AttachMatch - Implements list_free_t -.
#define mutt_debug(LEVEL,...)
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.
void mutt_list_free_type(struct ListHead *h, list_free_t fn)
Free a List of type.
void(* list_free_t)(void **ptr)
@ LL_DEBUG3
Log at debug level 3.
@ LL_DEBUG5
Log at debug level 5.
@ LL_NOTIFY
Log of notifications.
#define FREE(x)
Free memory and set the pointer to NULL.
#define MUTT_MEM_CALLOC(n, type)
#define MUTT_MEM_MALLOC(n, type)
@ TYPE_MESSAGE
Type: 'message/*'.
@ TYPE_MULTIPART
Type: 'multipart/*'.
@ TYPE_ANY
Type: '' or '.'.
@ DISP_ATTACH
Content is attached.
@ DISP_INLINE
Content is inline.
@ MODULE_ID_ATTACH
ModuleAttach, Attachments
Convenience wrapper for the library headers.
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
char * mutt_str_dup(const char *str)
Copy a string, safely.
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
API for encryption/signing of emails.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
@ NT_ATTACH
Attachment command changed, NotifyAttach.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
#define STAILQ_REMOVE(head, elm, type, field)
#define STAILQ_FOREACH(var, head, field)
#define STAILQ_EMPTY(head)
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
An attachment matching a regex for attachment counter.
const char * minor
Minor mime type, e.g. "html".
regex_t minor_regex
Minor mime type regex.
const char * major
Major mime type, e.g. "text".
enum ContentType major_int
Major mime type, e.g. TYPE_TEXT.
Attach private Module data.
struct ListHead attach_allow
List of attachment types to be counted.
struct ListHead attach_exclude
List of attachment types to be ignored.
struct ListHead inline_allow
List of inline types to counted.
struct ListHead inline_exclude
List of inline types to ignore.
struct ListHead mime_lookup
List of mime types that that shouldn't use the mailcap entry.
struct Notify * attachments_notify
Notifications: NotifyAttach.
struct Body * parts
parts of a multipart or message/rfc822
struct Body * next
next attachment in the list
char * subtype
content-type subtype
unsigned int type
content-type primary type, ContentType
String manipulation buffer.
size_t dsize
Length of data.
char * data
Pointer to data.
const char * name
Name of the Command.
The envelope/body of an email.
bool attach_valid
true when the attachment count is valid
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
struct Body * body
List of MIME parts.
short attach_total
Number of qualifying attachments in message, if attach_valid.
struct Mailbox * mailbox
Current Mailbox.
int msg_count
Total number of messages.
struct Email ** emails
Array of Emails.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
Context for config parsing (history/backtrace)
Detailed error information from config parsing.
struct Buffer * message
Error message.