summaryrefslogtreecommitdiff
path: root/src/operator-status.cc
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 19:28:50 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 19:28:50 +0200
commit3ea7edf8c9bf7583c426178d4aaff4fb5b736bd2 (patch)
treeae78ebf9e9d1f70da8a6fdad1504063644ee8f1e /src/operator-status.cc
parent1a7c572099edf744d6bb67318cff215de3fcd897 (diff)
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/operator-status.cc')
-rw-r--r--src/operator-status.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/operator-status.cc b/src/operator-status.cc
index 0cc5341..da37a55 100644
--- a/src/operator-status.cc
+++ b/src/operator-status.cc
@@ -33,9 +33,9 @@ const std::string StatusOperator::getName() const
return "STATUS";
}
-int StatusOperator::getState() const
+Session::State StatusOperator::getState() const
{
- return Session::AUTHENTICATED | Session::SELECTED;
+ return Session::State(Session::AUTHENTICATED | Session::SELECTED);
}
Operator::ProcessResult StatusOperator::process(Depot &depot, Request &command)
@@ -45,7 +45,7 @@ Operator::ProcessResult StatusOperator::process(Depot &depot, Request &command)
Status status;
if (!depot.getStatus(command.getMailbox(), status)) {
session.setLastError(depot.getLastError());
- return NO;
+ return ProcessResult::NO;
}
bincClient << "* STATUS " << toImapString(command.getMailbox()) << " (";
@@ -72,16 +72,18 @@ Operator::ProcessResult StatusOperator::process(Depot &depot, Request &command)
}
bincClient << ")" << std::endl;
- return OK;
+ return ProcessResult::OK;
}
-Operator::ParseResult StatusOperator::parse(Request &c_in) const
+Parser::ParseResult StatusOperator::parse(Request &c_in)
{
+ constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
+
Session &session = Session::getInstance();
- if (c_in.getUidMode()) return REJECT;
+ if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
- Operator::ParseResult res;
+ Parser::ParseResult res;
if ((res = expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
@@ -131,7 +133,7 @@ Operator::ParseResult StatusOperator::parse(Request &c_in) const
if ((res = expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF");
- return ERROR;
+ return Parser::ParseResult::ERROR;
}
return ACCEPT;