summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-07-24 21:08:46 +0100
committerLinus Groh <mail@linusgroh.de>2021-07-24 22:22:41 +0100
commit66e47d05c5f3d2a0c403017e3c96d70a4988828a (patch)
treedddcb9443160ca2f2cdfa86031e4e23c3a5a4c54
parent73a9d2ec32ea2734260691b2857a4b1704077e53 (diff)
downloadserenity-66e47d05c5f3d2a0c403017e3c96d70a4988828a.zip
LibIMAP: Parse OK [CLOSED]
In my case the mail server responded with the following after selecting a mailbox (in the Mail application): * OK [CLOSED] Previous mailbox closed. * FLAGS (\Answered \Flagged ...) * OK [PERMANENTFLAGS (\Answered \Flagged ... \*)] Flags permitted. * 2 EXISTS * 0 RECENT * OK [UIDVALIDITY 1234567890] UIDs valid * OK [UIDNEXT 12345] Predicted next UID * OK [HIGHESTMODSEQ 123456] Highest A6 OK [READ-WRITE] Select completed (0.002 secs). The [CLOSED] part threw the parser off as it was expecting a space after the atom following the opening bracket, which would actually lead to a crash of Mail (AK::Optional::value() without value).
-rw-r--r--Userland/Libraries/LibIMAP/Parser.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Userland/Libraries/LibIMAP/Parser.cpp b/Userland/Libraries/LibIMAP/Parser.cpp
index 40782d776b..ac7691a983 100644
--- a/Userland/Libraries/LibIMAP/Parser.cpp
+++ b/Userland/Libraries/LibIMAP/Parser.cpp
@@ -164,17 +164,22 @@ void Parser::parse_untagged()
consume(" ");
if (try_consume("[")) {
auto actual_type = parse_atom();
- consume(" ");
- if (actual_type == "UIDNEXT"sv) {
+ if (actual_type == "CLOSED"sv) {
+ // No-op.
+ } else if (actual_type == "UIDNEXT"sv) {
+ consume(" ");
auto n = parse_number();
m_response.data().set_uid_next(n);
} else if (actual_type == "UIDVALIDITY"sv) {
+ consume(" ");
auto n = parse_number();
m_response.data().set_uid_validity(n);
} else if (actual_type == "UNSEEN"sv) {
+ consume(" ");
auto n = parse_number();
m_response.data().set_unseen(n);
} else if (actual_type == "PERMANENTFLAGS"sv) {
+ consume(" ");
auto flags = parse_list(+[](StringView x) { return String(x); });
m_response.data().set_permanent_flags(move(flags));
} else {