summaryrefslogtreecommitdiff
path: root/src/operator-select.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/operator-select.cc')
-rw-r--r--src/operator-select.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/operator-select.cc b/src/operator-select.cc
index de16e5e..5d30bbd 100644
--- a/src/operator-select.cc
+++ b/src/operator-select.cc
@@ -30,9 +30,10 @@ const string SelectOperator::getName() const
return "SELECT";
}
-int SelectOperator::getState() const
+Session::State SelectOperator::getState() const
{
- return Session::NONAUTHENTICATED | Session::AUTHENTICATED | Session::SELECTED;
+ return Session::State(Session::NONAUTHENTICATED | Session::AUTHENTICATED
+ | Session::SELECTED);
}
Operator::ProcessResult SelectOperator::process(Depot &depot, Request &command)
@@ -53,7 +54,7 @@ Operator::ProcessResult SelectOperator::process(Depot &depot, Request &command)
mailbox = depot.get(canonmailbox);
if (mailbox == nullptr) {
session.setLastError(depot.getLastError());
- return NO;
+ return ProcessResult::NO;
}
mailbox->setReadOnly(examine);
@@ -61,7 +62,7 @@ Operator::ProcessResult SelectOperator::process(Depot &depot, Request &command)
if (!mailbox->selectMailbox(canonmailbox, depot.mailboxToFilename(canonmailbox))) {
bincWarning << "selecting mailbox failed: " << mailbox->getLastError() << endl;
session.setLastError(mailbox->getLastError());
- return NO;
+ return ProcessResult::NO;
}
// find first unseen
@@ -94,8 +95,8 @@ Operator::ProcessResult SelectOperator::process(Depot &depot, Request &command)
// uidnext
bincClient << "*"
- << " OK [UIDNEXT " << toString(mailbox->getUidNext()) << "] "
- << toString(mailbox->getUidNext()) << " is the next UID" << endl;
+ << " OK [UIDNEXT " << std::to_string(mailbox->getUidNext()) << "] "
+ << std::to_string(mailbox->getUidNext()) << " is the next UID" << endl;
// flags
bincClient << "*"
@@ -110,16 +111,18 @@ Operator::ProcessResult SelectOperator::process(Depot &depot, Request &command)
depot.setSelected(mailbox);
session.setResponseCode(examine ? "READ-ONLY" : "READ-WRITE");
- return OK;
+ return ProcessResult::OK;
}
-Operator::ParseResult SelectOperator::parse(Request &c_in) const
+Parser::ParseResult SelectOperator::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 after" + c_in.getName());
return res;