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-unsubscribe.cc | |
parent | 1a7c572099edf744d6bb67318cff215de3fcd897 (diff) |
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/operator-unsubscribe.cc')
-rw-r--r-- | src/operator-unsubscribe.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/operator-unsubscribe.cc b/src/operator-unsubscribe.cc index 34b12a0..cafa10a 100644 --- a/src/operator-unsubscribe.cc +++ b/src/operator-unsubscribe.cc @@ -29,9 +29,9 @@ const string UnsubscribeOperator::getName() const return "UNSUBSCRIBE"; } -int UnsubscribeOperator::getState() const +Session::State UnsubscribeOperator::getState() const { - return Session::AUTHENTICATED | Session::SELECTED; + return Session::State(Session::AUTHENTICATED | Session::SELECTED); } Operator::ProcessResult UnsubscribeOperator::process(Depot &depot, Request &command) @@ -43,38 +43,38 @@ Operator::ProcessResult UnsubscribeOperator::process(Depot &depot, Request &comm if (!depot.unsubscribeTo(canonmailbox)) { Session &session = Session::getInstance(); session.setLastError("Not subscribed to " + toImapString(mailbox)); - return NO; + return ProcessResult::NO; } depot.saveSubscribes(); - return OK; + return ProcessResult::OK; } -Operator::ParseResult UnsubscribeOperator::parse(Request &c_in) const +Parser::ParseResult UnsubscribeOperator::parse(Request &c_in) { Session &session = Session::getInstance(); - if (c_in.getUidMode()) return REJECT; + if (c_in.getUidMode()) return Parser::ParseResult::REJECT; - Operator::ParseResult res; - if ((res = expectSPACE()) != ACCEPT) { + Parser::ParseResult res; + if ((res = expectSPACE()) != Parser::ParseResult::ACCEPT) { session.setLastError("Expected SPACE"); return res; } string mailbox; - if ((res = expectMailbox(mailbox)) != ACCEPT) { + if ((res = expectMailbox(mailbox)) != Parser::ParseResult::ACCEPT) { session.setLastError("Expected mailbox"); return res; } - if ((res = expectCRLF()) != ACCEPT) { + if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) { session.setLastError("Expected CRLF"); return res; } c_in.setMailbox(mailbox); - return ACCEPT; + return Parser::ParseResult::ACCEPT; } |