summaryrefslogtreecommitdiff
path: root/src/operator-search.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-search.cc
parent1a7c572099edf744d6bb67318cff215de3fcd897 (diff)
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/operator-search.cc')
-rw-r--r--src/operator-search.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/operator-search.cc b/src/operator-search.cc
index c013e70..1da4ee7 100644
--- a/src/operator-search.cc
+++ b/src/operator-search.cc
@@ -485,7 +485,7 @@ const string SearchOperator::getName() const
return "SEARCH";
}
-int SearchOperator::getState() const
+Session::State SearchOperator::getState() const
{
return Session::SELECTED;
}
@@ -499,7 +499,7 @@ Operator::ProcessResult SearchOperator::process(Depot &depot, Request &command)
if (command.getCharSet() != "" && command.getCharSet() != "US-ASCII") {
session.setLastError("The " + command.getCharSet() + " charset is not supported");
session.setResponseCode("[BADCHARSET (\"US-ASCII\")]");
- return NO;
+ return Operator::ProcessResult::NO;
}
bincClient << "* SEARCH";
@@ -524,14 +524,16 @@ Operator::ProcessResult SearchOperator::process(Depot &depot, Request &command)
}
bincClient << endl;
- return OK;
+ return Operator::ProcessResult::OK;
}
-Operator::ParseResult SearchOperator::parse(Request &c_in) const
+Parser::ParseResult SearchOperator::parse(Request &c_in)
{
+ constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
+
Session &session = Session::getInstance();
- Operator::ParseResult res;
+ Parser::ParseResult res;
if ((res = expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
@@ -587,10 +589,12 @@ Operator::ParseResult SearchOperator::parse(Request &c_in) const
return ACCEPT;
}
-Operator::ParseResult SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
+Parser::ParseResult SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
{
+ constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
+
Session &session = Session::getInstance();
- Operator::ParseResult res;
+ Parser::ParseResult res;
s_in.type = BincImapParserSearchKey::KEY_OTHER;
if ((res = expectThisString("ALL")) == ACCEPT) {
@@ -913,7 +917,7 @@ Operator::ParseResult SearchOperator::expectSearchKey(BincImapParserSearchKey &s
return res;
}
} else {
- return REJECT;
+ return Parser::ParseResult::REJECT;
}
return ACCEPT;