163 for (
struct Body *bp = b; bp; bp = bp->
next)
166 bool shallcount =
true;
167 bool shallrecurse =
false;
170 bp->description ? bp->description : (
"none"),
171 bp->filename ? bp->filename :
172 bp->d_filename ? bp->d_filename :
174 bp->type, bp->subtype ? bp->subtype :
"*");
182 shallrecurse =
false;
191 shallrecurse = c_count_alternatives;
227 bp->attach_qualifies = shallcount;
235 count += bp->attach_count;
241 return (count < 0) ? 0 : count;
255 bool keep_parts =
false;
313 struct ListHead *head,
struct Buffer *err)
317 char *tmpminor = NULL;
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';
398 struct ListHead *head,
struct Buffer *err)
414 tmp =
mutt_str_dup(
"cheap_hack/this_should_never_match");
418 minor = strchr(tmp,
'/');
430 struct ListNode *np = NULL, *tmp2 = NULL;
471 printf(
"attachments %c%s %s/%s\n", op, name,
499 char *category = token->
data;
500 char op = *category++;
506 printf(
"\n%s\n\n",
_(
"Current attachments settings:"));
517 if ((op !=
'+') && (op !=
'-'))
523 struct ListHead *head = NULL;
540 buf_strcpy(err,
_(
"attachments: invalid disposition"));
570 const char *p = NULL;
571 struct ListHead *head = NULL;
592 if ((op !=
'+') && (op !=
'-'))
613 buf_strcpy(err,
_(
"unattachments: invalid disposition"));
633 const bool not_parsed = (e->
body->
parts == NULL);
635 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.
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.
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.
static enum CommandResult parse_attach_list(const struct Command *cmd, struct Buffer *line, struct ListHead *head, struct Buffer *err)
Parse the "attachments" command.
void attach_cleanup(void)
Free the attachments lists.
static struct Notify * AttachmentsNotify
Notifications: NotifyAttach.
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 struct ListHead InlineAllow
List of inline types to counted.
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.
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?
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".
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, struct Buffer *err)
Parse the 'attachments' command - Implements Command::parse() -.
enum CommandResult parse_unattachments(const struct Command *cmd, struct Buffer *line, struct Buffer *err)
Parse the 'unattachments' 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.
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_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.
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 Notify * notify
Notifications handler.
struct ConfigSubset * sub
Inherited config items.