summaryrefslogtreecommitdiff
path: root/src/operator-login.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-login.cc
parent1a7c572099edf744d6bb67318cff215de3fcd897 (diff)
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/operator-login.cc')
-rw-r--r--src/operator-login.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/operator-login.cc b/src/operator-login.cc
index db091aa..cef8acb 100644
--- a/src/operator-login.cc
+++ b/src/operator-login.cc
@@ -34,7 +34,7 @@ const std::string LoginOperator::getName() const
return "LOGIN";
}
-int LoginOperator::getState() const
+Session::State LoginOperator::getState() const
{
return Session::NONAUTHENTICATED;
}
@@ -46,7 +46,7 @@ Operator::ProcessResult LoginOperator::process(Depot &depot, Request &command)
if (!session.command.ssl && !session.hasEnv("ALLOW_NONSSL_PLAINTEXT_LOGINS")) {
session.setLastError("Plain text password authentication is disallowd. "
"Please enable StartTLS or TLS in your mail client.");
- return NO;
+ return Operator::ProcessResult::NO;
}
session.setEnv("BINCIMAP_LOGIN", "LOGIN+" + command.getTag());
@@ -57,13 +57,13 @@ Operator::ProcessResult LoginOperator::process(Depot &depot, Request &command)
session.setLastError("An internal error occurred when you attempted "
"to log in to the IMAP server. Please contact "
"your system administrator.");
- return NO;
+ return Operator::ProcessResult::NO;
case 2:
session.setLastError("Login failed. Either your user name "
"or your password was wrong. Please try again, "
"and if the problem persists, please contact "
"your system administrator.");
- return NO;
+ return Operator::ProcessResult::NO;
case 3:
bincClient << "* BYE Timeout after " << IDLE_TIMEOUT << " seconds of inactivity."
<< std::endl;
@@ -78,16 +78,18 @@ Operator::ProcessResult LoginOperator::process(Depot &depot, Request &command)
// go to logout
session.setState(Session::LOGOUT);
- return NOTHING;
+ return Operator::ProcessResult::NOTHING;
}
-Operator::ParseResult LoginOperator::parse(Request &c_in) const
+Parser::ParseResult LoginOperator::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 single SPACE after LOGIN");
return res;