summaryrefslogtreecommitdiff
path: root/src/operator-id.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-id.cc
parent1a7c572099edf744d6bb67318cff215de3fcd897 (diff)
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/operator-id.cc')
-rw-r--r--src/operator-id.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/operator-id.cc b/src/operator-id.cc
index db5b79b..4d72320 100644
--- a/src/operator-id.cc
+++ b/src/operator-id.cc
@@ -27,9 +27,10 @@ const std::string IdOperator::getName() const
return "ID";
}
-int IdOperator::getState() const
+Session::State IdOperator::getState() const
{
- return Session::NONAUTHENTICATED | Session::AUTHENTICATED | Session::SELECTED;
+ return Session::State(Session::NONAUTHENTICATED | Session::AUTHENTICATED
+ | Session::SELECTED);
}
Operator::ProcessResult IdOperator::process(Depot &depot, Request &command)
@@ -37,16 +38,18 @@ Operator::ProcessResult IdOperator::process(Depot &depot, Request &command)
bincClient << "* ID (\"name\" \"Binc IMAP\""
<< " \"version\" \"" << BINC_VERSION "\")" << std::endl;
- return OK;
+ return Operator::ProcessResult::OK;
}
-Operator::ParseResult IdOperator::parse(Request &c_in) const
+Parser::ParseResult IdOperator::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 && (res = expectCRLF()) != ACCEPT) {
session.setLastError("Expected SPACE or CRLF");
return res;