1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:07:35 +00:00

LibIMAP: Parse body-type-msg to spec

This commit is contained in:
Karol Kosek 2023-09-03 00:31:07 +02:00 committed by Andrew Kaster
parent 4a92d712ea
commit 642a3f85ef
2 changed files with 10 additions and 3 deletions

View file

@ -213,7 +213,7 @@ struct BodyStructureData {
HashMap<DeprecatedString, DeprecatedString> fields; HashMap<DeprecatedString, DeprecatedString> fields;
unsigned bytes { 0 }; unsigned bytes { 0 };
unsigned lines { 0 }; unsigned lines { 0 };
Optional<Envelope> envelope; Optional<Tuple<Envelope, NonnullOwnPtr<BodyStructure>>> contanied_message;
Optional<DeprecatedString> md5 {}; Optional<DeprecatedString> md5 {};
Optional<Tuple<DeprecatedString, HashMap<DeprecatedString, DeprecatedString>>> disposition {}; Optional<Tuple<DeprecatedString, HashMap<DeprecatedString, DeprecatedString>>> disposition {};

View file

@ -453,11 +453,18 @@ BodyStructure Parser::parse_one_part_body()
// NOTE: "media-text SP body-fields" part is already parsed. // NOTE: "media-text SP body-fields" part is already parsed.
consume(" "sv); consume(" "sv);
data.lines = MUST(parse_number()); data.lines = MUST(parse_number());
} else if (data.type.equals_ignoring_ascii_case("MESSAGE"sv) && data.subtype.equals_ignoring_ascii_case("RFC822"sv)) { } else if (data.type.equals_ignoring_ascii_case("MESSAGE"sv) && data.subtype.is_one_of_ignoring_ascii_case("RFC822"sv, "GLOBAL"sv)) {
// body-type-msg // body-type-msg
// NOTE: "media-message SP body-fields" part is already parsed. // NOTE: "media-message SP body-fields" part is already parsed.
consume(" "sv); consume(" "sv);
data.envelope = parse_envelope(); auto envelope = parse_envelope();
consume(" ("sv);
auto body = parse_body_structure();
data.contanied_message = Tuple { move(envelope), make<BodyStructure>(move(body)) };
consume(" "sv);
data.lines = MUST(parse_number());
} else { } else {
// body-type-basic // body-type-basic
// NOTE: "media-basic SP body-fields" is already parsed. // NOTE: "media-basic SP body-fields" is already parsed.