diff options
author | Kevin McCarthy <kevin@8t8.us> | 2020-04-02 14:30:08 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2020-04-03 14:54:36 -0700 |
commit | 3b9cc43f5f91eae11e90f2f713576358f2264a23 (patch) | |
tree | 31dc9e7459005221c2e5834a0cf25599b93d0971 /init.c | |
parent | 434b55ee1c3aa2ae25731ba4a85a92f2b7ec7879 (diff) |
Add "root" disposition to attachments command.
An initial inline part was previously always skipped, for the good
reasons outlined by @dgc in #217.
Unfortunately, some mail clients have started sending "attachments" as
the root (and only) part, more and more lately. Although this may be
bad practice, Mutt should support counting these as "attachments".
To do so without breaking existing configs, add a "root" disposition
argument to the attachments command. This will count an initial
inline part in a message or multipart container.
The existing code skipped counting for the "top-level" and recursive
calls, so group both of these cases under "root".
Diffstat (limited to 'init.c')
-rw-r--r-- | init.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -1316,6 +1316,8 @@ static int parse_attachments (BUFFER *buf, BUFFER *s, union pointer_long_t udata print_attach_list(AttachExclude, '-', "A"); print_attach_list(InlineAllow, '+', "I"); print_attach_list(InlineExclude, '-', "I"); + print_attach_list(RootAllow, '+', "R"); + print_attach_list(RootExclude, '-', "R"); mutt_any_key_to_continue (NULL); return 0; } @@ -1339,6 +1341,13 @@ static int parse_attachments (BUFFER *buf, BUFFER *s, union pointer_long_t udata else listp = &InlineExclude; } + else if (!ascii_strncasecmp(category, "root", strlen(category))) + { + if (op == '+') + listp = &RootAllow; + else + listp = &RootExclude; + } else { strfcpy(err->data, _("attachments: invalid disposition"), err->dsize); @@ -1381,6 +1390,8 @@ static int parse_unattachments (BUFFER *buf, BUFFER *s, union pointer_long_t uda mutt_free_list_generic(&AttachExclude, free_attachments_data); mutt_free_list_generic(&InlineAllow, free_attachments_data); mutt_free_list_generic(&InlineExclude, free_attachments_data); + mutt_free_list_generic(&RootAllow, free_attachments_data); + mutt_free_list_generic(&RootExclude, free_attachments_data); _attachments_clean(); return 0; } @@ -1404,6 +1415,13 @@ static int parse_unattachments (BUFFER *buf, BUFFER *s, union pointer_long_t uda else listp = &InlineExclude; } + else if (!ascii_strncasecmp(p, "root", strlen(p))) + { + if (op == '+') + listp = &RootAllow; + else + listp = &RootExclude; + } else { strfcpy(err->data, _("unattachments: invalid disposition"), err->dsize); |