From bc946633e0bcae5fe63528ad743bcc67de7e347d Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Wed, 11 Oct 2023 21:49:37 +0200 Subject: created a Parser class --- src/operator-login.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/operator-login.cc') diff --git a/src/operator-login.cc b/src/operator-login.cc index cef8acb..bfe6169 100644 --- a/src/operator-login.cc +++ b/src/operator-login.cc @@ -81,7 +81,7 @@ Operator::ProcessResult LoginOperator::process(Depot &depot, Request &command) return Operator::ProcessResult::NOTHING; } -Parser::ParseResult LoginOperator::parse(Request &c_in) +Parser::ParseResult LoginOperator::parse(Request &c_in, Parser &p) { constexpr auto ACCEPT = Parser::ParseResult::ACCEPT; @@ -90,31 +90,31 @@ Parser::ParseResult LoginOperator::parse(Request &c_in) if (c_in.getUidMode()) return Parser::ParseResult::REJECT; Parser::ParseResult res; - if ((res = expectSPACE()) != ACCEPT) { + if ((res = p.expectSPACE()) != ACCEPT) { session.setLastError("Expected single SPACE after LOGIN"); return res; } std::string userid; - if ((res = expectAstring(userid)) != ACCEPT) { + if ((res = p.expectAstring(userid)) != ACCEPT) { session.setLastError("Expected userid after LOGIN SPACE"); return res; } c_in.setUserID(userid); - if ((res = expectSPACE()) != ACCEPT) { + if ((res = p.expectSPACE()) != ACCEPT) { session.setLastError("Expected SPACE after LOGIN SPACE userid"); return res; } std::string password; - if ((res = expectAstring(password)) != ACCEPT) { + if ((res = p.expectAstring(password)) != ACCEPT) { session.setLastError("Expected password after LOGIN " "SPACE userid SPACE"); return res; } - if ((res = expectCRLF()) != ACCEPT) { + if ((res = p.expectCRLF()) != ACCEPT) { session.setLastError("Expected CRLF after password"); return res; } -- cgit v1.2.3