From 3ea7edf8c9bf7583c426178d4aaff4fb5b736bd2 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Wed, 11 Oct 2023 19:28:50 +0200 Subject: use some enum classes move ParseResult to recursivedescent.h --- src/operator-unsubscribe.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/operator-unsubscribe.cc') 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; } -- cgit v1.2.3