message: improve attachment heuristics

Do not consider calender-invitations "attachments"; do mark as
"calendar". Do recognize application/ics as calendar messages.

Update mime-object to expose a message part's disposition.

Change the "is-attachment" heuristic to include inline parts if they
have a filename parameter in their content-disposition.

Note that this doesn't change things radically; the delta is +69 and
-202 for ~6500 attachments.
This commit is contained in:
Dirk-Jan C. Binnema
2026-04-10 20:13:13 +03:00
committed by Seth Ladygo
parent 6715ff418a
commit f353e2dacf
5 changed files with 72 additions and 36 deletions

View File

@ -424,9 +424,11 @@ process_part(const MimeObject& parent, const MimePart& part,
if (!ctype)
return;
// flag as calendar, if not already
// flag as calendar, if not already.
if (none_of(info.flags & Flags::Calendar) &&
ctype->is_type("text", "calendar"))
(ctype->is_type("text", "calendar") ||
ctype->is_type("text", "x-vcalendar") ||
ctype->is_type("application", "ics")))
info.flags |= Flags::Calendar;
// flag as attachment, if not already.