diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-10-11 19:28:50 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-10-11 19:28:50 +0200 |
commit | 3ea7edf8c9bf7583c426178d4aaff4fb5b736bd2 (patch) | |
tree | ae78ebf9e9d1f70da8a6fdad1504063644ee8f1e /src/operator-copy.cc | |
parent | 1a7c572099edf744d6bb67318cff215de3fcd897 (diff) |
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/operator-copy.cc')
-rw-r--r-- | src/operator-copy.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/operator-copy.cc b/src/operator-copy.cc index 06204b2..b2aaa62 100644 --- a/src/operator-copy.cc +++ b/src/operator-copy.cc @@ -28,7 +28,7 @@ const string CopyOperator::getName() const return "COPY"; } -int CopyOperator::getState() const +Session::State CopyOperator::getState() const { return Session::SELECTED; } @@ -46,7 +46,7 @@ Operator::ProcessResult CopyOperator::process(Depot &depot, Request &command) if (destMailbox == nullptr) { session.setResponseCode("TRYCREATE"); session.setLastError("invalid mailbox " + toImapString(dmailbox)); - return NO; + return Operator::ProcessResult::NO; } unsigned int mode = Mailbox::SKIP_EXPUNGED; @@ -103,14 +103,14 @@ Operator::ProcessResult CopyOperator::process(Depot &depot, Request &command) if (!success && !destMailbox->rollBackNewMessages()) { session.setLastError("Failed to rollback after unsuccessful copy: " + destMailbox->getLastError()); - return NO; + return Operator::ProcessResult::NO; } if (success) { if (!destMailbox->commitNewMessages(depot.mailboxToFilename(toCanonMailbox(dmailbox)))) { session.setLastError("Failed to commit after successful copy: " + destMailbox->getLastError()); - return NO; + return Operator::ProcessResult::NO; } } @@ -120,14 +120,16 @@ Operator::ProcessResult CopyOperator::process(Depot &depot, Request &command) "more information."); } - return success ? OK : NO; + return success ? Operator::ProcessResult::OK : Operator::ProcessResult::NO; } -Operator::ParseResult CopyOperator::parse(Request &c_in) const +Parser::ParseResult CopyOperator::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 after COPY"); return res; |