diff options
author | June McEnroe <june@causal.agency> | 2020-04-14 16:43:10 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-04-14 16:43:10 -0400 |
commit | b948fb3edca6f60efc8da77ff672760acad7e3e3 (patch) | |
tree | 909a7582ddc330d703df2ba70cae6588cd8a8c81 /archive.h | |
parent | Build a list of body parts parallel to structure (diff) | |
download | bubger-b948fb3edca6f60efc8da77ff672760acad7e3e3.tar.gz bubger-b948fb3edca6f60efc8da77ff672760acad7e3e3.zip |
Add bodyPartType helper
Diffstat (limited to '')
-rw-r--r-- | archive.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/archive.h b/archive.h index 911b7e4..c48d8e3 100644 --- a/archive.h +++ b/archive.h @@ -20,6 +20,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #include <time.h> #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) { |