summaryrefslogtreecommitdiff
path: root/src/operator-status.cc
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 21:49:37 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 21:49:37 +0200
commitbc946633e0bcae5fe63528ad743bcc67de7e347d (patch)
tree7a3d127148c13d84e92f38c319fb5aad1e88a6cb /src/operator-status.cc
parent3ea7edf8c9bf7583c426178d4aaff4fb5b736bd2 (diff)
created a Parser class
Diffstat (limited to 'src/operator-status.cc')
-rw-r--r--src/operator-status.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/operator-status.cc b/src/operator-status.cc
index da37a55..4c2588f 100644
--- a/src/operator-status.cc
+++ b/src/operator-status.cc
@@ -75,7 +75,7 @@ Operator::ProcessResult StatusOperator::process(Depot &depot, Request &command)
return ProcessResult::OK;
}
-Parser::ParseResult StatusOperator::parse(Request &c_in)
+Parser::ParseResult StatusOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
@@ -84,54 +84,54 @@ Parser::ParseResult StatusOperator::parse(Request &c_in)
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
std::string mailbox;
- if ((res = expectMailbox(mailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox");
return res;
}
c_in.setMailbox(mailbox);
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectThisString("(")) != ACCEPT) {
+ if ((res = p.expectThisString("(")) != ACCEPT) {
session.setLastError("Expected (");
return res;
}
while (1) {
- if ((res = expectThisString("MESSAGES")) == ACCEPT) {
+ if ((res = p.expectThisString("MESSAGES")) == ACCEPT) {
c_in.getStatuses().push_back("MESSAGES");
- } else if ((res = expectThisString("RECENT")) == ACCEPT) {
+ } else if ((res = p.expectThisString("RECENT")) == ACCEPT) {
c_in.getStatuses().push_back("RECENT");
- } else if ((res = expectThisString("UIDNEXT")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UIDNEXT")) == ACCEPT) {
c_in.getStatuses().push_back("UIDNEXT");
- } else if ((res = expectThisString("UIDVALIDITY")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UIDVALIDITY")) == ACCEPT) {
c_in.getStatuses().push_back("UIDVALIDITY");
- } else if ((res = expectThisString("UNSEEN")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UNSEEN")) == ACCEPT) {
c_in.getStatuses().push_back("UNSEEN");
} else {
session.setLastError("Expected status_att");
return res;
}
- if (expectSPACE() != ACCEPT) break;
+ if (p.expectSPACE() != ACCEPT) break;
}
- if ((res = expectThisString(")")) != ACCEPT) {
+ if ((res = p.expectThisString(")")) != ACCEPT) {
session.setLastError("Expected )");
return res;
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF");
return Parser::ParseResult::ERROR;
}