summaryrefslogtreecommitdiff
path: root/src/operator-copy.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-copy.cc
parent1a7c572099edf744d6bb67318cff215de3fcd897 (diff)
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/operator-copy.cc')
-rw-r--r--src/operator-copy.cc16
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;