From b948fb3edca6f60efc8da77ff672760acad7e3e3 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 14 Apr 2020 16:43:10 -0400 Subject: Add bodyPartType helper --- archive.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'archive.h') diff --git a/archive.h b/archive.h index 911b7e4..c48d8e3 100644 --- a/archive.h +++ b/archive.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "imap.h" @@ -100,6 +101,13 @@ struct BodyPart { struct List location; }; +static inline bool bodyPartType( + const struct BodyPart *part, const char *type, const char *subtype +) { + const char *partType = (part->multipart ? "multipart" : part->type); + return !strcasecmp(partType, type) && !strcasecmp(part->subtype, subtype); +} + static inline void bodyPartFree(struct BodyPart part) { if (part.multipart) { for (size_t i = 0; i < part.parts.len; ++i) { -- cgit 1.4.1