164 for (
struct Body *bp = b; bp; bp = bp->
next)
167 bool shallcount =
true;
168 bool shallrecurse =
false;
171 bp->description ? bp->description : (
"none"),
172 bp->filename ? bp->filename :
173 bp->d_filename ? bp->d_filename :
175 bp->type, bp->subtype ? bp->subtype :
"*");
183 shallrecurse =
false;
192 shallrecurse = c_count_alternatives;
228 bp->attach_qualifies = shallcount;
236 count += bp->attach_count;
242 return (count < 0) ? 0 : count;
256 bool keep_parts =
false;
314 struct ListHead *head,
struct Buffer *err)
318 char *tmpminor = NULL;
326 if (!buf->
data || (*buf->
data ==
'\0'))
339 p = strchr(a->
major,
'/');
348 a->
minor =
"unknown";
351 len = strlen(a->
minor);
353 strcpy(&tmpminor[1], a->
minor);
355 tmpminor[len + 1] =
'$';
356 tmpminor[len + 2] =
'\0';
394 struct ListHead *head,
struct Buffer *err)
408 tmp =
mutt_str_dup(
"cheap_hack/this_should_never_match");
412 minor = strchr(tmp,
'/');
424 struct ListNode *np = NULL, *tmp2 = NULL;
464 printf(
"attachments %c%s %s/%s\n", op, name,
479 if (!buf->
data || (*buf->
data ==
'\0'))
485 char *category = buf->
data;
486 char op = *category++;
492 printf(
"\n%s\n\n",
_(
"Current attachments settings:"));
501 if ((op !=
'+') && (op !=
'-'))
507 struct ListHead *head = NULL;
524 buf_strcpy(err,
_(
"attachments: invalid disposition"));
535 intptr_t data,
struct Buffer *err)
539 struct ListHead *head = NULL;
542 if (!buf->
data || (*buf->
data ==
'\0'))
544 buf_strcpy(err,
_(
"unattachments: no disposition"));
563 if ((op !=
'+') && (op !=
'-'))
584 buf_strcpy(err,
_(
"unattachments: invalid disposition"));
600 const bool not_parsed = (e->
body->
parts == NULL);
602 if (right_type && fp && not_parsed)
static struct ListHead AttachAllow
List of attachment types to be counted.
static int print_attach_list(struct ListHead *h, const char op, const char *name)
Print a list of attachments.
static int count_body_parts(struct Body *b)
Count the MIME Body parts.
static struct ListHead InlineExclude
List of inline types to ignore.
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
void mutt_attachments_reset(struct MailboxView *mv)
Reset the attachment count for all Emails.
static struct ListHead AttachExclude
List of attachment types to be ignored.
static struct AttachMatch * attachmatch_new(void)
Create a new AttachMatch.
void attach_init(void)
Set up the attachments lists.
void attach_cleanup(void)
Free the attachments lists.
static struct Notify * AttachmentsNotify
Notifications: NotifyAttach.
static enum CommandResult parse_unattach_list(struct Buffer *buf, struct Buffer *s, struct ListHead *head, struct Buffer *err)
Parse the "unattachments" 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.
static enum CommandResult parse_attach_list(struct Buffer *buf, struct Buffer *s, struct ListHead *head, struct Buffer *err)
Parse the "attachments" command.
static struct ListHead InlineAllow
List of inline types to counted.
Miscellaneous email parsing routines.
@ 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.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
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_unattachments(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unattachments' command - Implements Command::parse() -.
enum CommandResult parse_attachments(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'attachments' command - Implements Command::parse() -.
static 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 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.
Convenience wrapper for the library headers.
struct Notify * notify_new(void)
Create a new notifications handler.
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
void notify_free(struct Notify **ptr)
Free a notification handler.
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.
@ NT_ATTACH
Attachment command changed, NotifyAttach.
#define STAILQ_REMOVE(head, elm, type, field)
#define STAILQ_HEAD_INITIALIZER(head)
#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.
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.
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 Notify * notify
Notifications handler.
struct ConfigSubset * sub
Inherited config items.