summaryrefslogtreecommitdiff
path: root/src/operator-rename.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-rename.cc
parent1a7c572099edf744d6bb67318cff215de3fcd897 (diff)
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/operator-rename.cc')
-rw-r--r--src/operator-rename.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/operator-rename.cc b/src/operator-rename.cc
index c6c01f6..b8298f8 100644
--- a/src/operator-rename.cc
+++ b/src/operator-rename.cc
@@ -29,9 +29,9 @@ const string RenameOperator::getName() const
return "RENAME";
}
-int RenameOperator::getState() const
+Session::State RenameOperator::getState() const
{
- return Session::AUTHENTICATED | Session::SELECTED;
+ return Session::State(Session::AUTHENTICATED | Session::SELECTED);
}
Operator::ProcessResult RenameOperator::process(Depot &depot, Request &command)
@@ -48,27 +48,29 @@ Operator::ProcessResult RenameOperator::process(Depot &depot, Request &command)
session.setLastError("Sorry, renaming INBOX is not yet supported"
" by this IMAP server. Try copying the messages"
" instead");
- return NO;
+ return Operator::ProcessResult::NO;
}
if (canondestmailbox == "INBOX") {
session.setLastError("It is not allowed to rename a mailbox to INBOX");
- return NO;
+ return Operator::ProcessResult::NO;
}
if (depot.renameMailbox(canonmailbox, canondestmailbox))
- return OK;
+ return Operator::ProcessResult::OK;
else
- return NO;
+ return Operator::ProcessResult::NO;
}
-Operator::ParseResult RenameOperator::parse(Request &c_in) const
+Parser::ParseResult RenameOperator::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 RENAME");
return res;