summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile2
-rw-r--r--src/broker.cc25
-rw-r--r--src/imapserver.cc2
-rw-r--r--src/include/broker.h5
-rw-r--r--src/include/operators.h66
-rw-r--r--src/include/recursivedescent.h78
-rw-r--r--src/operator-append.cc24
-rw-r--r--src/operator-authenticate.cc8
-rw-r--r--src/operator-capability.cc4
-rw-r--r--src/operator-check.cc4
-rw-r--r--src/operator-close.cc4
-rw-r--r--src/operator-copy.cc12
-rw-r--r--src/operator-create.cc8
-rw-r--r--src/operator-delete.cc8
-rw-r--r--src/operator-expunge.cc4
-rw-r--r--src/operator-fetch.cc115
-rw-r--r--src/operator-id.cc4
-rw-r--r--src/operator-idle.cc6
-rw-r--r--src/operator-list.cc12
-rw-r--r--src/operator-login.cc12
-rw-r--r--src/operator-logout.cc4
-rw-r--r--src/operator-lsub.cc12
-rw-r--r--src/operator-namespace.cc4
-rw-r--r--src/operator-noop.cc4
-rw-r--r--src/operator-rename.cc12
-rw-r--r--src/operator-search.cc195
-rw-r--r--src/operator-select.cc8
-rw-r--r--src/operator-starttls.cc4
-rw-r--r--src/operator-status.cc26
-rw-r--r--src/operator-store.cc30
-rw-r--r--src/operator-subscribe.cc8
-rw-r--r--src/operator-unsubscribe.cc8
-rw-r--r--src/recursivedescent.cc100
33 files changed, 395 insertions, 423 deletions
diff --git a/src/Makefile b/src/Makefile
index 20a6c07..634ad9a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,7 +3,7 @@
SHELL=/bin/sh
CXX = c++
-CXXFLAGS = -Og -Iinclude -Wall
+CXXFLAGS = -Og -std=c++17 -Iinclude -Wall
#LIBDL = -ldl
bincimapd_OBJECTS = bincimapd.o address.o argparser.o authenticate.o base64.o \
diff --git a/src/broker.cc b/src/broker.cc
index 4fa9ec8..3270702 100644
--- a/src/broker.cc
+++ b/src/broker.cc
@@ -8,21 +8,18 @@
#include "broker.h"
#include "convert.h"
-#include "operators.h"
-#include "recursivedescent.h"
-#include "session.h"
-
-#include <map>
-#include <string>
using namespace Binc;
using std::string;
BrokerFactory::BrokerFactory()
{
- brokers[Session::State::NONAUTHENTICATED] = new Broker();
- brokers[Session::State::AUTHENTICATED] = new Broker();
- brokers[Session::State::SELECTED] = new Broker();
+ auto &session = Session::getInstance();
+ Parser p(session);
+
+ brokers[Session::State::NONAUTHENTICATED] = new Broker(p);
+ brokers[Session::State::AUTHENTICATED] = new Broker(p);
+ brokers[Session::State::SELECTED] = new Broker(p);
}
BrokerFactory::~BrokerFactory()
@@ -102,7 +99,7 @@ Parser::ParseResult Broker::parseStub(Request &command)
string tag;
string cmd;
- switch (expectTag(tag)) {
+ switch (parser.expectTag(tag)) {
case ACCEPT:
break;
case REJECT:
@@ -114,7 +111,7 @@ Parser::ParseResult Broker::parseStub(Request &command)
return TIMEOUT;
}
- switch (expectSPACE()) {
+ switch (parser.expectSPACE()) {
case ACCEPT:
break;
case REJECT:
@@ -126,7 +123,7 @@ Parser::ParseResult Broker::parseStub(Request &command)
return TIMEOUT;
}
- switch (expectAstring(cmd)) {
+ switch (parser.expectAstring(cmd)) {
case ACCEPT:
break;
case REJECT:
@@ -143,7 +140,7 @@ Parser::ParseResult Broker::parseStub(Request &command)
if (cmd == "UID") {
command.setUidMode();
- switch (expectSPACE()) {
+ switch (parser.expectSPACE()) {
case ACCEPT:
break;
case REJECT:
@@ -155,7 +152,7 @@ Parser::ParseResult Broker::parseStub(Request &command)
return TIMEOUT;
}
- switch (expectAstring(cmd)) {
+ switch (parser.expectAstring(cmd)) {
case ACCEPT:
break;
case REJECT:
diff --git a/src/imapserver.cc b/src/imapserver.cc
index c4c0d70..e3e5327 100644
--- a/src/imapserver.cc
+++ b/src/imapserver.cc
@@ -116,7 +116,7 @@ int IMAPServer::run()
session.setLastError(err);
skipToNextRequest = true;
} else {
- Parser::ParseResult parseResult = o->parse(clientRequest);
+ Parser::ParseResult parseResult = o->parse(clientRequest, broker->parser);
if (parseResult == Parser::ParseResult::TIMEOUT) {
serverStatus = ServerStatus::Timeout;
} else if (parseResult == Parser::ParseResult::REJECT) {
diff --git a/src/include/broker.h b/src/include/broker.h
index 0ead7a0..57c79dc 100644
--- a/src/include/broker.h
+++ b/src/include/broker.h
@@ -10,6 +10,7 @@
#include "depot.h"
#include "operators.h"
+#include "recursivedescent.h"
#include "session.h"
#include <map>
@@ -57,11 +58,13 @@ namespace Binc {
std::map<std::string, bool> deletables;
public:
+ Parser &parser;
+
Operator *get(const std::string &name) const;
void assign(const std::string &fname, Operator *o, bool deletable = false);
Parser::ParseResult parseStub(Request &cmd);
- Broker() = default;
+ Broker(Parser &p) : parser(p){};
Broker(Broker &&) = default;
};
diff --git a/src/include/operators.h b/src/include/operators.h
index bc03607..fe28680 100644
--- a/src/include/operators.h
+++ b/src/include/operators.h
@@ -23,7 +23,7 @@ namespace Binc {
enum class ProcessResult { OK, BAD, NO, NOTHING, ABORT };
virtual ProcessResult process(Depot &, Request &) = 0;
- virtual Parser::ParseResult parse(Request &) = 0;
+ virtual Parser::ParseResult parse(Request &, Parser &) = 0;
virtual Session::State getState() const = 0;
virtual const std::string getName() const = 0;
@@ -32,7 +32,7 @@ namespace Binc {
struct AppendOperator : public Operator {
ProcessResult process(Depot &, Request &) final;
- Parser::ParseResult parse(Request &) final;
+ Parser::ParseResult parse(Request &, Parser &) final;
const std::string getName() const final;
Session::State getState() const final;
@@ -43,7 +43,7 @@ namespace Binc {
class AuthenticateOperator : public Operator {
public:
ProcessResult process(Depot &, Request &) override;
- virtual Parser::ParseResult parse(Request &) override;
+ virtual Parser::ParseResult parse(Request &, Parser &) override;
const std::string getName() const override;
Session::State getState() const override;
@@ -61,7 +61,7 @@ namespace Binc {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -75,7 +75,7 @@ namespace Binc {
class CheckOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -87,7 +87,7 @@ namespace Binc {
class CreateOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -99,7 +99,7 @@ namespace Binc {
class CloseOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -111,7 +111,7 @@ namespace Binc {
class CopyOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -123,7 +123,7 @@ namespace Binc {
class DeleteOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -135,7 +135,7 @@ namespace Binc {
class ExpungeOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -146,15 +146,15 @@ namespace Binc {
class FetchOperator : public Operator {
protected:
- Parser::ParseResult expectSectionText(BincImapParserFetchAtt &f_in) const;
- Parser::ParseResult expectSection(BincImapParserFetchAtt &f_in) const;
- Parser::ParseResult expectFetchAtt(BincImapParserFetchAtt &f_in) const;
- Parser::ParseResult expectOffset(BincImapParserFetchAtt &f_in) const;
- Parser::ParseResult expectHeaderList(BincImapParserFetchAtt &f_in) const;
+ Parser::ParseResult expectSectionText(BincImapParserFetchAtt &f_in, Parser &p) const;
+ Parser::ParseResult expectSection(BincImapParserFetchAtt &f_in, Parser &p) const;
+ Parser::ParseResult expectFetchAtt(BincImapParserFetchAtt &f_in, Parser &p) const;
+ Parser::ParseResult expectOffset(BincImapParserFetchAtt &f_in, Parser &p) const;
+ Parser::ParseResult expectHeaderList(BincImapParserFetchAtt &f_in, Parser &p) const;
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -166,7 +166,7 @@ namespace Binc {
class IdOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -185,7 +185,7 @@ namespace Binc {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -208,7 +208,7 @@ namespace Binc {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -220,7 +220,7 @@ namespace Binc {
class LoginOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -232,7 +232,7 @@ namespace Binc {
class LogoutOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -244,7 +244,7 @@ namespace Binc {
class LsubOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -256,7 +256,7 @@ namespace Binc {
class NamespaceOperator : public Operator {
public:
virtual ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -268,7 +268,7 @@ namespace Binc {
class NoopOperator : public Operator {
public:
virtual ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -288,7 +288,7 @@ namespace Binc {
class RenameOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -299,7 +299,7 @@ namespace Binc {
class SearchOperator : public Operator {
protected:
- Parser::ParseResult expectSearchKey(BincImapParserSearchKey &s_in) const;
+ Parser::ParseResult expectSearchKey(BincImapParserSearchKey &s_in, Parser &p) const;
class SearchNode {
std::string date;
@@ -384,7 +384,7 @@ namespace Binc {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -396,7 +396,7 @@ namespace Binc {
class SelectOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -415,7 +415,7 @@ namespace Binc {
class StarttlsOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -430,7 +430,7 @@ namespace Binc {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -442,7 +442,7 @@ namespace Binc {
class StoreOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -454,7 +454,7 @@ namespace Binc {
class SubscribeOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
@@ -466,7 +466,7 @@ namespace Binc {
class UnsubscribeOperator : public Operator {
public:
ProcessResult process(Depot &, Request &);
- virtual Parser::ParseResult parse(Request &);
+ virtual Parser::ParseResult parse(Request &, Parser &);
const std::string getName() const;
Session::State getState() const;
diff --git a/src/include/recursivedescent.h b/src/include/recursivedescent.h
index 1200211..bf1fee4 100644
--- a/src/include/recursivedescent.h
+++ b/src/include/recursivedescent.h
@@ -9,63 +9,67 @@
#define expectcommand_h_inluded
#include "imapparser.h"
+#include "session.h"
#include <stack>
#include <string>
namespace Binc {
- extern std::stack<int> inputBuffer;
- extern int charnr;
+ class Parser {
+ std::stack<int> inputBuffer;
+ int charnr;
+ Session &session;
- int readChar();
- void unReadChar(int c_in);
- void unReadChar(const std::string &s_in);
+ public:
+ Parser(Session &session) : charnr(0), session(session){};
+ Parser(const Parser &) = delete;
- namespace Parser {
- enum class ParseResult { ACCEPT, REJECT, ERROR, TIMEOUT };
- }
+ int readChar();
+ void unReadChar(int c_in);
+ void unReadChar(const std::string &s_in);
- using ParseResult = Parser::ParseResult;
+ enum class ParseResult { ACCEPT, REJECT, ERROR, TIMEOUT };
- ParseResult expectTag(std::string &s_in);
- ParseResult expectTagChar(int &c_in);
- ParseResult expectSPACE();
+ ParseResult expectTag(std::string &s_in);
+ ParseResult expectTagChar(int &c_in);
+ ParseResult expectSPACE();
- ParseResult expectFlag(std::vector<std::string> &v_in);
+ ParseResult expectFlag(std::vector<std::string> &v_in);
- ParseResult expectListMailbox(std::string &s_in);
- ParseResult expectListWildcards(int &c_in);
+ ParseResult expectListMailbox(std::string &s_in);
+ ParseResult expectListWildcards(int &c_in);
- ParseResult expectDateTime(std::string &s_in);
- ParseResult expectTime(std::string &s_in);
- ParseResult expectZone(std::string &s_in);
+ ParseResult expectDateTime(std::string &s_in);
+ ParseResult expectTime(std::string &s_in);
+ ParseResult expectZone(std::string &s_in);
- ParseResult expectMailbox(std::string &s_in);
- ParseResult expectAstring(std::string &s_in);
- ParseResult expectAtom(std::string &s_in);
- ParseResult expectAtomChar(int &i_in);
- ParseResult expectString(std::string &s_in);
+ ParseResult expectMailbox(std::string &s_in);
+ ParseResult expectAstring(std::string &s_in);
+ ParseResult expectAtom(std::string &s_in);
+ ParseResult expectAtomChar(int &i_in);
+ ParseResult expectString(std::string &s_in);
- ParseResult expectDate(std::string &s_in);
+ ParseResult expectDate(std::string &s_in);
- ParseResult expectNumber(unsigned int &i_in);
- ParseResult expectDigit(unsigned int &i_in);
- ParseResult expectDigitNZ(unsigned int &i_in);
+ ParseResult expectNumber(unsigned int &i_in);
+ ParseResult expectDigit(unsigned int &i_in);
+ ParseResult expectDigitNZ(unsigned int &i_in);
- ParseResult expectLiteral(std::string &s_in);
- ParseResult expectQuoted(std::string &s_in);
- ParseResult expectQuotedChar(int &c_in);
+ ParseResult expectLiteral(std::string &s_in);
+ ParseResult expectQuoted(std::string &s_in);
+ ParseResult expectQuotedChar(int &c_in);
- ParseResult expectSet(SequenceSet &s_in);
- ParseResult expectSequenceNum(unsigned int &i_in);
- ParseResult expectNZNumber(unsigned int &i_in);
+ ParseResult expectSet(SequenceSet &s_in);
+ ParseResult expectSequenceNum(unsigned int &i_in);
+ ParseResult expectNZNumber(unsigned int &i_in);
- ParseResult expectCRLF();
- ParseResult expectCR();
- ParseResult expectLF();
+ ParseResult expectCRLF();
+ ParseResult expectCR();
+ ParseResult expectLF();
- ParseResult expectThisString(const std::string &s_in);
+ ParseResult expectThisString(const std::string &s_in);
+ };
}
#endif
diff --git a/src/operator-append.cc b/src/operator-append.cc
index 0e856ba..fdebad6 100644
--- a/src/operator-append.cc
+++ b/src/operator-append.cc
@@ -249,7 +249,7 @@ Operator::ProcessResult AppendOperator::process(Depot &depot, Request &command)
return ProcessResult::OK;
}
-Parser::ParseResult AppendOperator::parse(Request &c_in)
+Parser::ParseResult AppendOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
@@ -258,49 +258,49 @@ Parser::ParseResult AppendOperator::parse(Request &c_in)
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after APPEND");
return res;
}
string mailbox;
- if ((res = expectMailbox(mailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox after APPEND SPACE");
return res;
}
c_in.setMailbox(mailbox);
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after APPEND SPACE mailbox");
return res;
}
- if ((res = expectThisString("(")) == ACCEPT) {
- if ((res = expectFlag(c_in.getFlags())) == ACCEPT) {
+ if ((res = p.expectThisString("(")) == ACCEPT) {
+ if ((res = p.expectFlag(c_in.getFlags())) == ACCEPT) {
while (1) {
- if ((res = expectSPACE()) != ACCEPT) break;
- if ((res = expectFlag(c_in.getFlags())) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) break;
+ if ((res = p.expectFlag(c_in.getFlags())) != ACCEPT) {
session.setLastError("expected a flag after the '('");
return res;
}
}
}
- if ((res = expectThisString(")")) != ACCEPT) {
+ if ((res = p.expectThisString(")")) != ACCEPT) {
session.setLastError("expected a ')'");
return res;
}
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("expected a SPACE after the flag list");
return res;
}
}
string date;
- if ((res = expectDateTime(date)) == ACCEPT) {
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectDateTime(date)) == ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("expected a SPACE after date_time");
return res;
}
diff --git a/src/operator-authenticate.cc b/src/operator-authenticate.cc
index 8689b2c..63228cd 100644
--- a/src/operator-authenticate.cc
+++ b/src/operator-authenticate.cc
@@ -280,7 +280,7 @@ Operator::ProcessResult AuthenticateOperator::process(Depot &depot, Request &com
return NOTHING;
}
-Parser::ParseResult AuthenticateOperator::parse(Request &c_in)
+Parser::ParseResult AuthenticateOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
@@ -290,18 +290,18 @@ Parser::ParseResult AuthenticateOperator::parse(Request &c_in)
Parser::ParseResult res;
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected single SPACE after AUTHENTICATE");
return res;
}
string authtype;
- if ((res = expectAtom(authtype)) != ACCEPT) {
+ if ((res = p.expectAtom(authtype)) != ACCEPT) {
session.setLastError("Expected auth_type after AUTHENTICATE SPACE");
return Parser::ParseResult::ERROR;
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF after AUTHENTICATE SPACE auth_type");
return res;
}
diff --git a/src/operator-capability.cc b/src/operator-capability.cc
index 33d787a..7324025 100644
--- a/src/operator-capability.cc
+++ b/src/operator-capability.cc
@@ -73,14 +73,14 @@ Operator::ProcessResult CapabilityOperator::process(Depot &depot, Request &comma
return Operator::ProcessResult::OK;
}
-Parser::ParseResult CapabilityOperator::parse(Request &c_in)
+Parser::ParseResult CapabilityOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectCRLF()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected CRLF after CAPABILITY");
return res;
}
diff --git a/src/operator-check.cc b/src/operator-check.cc
index 2514fcc..9a282b7 100644
--- a/src/operator-check.cc
+++ b/src/operator-check.cc
@@ -42,13 +42,13 @@ Operator::ProcessResult CheckOperator::process(Depot &depot, Request &command)
return Operator::ProcessResult::OK;
}
-Parser::ParseResult CheckOperator::parse(Request &c_in)
+Parser::ParseResult CheckOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
- if (Parser::ParseResult res = expectCRLF(); res != Parser::ParseResult::ACCEPT) {
+ if (Parser::ParseResult res = p.expectCRLF(); res != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected CRLF after CHECK");
return res;
}
diff --git a/src/operator-close.cc b/src/operator-close.cc
index 37e4805..2ff0b0b 100644
--- a/src/operator-close.cc
+++ b/src/operator-close.cc
@@ -42,14 +42,14 @@ Operator::ProcessResult CloseOperator::process(Depot &depot, Request &command)
return Operator::ProcessResult::OK;
}
-Parser::ParseResult CloseOperator::parse(Request &c_in)
+Parser::ParseResult CloseOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectCRLF()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected CRLF after CLOSE");
return res;
}
diff --git a/src/operator-copy.cc b/src/operator-copy.cc
index b2aaa62..8340e4e 100644
--- a/src/operator-copy.cc
+++ b/src/operator-copy.cc
@@ -123,35 +123,35 @@ Operator::ProcessResult CopyOperator::process(Depot &depot, Request &command)
return success ? Operator::ProcessResult::OK : Operator::ProcessResult::NO;
}
-Parser::ParseResult CopyOperator::parse(Request &c_in)
+Parser::ParseResult CopyOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
Session &session = Session::getInstance();
Parser::ParseResult res;
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after COPY");
return res;
}
- if ((res = expectSet(c_in.getSet())) != ACCEPT) {
+ if ((res = p.expectSet(c_in.getSet())) != ACCEPT) {
session.setLastError("Expected sequence set after COPY SPACE");
return res;
}
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after COPY SPACE set");
return res;
}
string mailbox;
- if ((res = expectMailbox(mailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox after COPY SPACE set SPACE");
return res;
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF after COPY SPACE set SPACE mailbox");
return res;
}
diff --git a/src/operator-create.cc b/src/operator-create.cc
index 399e740..407db42 100644
--- a/src/operator-create.cc
+++ b/src/operator-create.cc
@@ -42,7 +42,7 @@ Operator::ProcessResult CreateOperator::process(Depot &depot, Request &command)
}
}
-Parser::ParseResult CreateOperator::parse(Request &c_in)
+Parser::ParseResult CreateOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
Session &session = Session::getInstance();
@@ -50,18 +50,18 @@ Parser::ParseResult CreateOperator::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 SPACE after CREATE");
return res;
}
std::string mailbox;
- if ((res = expectMailbox(mailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox after CREATE SPACE");
return res;
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF after CREATE SPACE CRLF");
return res;
}
diff --git a/src/operator-delete.cc b/src/operator-delete.cc
index a706d01..fea9917 100644
--- a/src/operator-delete.cc
+++ b/src/operator-delete.cc
@@ -42,7 +42,7 @@ Operator::ProcessResult DeleteOperator::process(Depot &depot, Request &command)
}
}
-Parser::ParseResult DeleteOperator::parse(Request &c_in)
+Parser::ParseResult DeleteOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
@@ -51,18 +51,18 @@ Parser::ParseResult DeleteOperator::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 SPACE after DELETE");
return res;
}
std::string mailbox;
- if ((res = expectMailbox(mailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox after DELETE SPACE");
return res;
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF after DELETE SPACE mailbox");
return res;
}
diff --git a/src/operator-expunge.cc b/src/operator-expunge.cc
index 0a70c2f..21e71e4 100644
--- a/src/operator-expunge.cc
+++ b/src/operator-expunge.cc
@@ -44,14 +44,14 @@ Operator::ProcessResult ExpungeOperator::process(Depot &depot, Request &command)
return Operator::ProcessResult::OK;
}
-Parser::ParseResult ExpungeOperator::parse(Request &c_in)
+Parser::ParseResult ExpungeOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectCRLF()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected CRLF");
return res;
}
diff --git a/src/operator-fetch.cc b/src/operator-fetch.cc
index 7de2fbb..d64e289 100644
--- a/src/operator-fetch.cc
+++ b/src/operator-fetch.cc
@@ -365,56 +365,56 @@ Operator::ProcessResult FetchOperator::process(Depot &depot, Request &request)
return Operator::ProcessResult::OK;
}
-Parser::ParseResult FetchOperator::parse(Request &c_in)
+Parser::ParseResult FetchOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
Parser::ParseResult res;
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after FETCH");
return res;
}
- if ((res = expectSet(c_in.getSet())) != ACCEPT) {
+ if ((res = p.expectSet(c_in.getSet())) != ACCEPT) {
session.setLastError("Expected sequence set after FETCH SPACE");
return res;
}
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after FETCH SPACE set");
return res;
}
BincImapParserFetchAtt f;
- if ((res = expectThisString("ALL")) == ACCEPT) {
+ if ((res = p.expectThisString("ALL")) == ACCEPT) {
f.type = "ALL";
c_in.fatt.push_back(f);
- } else if ((res = expectThisString("FULL")) == ACCEPT) {
+ } else if ((res = p.expectThisString("FULL")) == ACCEPT) {
f.type = "FULL";
c_in.fatt.push_back(f);
- } else if ((res = expectThisString("FAST")) == ACCEPT) {
+ } else if ((res = p.expectThisString("FAST")) == ACCEPT) {
f.type = "FAST";
c_in.fatt.push_back(f);
- } else if ((res = expectFetchAtt(f)) == ACCEPT) {
+ } else if ((res = expectFetchAtt(f, p)) == ACCEPT) {
c_in.fatt.push_back(f);
- } else if ((res = expectThisString("(")) == ACCEPT) {
+ } else if ((res = p.expectThisString("(")) == ACCEPT) {
while (1) {
BincImapParserFetchAtt ftmp;
- if ((res = expectFetchAtt(ftmp)) != ACCEPT) {
+ if ((res = expectFetchAtt(ftmp, p)) != ACCEPT) {
session.setLastError("Expected fetch_att");
return res;
}
c_in.fatt.push_back(ftmp);
- if ((res = expectSPACE()) == REJECT)
+ if ((res = p.expectSPACE()) == REJECT)
break;
else if (res == ERROR)
return ERROR;
}
- if ((res = expectThisString(")")) != ACCEPT) {
+ if ((res = p.expectThisString(")")) != ACCEPT) {
session.setLastError("Expected )");
return res;
}
@@ -423,7 +423,7 @@ Parser::ParseResult FetchOperator::parse(Request &c_in)
return res;
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF");
return res;
}
@@ -432,30 +432,31 @@ Parser::ParseResult FetchOperator::parse(Request &c_in)
return ACCEPT;
}
-Parser::ParseResult FetchOperator::expectSectionText(BincImapParserFetchAtt &f_in) const
+Parser::ParseResult FetchOperator::expectSectionText(BincImapParserFetchAtt &f_in,
+ Parser &p) const
{
Session &session = Session::getInstance();
Parser::ParseResult res;
- if ((res = expectThisString("HEADER")) == ACCEPT) {
+ if ((res = p.expectThisString("HEADER")) == ACCEPT) {
f_in.sectiontext = "HEADER";
- if ((res = expectThisString(".FIELDS")) == ACCEPT) {
+ if ((res = p.expectThisString(".FIELDS")) == ACCEPT) {
f_in.sectiontext += ".FIELDS";
- if ((res = expectThisString(".NOT")) == ACCEPT) f_in.sectiontext += ".NOT";
+ if ((res = p.expectThisString(".NOT")) == ACCEPT) f_in.sectiontext += ".NOT";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("expected SPACE");
return res;
}
- if ((res = expectHeaderList(f_in)) != ACCEPT) {
+ if ((res = expectHeaderList(f_in, p)) != ACCEPT) {
session.setLastError("Expected header_list");
return res;
}
}
- } else if ((res = expectThisString("TEXT")) == ACCEPT) {
+ } else if ((res = p.expectThisString("TEXT")) == ACCEPT) {
f_in.sectiontext = "TEXT";
} else {
return Parser::ParseResult::REJECT;
@@ -464,25 +465,25 @@ Parser::ParseResult FetchOperator::expectSectionText(BincImapParserFetchAtt &f_i
return ACCEPT;
}
-Parser::ParseResult FetchOperator::expectSection(BincImapParserFetchAtt &f_in) const
+Parser::ParseResult FetchOperator::expectSection(BincImapParserFetchAtt &f_in, Parser &p) const
{
Session &session = Session::getInstance();
Parser::ParseResult res;
- if ((res = expectThisString("[")) != ACCEPT) return REJECT;
+ if ((res = p.expectThisString("[")) != ACCEPT) return REJECT;
- if ((res = expectSectionText(f_in)) != ACCEPT) {
+ if ((res = expectSectionText(f_in, p)) != ACCEPT) {
unsigned int n;
- if ((res = expectNZNumber(n)) == ACCEPT) {
+ if ((res = p.expectNZNumber(n)) == ACCEPT) {
BincStream nstr;
nstr << n;
f_in.section = nstr.str();
bool gotadotalready = false;
while (1) {
- if ((res = expectThisString(".")) != ACCEPT) break;
+ if ((res = p.expectThisString(".")) != ACCEPT) break;
- if ((res = expectNZNumber(n)) != ACCEPT) {
+ if ((res = p.expectNZNumber(n)) != ACCEPT) {
gotadotalready = true;
break;
}
@@ -493,10 +494,10 @@ Parser::ParseResult FetchOperator::expectSection(BincImapParserFetchAtt &f_in) c
f_in.section += nstr.str();
}
- if (gotadotalready || (res = expectThisString(".")) == ACCEPT) {
- if ((res = expectThisString("MIME")) == ACCEPT) {
+ if (gotadotalready || (res = p.expectThisString(".")) == ACCEPT) {
+ if ((res = p.expectThisString("MIME")) == ACCEPT) {
f_in.sectiontext = "MIME";
- } else if ((res = expectSectionText(f_in)) != ACCEPT) {
+ } else if ((res = expectSectionText(f_in, p)) != ACCEPT) {
session.setLastError("Expected MIME or section_text");
return res;
}
@@ -504,7 +505,7 @@ Parser::ParseResult FetchOperator::expectSection(BincImapParserFetchAtt &f_in) c
}
}
- if ((res = expectThisString("]")) != ACCEPT) {
+ if ((res = p.expectThisString("]")) != ACCEPT) {
session.setLastError("Expected ]");
return res;
}
@@ -512,29 +513,30 @@ Parser::ParseResult FetchOperator::expectSection(BincImapParserFetchAtt &f_in) c
return ACCEPT;
}
-Parser::ParseResult FetchOperator::expectHeaderList(BincImapParserFetchAtt &f_in) const
+Parser::ParseResult FetchOperator::expectHeaderList(BincImapParserFetchAtt &f_in,
+ Parser &p) const
{
Session &session = Session::getInstance();
Parser::ParseResult res;
- if ((res = expectThisString("(")) != ACCEPT) return REJECT;
+ if ((res = p.expectThisString("(")) != ACCEPT) return REJECT;
string header_fld_name;
while (1) {
- if ((res = expectAstring(header_fld_name)) != ACCEPT) {
+ if ((res = p.expectAstring(header_fld_name)) != ACCEPT) {
session.setLastError("Expected header_fld_name");
return res;
}
f_in.headerlist.push_back(header_fld_name);
- if ((res = expectSPACE()) == ACCEPT)
+ if ((res = p.expectSPACE()) == ACCEPT)
continue;
else
break;
}
- if ((res = expectThisString(")")) != ACCEPT) {
+ if ((res = p.expectThisString(")")) != ACCEPT) {
session.setLastError("Expected )");
return res;
}
@@ -542,31 +544,31 @@ Parser::ParseResult FetchOperator::expectHeaderList(BincImapParserFetchAtt &f_in
return ACCEPT;
}
-Parser::ParseResult FetchOperator::expectOffset(BincImapParserFetchAtt &f_in) const
+Parser::ParseResult FetchOperator::expectOffset(BincImapParserFetchAtt &f_in, Parser &p) const
{
Session &session = Session::getInstance();
Parser::ParseResult res;
- if ((res = expectThisString("<")) != ACCEPT) return REJECT;
+ if ((res = p.expectThisString("<")) != ACCEPT) return REJECT;
unsigned int i;
- if ((res = expectNumber(i)) != ACCEPT) {
+ if ((res = p.expectNumber(i)) != ACCEPT) {
session.setLastError("Expected number");
return res;
}
- if ((res = expectThisString(".")) != ACCEPT) {
+ if ((res = p.expectThisString(".")) != ACCEPT) {
session.setLastError("Expected .");
return res;
}
unsigned int j;
- if ((res = expectNZNumber(j)) != ACCEPT) {
+ if ((res = p.expectNZNumber(j)) != ACCEPT) {
session.setLastError("expected nz_number");
return res;
}
- if ((res = expectThisString(">")) != ACCEPT) {
+ if ((res = p.expectThisString(">")) != ACCEPT) {
session.setLastError("Expected >");
return res;
}
@@ -576,47 +578,48 @@ Parser::ParseResult FetchOperator::expectOffset(BincImapParserFetchAtt &f_in) co
return ACCEPT;
}
-Parser::ParseResult FetchOperator::expectFetchAtt(BincImapParserFetchAtt &f_in) const
+Parser::ParseResult FetchOperator::expectFetchAtt(BincImapParserFetchAtt &f_in,
+ Parser &p) const
{
Parser::ParseResult res;
Session &session = Session::getInstance();
- if ((res = expectThisString("ENVELOPE")) == ACCEPT) {
+ if ((res = p.expectThisString("ENVELOPE")) == ACCEPT) {
f_in.type = "ENVELOPE";
- } else if ((res = expectThisString("FLAGS")) == ACCEPT) {
+ } else if ((res = p.expectThisString("FLAGS")) == ACCEPT) {
f_in.type = "FLAGS";
- } else if ((res = expectThisString("INTERNALDATE")) == ACCEPT) {
+ } else if ((res = p.expectThisString("INTERNALDATE")) == ACCEPT) {
f_in.type = "INTERNALDATE";
- } else if ((res = expectThisString("UID")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UID")) == ACCEPT) {
f_in.type = "UID";
- } else if ((res = expectThisString("RFC822")) == ACCEPT) {
+ } else if ((res = p.expectThisString("RFC822")) == ACCEPT) {
f_in.type = "RFC822";
- if ((res = expectThisString(".HEADER")) == ACCEPT) {
+ if ((res = p.expectThisString(".HEADER")) == ACCEPT) {
f_in.type += ".HEADER";
- } else if ((res = expectThisString(".SIZE")) == ACCEPT) {
+ } else if ((res = p.expectThisString(".SIZE")) == ACCEPT) {
f_in.type += ".SIZE";
- } else if ((res = expectThisString(".TEXT")) == ACCEPT) {
+ } else if ((res = p.expectThisString(".TEXT")) == ACCEPT) {
f_in.type += ".TEXT";
- } else if ((res = expectThisString(".")) == ACCEPT) {
+ } else if ((res = p.expectThisString(".")) == ACCEPT) {
session.setLastError("Expected RFC822, RFC822.HEADER,"
" RFC822.SIZE or RFC822.TEXT");
return ERROR;
}
- } else if ((res = expectThisString("BODY")) == ACCEPT) {
+ } else if ((res = p.expectThisString("BODY")) == ACCEPT) {
f_in.type = "BODY";
- if ((res = expectThisString("STRUCTURE")) == ACCEPT)
+ if ((res = p.expectThisString("STRUCTURE")) == ACCEPT)
f_in.type += "STRUCTURE";
- else if ((res = expectThisString(".PEEK")) == ACCEPT)
+ else if ((res = p.expectThisString(".PEEK")) == ACCEPT)
f_in.type += ".PEEK";
- if ((res = expectSection(f_in)) != ACCEPT) {
+ if ((res = expectSection(f_in, p)) != ACCEPT) {
f_in.hassection = false;
} else {
f_in.hassection = true;
- if ((res = expectOffset(f_in)) == ERROR) return ERROR;
+ if ((res = expectOffset(f_in, p)) == ERROR) return ERROR;
}
} else {
return REJECT;
diff --git a/src/operator-id.cc b/src/operator-id.cc
index 4d72320..3bc01dc 100644
--- a/src/operator-id.cc
+++ b/src/operator-id.cc
@@ -41,7 +41,7 @@ Operator::ProcessResult IdOperator::process(Depot &depot, Request &command)
return Operator::ProcessResult::OK;
}
-Parser::ParseResult IdOperator::parse(Request &c_in)
+Parser::ParseResult IdOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
@@ -50,7 +50,7 @@ Parser::ParseResult IdOperator::parse(Request &c_in)
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectSPACE()) != ACCEPT && (res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT && (res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected SPACE or CRLF");
return res;
}
diff --git a/src/operator-idle.cc b/src/operator-idle.cc
index 3ce9673..4bfc2d5 100644
--- a/src/operator-idle.cc
+++ b/src/operator-idle.cc
@@ -91,7 +91,7 @@ Operator::ProcessResult IdleOperator::process(Depot &depot, Request &command)
// when not using FNOTIFY, we need to check the session timeout.
time_t startTime = time(nullptr);
#ifdef HAVE_FNOTIFY
- ()startTime; // removes a compile warning
+ (void)startTime; // removes a compile warning
#endif
bincClient << "+ idling" << endl;
@@ -214,14 +214,14 @@ Operator::ProcessResult IdleOperator::process(Depot &depot, Request &command)
return Operator::ProcessResult::OK;
}
-Parser::ParseResult IdleOperator::parse(Request &c_in)
+Parser::ParseResult IdleOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectCRLF()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected CRLF after IDLE");
return res;
}
diff --git a/src/operator-list.cc b/src/operator-list.cc
index 519eb79..4fa3469 100644
--- a/src/operator-list.cc
+++ b/src/operator-list.cc
@@ -199,7 +199,7 @@ Operator::ProcessResult ListOperator::process(Depot &depot, Request &command)
return Operator::ProcessResult::OK;
}
-Parser::ParseResult ListOperator::parse(Request &c_in)
+Parser::ParseResult ListOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
@@ -208,32 +208,32 @@ Parser::ParseResult ListOperator::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 SPACE after LIST");
return res;
}
string mailbox;
- if ((res = expectMailbox(mailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox after LIST SPACE");
return res;
}
c_in.setMailbox(mailbox);
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after LIST SPACE mailbox");
return res;
}
string listmailbox;
- if ((res = expectListMailbox(listmailbox)) != ACCEPT) {
+ if ((res = p.expectListMailbox(listmailbox)) != ACCEPT) {
session.setLastError("Expected list_mailbox after LIST SPACE"
" mailbox SPACE");
return res;
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF after LIST SPACE mailbox"
" SPACE list_mailbox");
return res;
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;
}
diff --git a/src/operator-logout.cc b/src/operator-logout.cc
index d58972b..3c7823c 100644
--- a/src/operator-logout.cc
+++ b/src/operator-logout.cc
@@ -54,14 +54,14 @@ Operator::ProcessResult LogoutOperator::process(Depot &depot, Request &command)
return Operator::ProcessResult::NOTHING;
}
-Parser::ParseResult LogoutOperator::parse(Request &c_in)
+Parser::ParseResult LogoutOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectCRLF()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected CRLF");
return res;
}
diff --git a/src/operator-lsub.cc b/src/operator-lsub.cc
index c4d1908..242be9f 100644
--- a/src/operator-lsub.cc
+++ b/src/operator-lsub.cc
@@ -182,7 +182,7 @@ Operator::ProcessResult LsubOperator::process(Depot &depot, Request &command)
return Operator::ProcessResult::OK;
}
-Parser::ParseResult LsubOperator::parse(Request &c_in)
+Parser::ParseResult LsubOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
constexpr auto ERROR = Parser::ParseResult::ERROR;
@@ -193,32 +193,32 @@ Parser::ParseResult LsubOperator::parse(Request &c_in)
if (c_in.getUidMode()) return REJECT;
Parser::ParseResult res;
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after LSUB");
return ERROR;
}
string mailbox;
- if ((res = expectMailbox(mailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox after LSUB SPACE");
return ERROR;
}
c_in.setMailbox(mailbox);
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after LSUB SPACE mailbox");
return ERROR;
}
string listmailbox;
- if ((res = expectListMailbox(listmailbox)) != ACCEPT) {
+ if ((res = p.expectListMailbox(listmailbox)) != ACCEPT) {
session.setLastError("Expected list_mailbox after LSUB SPACE"
" mailbox SPACE");
return ERROR;
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF after LSUB SPACE"
" mailbox SPACE list_mailbox");
return ERROR;
diff --git a/src/operator-namespace.cc b/src/operator-namespace.cc
index 6bf80f4..6846107 100644
--- a/src/operator-namespace.cc
+++ b/src/operator-namespace.cc
@@ -49,14 +49,14 @@ Operator::ProcessResult NamespaceOperator::process(Depot &depot, Request &comman
return Operator::ProcessResult::OK;
}
-Parser::ParseResult NamespaceOperator::parse(Request &c_in)
+Parser::ParseResult NamespaceOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectCRLF()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected CRLF after NAMESPACE");
return res;
}
diff --git a/src/operator-noop.cc b/src/operator-noop.cc
index 9d72e8f..1d8ae1b 100644
--- a/src/operator-noop.cc
+++ b/src/operator-noop.cc
@@ -35,14 +35,14 @@ Operator::ProcessResult NoopOperator::process(Depot &depot, Request &command)
return Operator::ProcessResult::OK;
}
-Parser::ParseResult NoopOperator::parse(Request &c_in)
+Parser::ParseResult NoopOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectCRLF()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected CRLF after NOOP");
return res;
}
diff --git a/src/operator-rename.cc b/src/operator-rename.cc
index b8298f8..7789b32 100644
--- a/src/operator-rename.cc
+++ b/src/operator-rename.cc
@@ -62,7 +62,7 @@ Operator::ProcessResult RenameOperator::process(Depot &depot, Request &command)
return Operator::ProcessResult::NO;
}
-Parser::ParseResult RenameOperator::parse(Request &c_in)
+Parser::ParseResult RenameOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
@@ -71,30 +71,30 @@ Parser::ParseResult RenameOperator::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 SPACE after RENAME");
return res;
}
string mailbox;
- if ((res = expectMailbox(mailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox after RENAME SPACE");
return res;
}
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after RENAME SPACE mailbox");
return res;
}
string newmailbox;
- if ((res = expectMailbox(newmailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(newmailbox)) != ACCEPT) {
session.setLastError("Expected mailbox after RENAME SPACE"
" mailbox SPACE");
return res;
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF after RENAME SPACE"
" mailbox SPACE mailbox");
return res;
diff --git a/src/operator-search.cc b/src/operator-search.cc
index 1da4ee7..500e254 100644
--- a/src/operator-search.cc
+++ b/src/operator-search.cc
@@ -527,40 +527,40 @@ Operator::ProcessResult SearchOperator::process(Depot &depot, Request &command)
return Operator::ProcessResult::OK;
}
-Parser::ParseResult SearchOperator::parse(Request &c_in)
+Parser::ParseResult SearchOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
Session &session = Session::getInstance();
Parser::ParseResult res;
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectThisString("CHARSET")) == ACCEPT) {
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectThisString("CHARSET")) == ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after CHARSET");
return res;
}
string charset;
- if ((res = expectAstring(charset)) != ACCEPT) {
+ if ((res = p.expectAstring(charset)) != ACCEPT) {
session.setLastError("Expected astring after CHARSET SPACE");
return res;
}
c_in.setCharSet(charset);
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after CHARSET SPACE astring");
return res;
}
}
BincImapParserSearchKey b;
- if ((res = expectSearchKey(b)) != ACCEPT) {
+ if ((res = expectSearchKey(b, p)) != ACCEPT) {
session.setLastError("Expected search_key");
return res;
}
@@ -569,10 +569,10 @@ Parser::ParseResult SearchOperator::parse(Request &c_in)
c_in.searchkey.children.push_back(b);
while (1) {
- if ((res = expectSPACE()) != ACCEPT) break;
+ if ((res = p.expectSPACE()) != ACCEPT) break;
BincImapParserSearchKey c;
- if ((res = expectSearchKey(c)) != ACCEPT) {
+ if ((res = expectSearchKey(c, p)) != ACCEPT) {
session.setLastError("Expected search_key after search_key SPACE");
return res;
}
@@ -580,7 +580,7 @@ Parser::ParseResult SearchOperator::parse(Request &c_in)
c_in.searchkey.children.push_back(c);
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF after search_key");
return res;
}
@@ -589,7 +589,8 @@ Parser::ParseResult SearchOperator::parse(Request &c_in)
return ACCEPT;
}
-Parser::ParseResult SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
+Parser::ParseResult SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in,
+ Parser &p) const
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
@@ -597,322 +598,322 @@ Parser::ParseResult SearchOperator::expectSearchKey(BincImapParserSearchKey &s_i
Parser::ParseResult res;
s_in.type = BincImapParserSearchKey::KEY_OTHER;
- if ((res = expectThisString("ALL")) == ACCEPT) {
+ if ((res = p.expectThisString("ALL")) == ACCEPT) {
s_in.name = "ALL";
- } else if ((res = expectThisString("ANSWERED")) == ACCEPT) {
+ } else if ((res = p.expectThisString("ANSWERED")) == ACCEPT) {
s_in.name = "ANSWERED";
- } else if ((res = expectThisString("BCC")) == ACCEPT) {
+ } else if ((res = p.expectThisString("BCC")) == ACCEPT) {
s_in.name = "BCC";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectAstring(s_in.astring)) != ACCEPT) {
+ if ((res = p.expectAstring(s_in.astring)) != ACCEPT) {
session.setLastError("Expected astring");
return res;
}
- } else if ((res = expectThisString("BEFORE")) == ACCEPT) {
+ } else if ((res = p.expectThisString("BEFORE")) == ACCEPT) {
s_in.name = "BEFORE";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectDate(s_in.date)) != ACCEPT) {
+ if ((res = p.expectDate(s_in.date)) != ACCEPT) {
session.setLastError("Expected date");
return res;
}
- } else if ((res = expectThisString("BODY")) == ACCEPT) {
+ } else if ((res = p.expectThisString("BODY")) == ACCEPT) {
s_in.name = "BODY";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectAstring(s_in.astring)) != ACCEPT) {
+ if ((res = p.expectAstring(s_in.astring)) != ACCEPT) {
session.setLastError("Expected astring");
return res;
}
- } else if ((res = expectThisString("CC")) == ACCEPT) {
+ } else if ((res = p.expectThisString("CC")) == ACCEPT) {
s_in.name = "CC";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectAstring(s_in.astring)) != ACCEPT) {
+ if ((res = p.expectAstring(s_in.astring)) != ACCEPT) {
session.setLastError("Expected astring");
return res;
}
- } else if ((res = expectThisString("DELETED")) == ACCEPT) {
+ } else if ((res = p.expectThisString("DELETED")) == ACCEPT) {
s_in.name = "DELETED";
- } else if ((res = expectThisString("FLAGGED")) == ACCEPT) {
+ } else if ((res = p.expectThisString("FLAGGED")) == ACCEPT) {
s_in.name = "FLAGGED";
- } else if ((res = expectThisString("FROM")) == ACCEPT) {
+ } else if ((res = p.expectThisString("FROM")) == ACCEPT) {
s_in.name = "FROM";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectAstring(s_in.astring)) != ACCEPT) {
+ if ((res = p.expectAstring(s_in.astring)) != ACCEPT) {
session.setLastError("Expected astring");
return res;
}
- } else if ((res = expectThisString("KEYWORD")) == ACCEPT) {
+ } else if ((res = p.expectThisString("KEYWORD")) == ACCEPT) {
s_in.name = "KEYWORD";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectAtom(s_in.astring)) != ACCEPT) {
+ if ((res = p.expectAtom(s_in.astring)) != ACCEPT) {
session.setLastError("Expected flag_keyword");
return res;
}
- } else if ((res = expectThisString("NEW")) == ACCEPT) {
+ } else if ((res = p.expectThisString("NEW")) == ACCEPT) {
s_in.name = "NEW";
- } else if ((res = expectThisString("OLD")) == ACCEPT) {
+ } else if ((res = p.expectThisString("OLD")) == ACCEPT) {
s_in.name = "OLD";
- } else if ((res = expectThisString("ON")) == ACCEPT) {
+ } else if ((res = p.expectThisString("ON")) == ACCEPT) {
s_in.name = "ON";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectDate(s_in.date)) != ACCEPT) {
+ if ((res = p.expectDate(s_in.date)) != ACCEPT) {
session.setLastError("Expected date");
return res;
}
- } else if ((res = expectThisString("RECENT")) == ACCEPT) {
+ } else if ((res = p.expectThisString("RECENT")) == ACCEPT) {
s_in.name = "RECENT";
- } else if ((res = expectThisString("SEEN")) == ACCEPT) {
+ } else if ((res = p.expectThisString("SEEN")) == ACCEPT) {
s_in.name = "SEEN";
- } else if ((res = expectThisString("SINCE")) == ACCEPT) {
+ } else if ((res = p.expectThisString("SINCE")) == ACCEPT) {
s_in.name = "SINCE";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectDate(s_in.date)) != ACCEPT) {
+ if ((res = p.expectDate(s_in.date)) != ACCEPT) {
session.setLastError("Expected date");
return res;
}
- } else if ((res = expectThisString("SUBJECT")) == ACCEPT) {
+ } else if ((res = p.expectThisString("SUBJECT")) == ACCEPT) {
s_in.name = "SUBJECT";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectAstring(s_in.astring)) != ACCEPT) {
+ if ((res = p.expectAstring(s_in.astring)) != ACCEPT) {
session.setLastError("Expected astring");
return res;
}
- } else if ((res = expectThisString("TEXT")) == ACCEPT) {
+ } else if ((res = p.expectThisString("TEXT")) == ACCEPT) {
s_in.name = "TEXT";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectAstring(s_in.astring)) != ACCEPT) {
+ if ((res = p.expectAstring(s_in.astring)) != ACCEPT) {
session.setLastError("Expected astring");
return res;
}
- } else if ((res = expectThisString("TO")) == ACCEPT) {
+ } else if ((res = p.expectThisString("TO")) == ACCEPT) {
s_in.name = "TO";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectAstring(s_in.astring)) != ACCEPT) {
+ if ((res = p.expectAstring(s_in.astring)) != ACCEPT) {
session.setLastError("Expected astring");
return res;
}
- } else if ((res = expectThisString("UNANSWERED")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UNANSWERED")) == ACCEPT) {
s_in.name = "UNANSWERED";
- } else if ((res = expectThisString("UNDELETED")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UNDELETED")) == ACCEPT) {
s_in.name = "UNDELETED";
- } else if ((res = expectThisString("UNFLAGGED")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UNFLAGGED")) == ACCEPT) {
s_in.name = "UNFLAGGED";
- } else if ((res = expectThisString("UNKEYWORD")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UNKEYWORD")) == ACCEPT) {
s_in.name = "UNKEYWORD";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectAtom(s_in.astring)) != ACCEPT) {
+ if ((res = p.expectAtom(s_in.astring)) != ACCEPT) {
session.setLastError("Expected flag_keyword");
return res;
}
- } else if ((res = expectThisString("UNSEEN")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UNSEEN")) == ACCEPT) {
s_in.name = "UNSEEN";
- } else if ((res = expectThisString("DRAFT")) == ACCEPT) {
+ } else if ((res = p.expectThisString("DRAFT")) == ACCEPT) {
s_in.name = "DRAFT";
- } else if ((res = expectThisString("HEADER")) == ACCEPT) {
+ } else if ((res = p.expectThisString("HEADER")) == ACCEPT) {
s_in.name = "HEADER";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectAstring(s_in.astring)) != ACCEPT) {
+ if ((res = p.expectAstring(s_in.astring)) != ACCEPT) {
session.setLastError("Expected astring");
return res;
}
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectAstring(s_in.bstring)) != ACCEPT) {
+ if ((res = p.expectAstring(s_in.bstring)) != ACCEPT) {
session.setLastError("Expected astring");
return res;
}
- } else if ((res = expectThisString("LARGER")) == ACCEPT) {
+ } else if ((res = p.expectThisString("LARGER")) == ACCEPT) {
s_in.name = "LARGER";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectNumber(s_in.number)) != ACCEPT) {
+ if ((res = p.expectNumber(s_in.number)) != ACCEPT) {
session.setLastError("Expected number");
return res;
}
- } else if ((res = expectThisString("NOT")) == ACCEPT) {
+ } else if ((res = p.expectThisString("NOT")) == ACCEPT) {
s_in.name = "NOT";
s_in.type = BincImapParserSearchKey::KEY_NOT;
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
BincImapParserSearchKey s;
- if ((res = expectSearchKey(s)) != ACCEPT) {
+ if ((res = expectSearchKey(s, p)) != ACCEPT) {
session.setLastError("Expected search_key");
return res;
}
s_in.children.push_back(s);
- } else if ((res = expectThisString("OR")) == ACCEPT) {
+ } else if ((res = p.expectThisString("OR")) == ACCEPT) {
s_in.name = "OR";
s_in.type = BincImapParserSearchKey::KEY_OR;
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
BincImapParserSearchKey s;
- if ((res = expectSearchKey(s)) != ACCEPT) {
+ if ((res = expectSearchKey(s, p)) != ACCEPT) {
session.setLastError("Expected search_key");
return res;
}
s_in.children.push_back(s);
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
BincImapParserSearchKey t;
- if ((res = expectSearchKey(t)) != ACCEPT) {
+ if ((res = expectSearchKey(t, p)) != ACCEPT) {
session.setLastError("Expected search_key");
return res;
}
s_in.children.push_back(t);
- } else if ((res = expectThisString("SENTBEFORE")) == ACCEPT) {
+ } else if ((res = p.expectThisString("SENTBEFORE")) == ACCEPT) {
s_in.name = "SENTBEFORE";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectDate(s_in.date)) != ACCEPT) {
+ if ((res = p.expectDate(s_in.date)) != ACCEPT) {
session.setLastError("Expected date");
return res;
}
- } else if ((res = expectThisString("SENTON")) == ACCEPT) {
+ } else if ((res = p.expectThisString("SENTON")) == ACCEPT) {
s_in.name = "SENTON";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectDate(s_in.date)) != ACCEPT) {
+ if ((res = p.expectDate(s_in.date)) != ACCEPT) {
session.setLastError("Expected date");
return res;
}
- } else if ((res = expectThisString("SENTSINCE")) == ACCEPT) {
+ } else if ((res = p.expectThisString("SENTSINCE")) == ACCEPT) {
s_in.name = "SENTSINCE";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectDate(s_in.date)) != ACCEPT) {
+ if ((res = p.expectDate(s_in.date)) != ACCEPT) {
session.setLastError("Expected date");
return res;
}
- } else if ((res = expectThisString("SMALLER")) == ACCEPT) {
+ } else if ((res = p.expectThisString("SMALLER")) == ACCEPT) {
s_in.name = "SMALLER";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectNumber(s_in.number)) != ACCEPT) {
+ if ((res = p.expectNumber(s_in.number)) != ACCEPT) {
session.setLastError("Expected number");
return res;
}
- } else if ((res = expectThisString("UID")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UID")) == ACCEPT) {
s_in.name = "UID";
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectSet(s_in.bset)) != ACCEPT) {
+ if ((res = p.expectSet(s_in.bset)) != ACCEPT) {
session.setLastError("Expected number");
return res;
}
- } else if ((res = expectThisString("UNDRAFT")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UNDRAFT")) == ACCEPT) {
s_in.name = "UNDRAFT";
- } else if ((res = expectSet(s_in.bset)) == ACCEPT) {
+ } else if ((res = p.expectSet(s_in.bset)) == ACCEPT) {
s_in.name = "";
s_in.type = BincImapParserSearchKey::KEY_SET;
- } else if ((res = expectThisString("(")) == ACCEPT) {
+ } else if ((res = p.expectThisString("(")) == ACCEPT) {
s_in.type = BincImapParserSearchKey::KEY_AND;
while (1) {
BincImapParserSearchKey c;
- if ((res = expectSearchKey(c)) != ACCEPT) {
+ if ((res = expectSearchKey(c, p)) != ACCEPT) {
session.setLastError("Expected search_key");
return res;
}
s_in.children.push_back(c);
- if ((res = expectSPACE()) != ACCEPT) break;
+ if ((res = p.expectSPACE()) != ACCEPT) break;
}
- if ((res = expectThisString(")")) != ACCEPT) {
+ if ((res = p.expectThisString(")")) != ACCEPT) {
session.setLastError("Expected )");
return res;
}
diff --git a/src/operator-select.cc b/src/operator-select.cc
index 5d30bbd..51ce223 100644
--- a/src/operator-select.cc
+++ b/src/operator-select.cc
@@ -114,7 +114,7 @@ Operator::ProcessResult SelectOperator::process(Depot &depot, Request &command)
return ProcessResult::OK;
}
-Parser::ParseResult SelectOperator::parse(Request &c_in)
+Parser::ParseResult SelectOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
@@ -123,18 +123,18 @@ Parser::ParseResult SelectOperator::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 SPACE after" + c_in.getName());
return res;
}
string mailbox;
- if ((res = expectMailbox(mailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox after " + c_in.getName() + " SPACE");
return res;
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF after " + c_in.getName() + " SPACE mailbox");
return res;
}
diff --git a/src/operator-starttls.cc b/src/operator-starttls.cc
index 7e8b1f4..fefeb36 100644
--- a/src/operator-starttls.cc
+++ b/src/operator-starttls.cc
@@ -85,14 +85,14 @@ Operator::ProcessResult StarttlsOperator::process(Depot &depot, Request &command
return ProcessResult::NOTHING;
}
-Parser::ParseResult StarttlsOperator::parse(Request &c_in)
+Parser::ParseResult StarttlsOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectCRLF()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected CRLF");
return res;
}
diff --git a/src/operator-status.cc b/src/operator-status.cc
index da37a55..4c2588f 100644
--- a/src/operator-status.cc
+++ b/src/operator-status.cc
@@ -75,7 +75,7 @@ Operator::ProcessResult StatusOperator::process(Depot &depot, Request &command)
return ProcessResult::OK;
}
-Parser::ParseResult StatusOperator::parse(Request &c_in)
+Parser::ParseResult StatusOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
@@ -84,54 +84,54 @@ Parser::ParseResult StatusOperator::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 SPACE");
return res;
}
std::string mailbox;
- if ((res = expectMailbox(mailbox)) != ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox");
return res;
}
c_in.setMailbox(mailbox);
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectThisString("(")) != ACCEPT) {
+ if ((res = p.expectThisString("(")) != ACCEPT) {
session.setLastError("Expected (");
return res;
}
while (1) {
- if ((res = expectThisString("MESSAGES")) == ACCEPT) {
+ if ((res = p.expectThisString("MESSAGES")) == ACCEPT) {
c_in.getStatuses().push_back("MESSAGES");
- } else if ((res = expectThisString("RECENT")) == ACCEPT) {
+ } else if ((res = p.expectThisString("RECENT")) == ACCEPT) {
c_in.getStatuses().push_back("RECENT");
- } else if ((res = expectThisString("UIDNEXT")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UIDNEXT")) == ACCEPT) {
c_in.getStatuses().push_back("UIDNEXT");
- } else if ((res = expectThisString("UIDVALIDITY")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UIDVALIDITY")) == ACCEPT) {
c_in.getStatuses().push_back("UIDVALIDITY");
- } else if ((res = expectThisString("UNSEEN")) == ACCEPT) {
+ } else if ((res = p.expectThisString("UNSEEN")) == ACCEPT) {
c_in.getStatuses().push_back("UNSEEN");
} else {
session.setLastError("Expected status_att");
return res;
}
- if (expectSPACE() != ACCEPT) break;
+ if (p.expectSPACE() != ACCEPT) break;
}
- if ((res = expectThisString(")")) != ACCEPT) {
+ if ((res = p.expectThisString(")")) != ACCEPT) {
session.setLastError("Expected )");
return res;
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF");
return Parser::ParseResult::ERROR;
}
diff --git a/src/operator-store.cc b/src/operator-store.cc
index 23d97e2..06e0e3a 100644
--- a/src/operator-store.cc
+++ b/src/operator-store.cc
@@ -120,58 +120,58 @@ Operator::ProcessResult StoreOperator::process(Depot &depot, Request &command)
return ProcessResult::OK;
}
-Parser::ParseResult StoreOperator::parse(Request &c_in)
+Parser::ParseResult StoreOperator::parse(Request &c_in, Parser &p)
{
constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
Session &session = Session::getInstance();
Parser::ParseResult res;
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
- if ((res = expectSet(c_in.getSet())) != ACCEPT) {
+ if ((res = p.expectSet(c_in.getSet())) != ACCEPT) {
session.setLastError("Expected Set");
return res;
}
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
string mode;
- if ((res = expectThisString("+")) == ACCEPT)
+ if ((res = p.expectThisString("+")) == ACCEPT)
mode = "+";
- else if ((res = expectThisString("-")) == ACCEPT)
+ else if ((res = p.expectThisString("-")) == ACCEPT)
mode = "-";
- if ((res = expectThisString("FLAGS")) != ACCEPT) {
+ if ((res = p.expectThisString("FLAGS")) != ACCEPT) {
session.setLastError("Expected FLAGS");
return res;
} else {
mode += "FLAGS";
}
- if ((res = expectThisString(".SILENT")) == ACCEPT) mode += ".SILENT";
+ if ((res = p.expectThisString(".SILENT")) == ACCEPT) mode += ".SILENT";
c_in.setMode(mode);
- if ((res = expectSPACE()) != ACCEPT) {
+ if ((res = p.expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
bool paren = false;
- if ((res = expectThisString("(")) == ACCEPT) paren = true;
+ if ((res = p.expectThisString("(")) == ACCEPT) paren = true;
- if ((res = expectFlag(c_in.getFlags())) == ACCEPT) {
+ if ((res = p.expectFlag(c_in.getFlags())) == ACCEPT) {
while (1) {
- if ((res = expectSPACE()) != ACCEPT) break;
+ if ((res = p.expectSPACE()) != ACCEPT) break;
- if ((res = expectFlag(c_in.getFlags())) != ACCEPT) {
+ if ((res = p.expectFlag(c_in.getFlags())) != ACCEPT) {
session.setLastError("Expected flag after SPACE");
return res;
}
@@ -179,13 +179,13 @@ Parser::ParseResult StoreOperator::parse(Request &c_in)
}
if (paren) {
- if ((res = expectThisString(")")) != ACCEPT) {
+ if ((res = p.expectThisString(")")) != ACCEPT) {
session.setLastError("Expected )");
return res;
}
}
- if ((res = expectCRLF()) != ACCEPT) {
+ if ((res = p.expectCRLF()) != ACCEPT) {
session.setLastError("Expected CRLF");
return res;
}
diff --git a/src/operator-subscribe.cc b/src/operator-subscribe.cc
index 3209986..3e73dfb 100644
--- a/src/operator-subscribe.cc
+++ b/src/operator-subscribe.cc
@@ -45,26 +45,26 @@ Operator::ProcessResult SubscribeOperator::process(Depot &depot, Request &comman
return ProcessResult::OK;
}
-Parser::ParseResult SubscribeOperator::parse(Request &c_in)
+Parser::ParseResult SubscribeOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectSPACE()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectSPACE()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
string mailbox;
- if ((res = expectMailbox(mailbox)) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected mailbox");
return res;
}
c_in.setMailbox(mailbox);
- if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectCRLF()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected CRLF");
return res;
}
diff --git a/src/operator-unsubscribe.cc b/src/operator-unsubscribe.cc
index cafa10a..d2ef0c0 100644
--- a/src/operator-unsubscribe.cc
+++ b/src/operator-unsubscribe.cc
@@ -51,25 +51,25 @@ Operator::ProcessResult UnsubscribeOperator::process(Depot &depot, Request &comm
return ProcessResult::OK;
}
-Parser::ParseResult UnsubscribeOperator::parse(Request &c_in)
+Parser::ParseResult UnsubscribeOperator::parse(Request &c_in, Parser &p)
{
Session &session = Session::getInstance();
if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
Parser::ParseResult res;
- if ((res = expectSPACE()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectSPACE()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected SPACE");
return res;
}
string mailbox;
- if ((res = expectMailbox(mailbox)) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectMailbox(mailbox)) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected mailbox");
return res;
}
- if ((res = expectCRLF()) != Parser::ParseResult::ACCEPT) {
+ if ((res = p.expectCRLF()) != Parser::ParseResult::ACCEPT) {
session.setLastError("Expected CRLF");
return res;
}
diff --git a/src/recursivedescent.cc b/src/recursivedescent.cc
index b734779..7753c91 100644
--- a/src/recursivedescent.cc
+++ b/src/recursivedescent.cc
@@ -11,27 +11,22 @@
#include "imapparser.h"
#include "iodevice.h"
#include "iofactory.h"
-#include "operators.h"
-#include "session.h"
#include <cctype>
#include <iomanip>
#include <iostream>
#include <stack>
-using namespace Binc;
using std::string;
using ParseResult = Binc::Parser::ParseResult;
-constexpr auto ERROR = Parser::ParseResult::ERROR;
-constexpr auto REJECT = Parser::ParseResult::REJECT;
-constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
-constexpr auto TIMEOUT = Parser::ParseResult::TIMEOUT;
+constexpr auto ERROR = ParseResult::ERROR;
+constexpr auto REJECT = ParseResult::REJECT;
+constexpr auto ACCEPT = ParseResult::ACCEPT;
+constexpr auto TIMEOUT = ParseResult::TIMEOUT;
-ParseResult Binc::expectThisString(const string &s_in)
+ParseResult Binc::Parser::expectThisString(const string &s_in)
{
- Session &session = Session::getInstance();
-
char c;
bool match = true;
@@ -58,10 +53,8 @@ ParseResult Binc::expectThisString(const string &s_in)
}
}
-ParseResult Binc::expectDateTime(string &s_in)
+ParseResult Binc::Parser::expectDateTime(string &s_in)
{
- Session &session = Session::getInstance();
-
if (expectThisString("\"") != ACCEPT) return REJECT;
unsigned int digit1, digit2;
@@ -204,10 +197,8 @@ ParseResult Binc::expectDateTime(string &s_in)
return ACCEPT;
}
-ParseResult Binc::expectTime(string &s_in)
+ParseResult Binc::Parser::expectTime(string &s_in)
{
- Session &session = Session::getInstance();
-
unsigned int c, t;
ParseResult res;
if ((res = expectDigit(t)) != ACCEPT) return res;
@@ -278,10 +269,8 @@ ParseResult Binc::expectTime(string &s_in)
return ACCEPT;
}
-ParseResult Binc::expectZone(string &s_in)
+ParseResult Binc::Parser::expectZone(string &s_in)
{
- Session &session = Session::getInstance();
-
ParseResult res;
if ((res = expectThisString("-")) == ACCEPT)
s_in += "-";
@@ -326,7 +315,7 @@ ParseResult Binc::expectZone(string &s_in)
return ACCEPT;
}
-ParseResult Binc::expectListWildcards(int &c_in)
+ParseResult Binc::Parser::expectListWildcards(int &c_in)
{
ParseResult res;
if ((res = expectThisString("%")) == ACCEPT) {
@@ -340,7 +329,7 @@ ParseResult Binc::expectListWildcards(int &c_in)
}
}
-ParseResult Binc::expectListMailbox(string &s_in)
+ParseResult Binc::Parser::expectListMailbox(string &s_in)
{
ParseResult res;
if ((res = expectString(s_in)) == ACCEPT) return ACCEPT;
@@ -364,10 +353,8 @@ ParseResult Binc::expectListMailbox(string &s_in)
return res;
}
-ParseResult Binc::expectFlag(std::vector<string> &v_in)
+ParseResult Binc::Parser::expectFlag(std::vector<string> &v_in)
{
- Session &session = Session::getInstance();
-
ParseResult res;
string flag;
if ((res = expectThisString("\\Answered")) == ACCEPT) {
@@ -399,10 +386,8 @@ ParseResult Binc::expectFlag(std::vector<string> &v_in)
return ACCEPT;
}
-ParseResult Binc::expectDate(string &s_in)
+ParseResult Binc::Parser::expectDate(string &s_in)
{
- Session &session = Session::getInstance();
-
ParseResult res;
bool quoted = false;
if ((res = expectThisString("\"")) == ACCEPT) quoted = true;
@@ -513,7 +498,7 @@ ParseResult Binc::expectDate(string &s_in)
return ACCEPT;
}
-ParseResult Binc::expectCRLF()
+ParseResult Binc::Parser::expectCRLF()
{
ParseResult res;
if ((res = expectCR()) == ACCEPT && (res = expectLF()) == ACCEPT)
@@ -522,10 +507,8 @@ ParseResult Binc::expectCRLF()
return res;
}
-ParseResult Binc::expectCR()
+ParseResult Binc::Parser::expectCR()
{
- Session &session = Session::getInstance();
-
char c;
if (!bincClient.readChar(&c)) {
session.setLastError(bincClient.getLastErrorString());
@@ -542,10 +525,8 @@ ParseResult Binc::expectCR()
}
}
-ParseResult Binc::expectLF()
+ParseResult Binc::Parser::expectLF()
{
- Session &session = Session::getInstance();
-
char c;
if (!bincClient.readChar(&c)) {
session.setLastError(bincClient.getLastErrorString());
@@ -562,10 +543,8 @@ ParseResult Binc::expectLF()
}
}
-ParseResult Binc::expectTagChar(int &c_in)
+ParseResult Binc::Parser::expectTagChar(int &c_in)
{
- Session &session = Session::getInstance();
-
char c;
if (!bincClient.readChar(&c)) {
session.setLastError(bincClient.getLastErrorString());
@@ -672,7 +651,7 @@ ParseResult Binc::expectTagChar(int &c_in)
return REJECT;
}
-ParseResult Binc::expectTag(string &s_in)
+ParseResult Binc::Parser::expectTag(string &s_in)
{
string tag;
int tagchar;
@@ -710,10 +689,8 @@ ParseResult Binc::expectTag(string &s_in)
return ACCEPT;
}
-ParseResult Binc::expectSPACE()
+ParseResult Binc::Parser::expectSPACE()
{
- Session &session = Session::getInstance();
-
char c;
if (!bincClient.readChar(&c)) {
session.setLastError(bincClient.getLastErrorString());
@@ -730,13 +707,13 @@ ParseResult Binc::expectSPACE()
}
}
-ParseResult Binc::expectMailbox(string &s_in)
+ParseResult Binc::Parser::expectMailbox(string &s_in)
{
return expectAstring(s_in);
}
// FIXME: This rule is wrong.
-ParseResult Binc::expectAstring(string &s_in)
+ParseResult Binc::Parser::expectAstring(string &s_in)
{
ParseResult res;
if ((res = expectAtom(s_in)) == ACCEPT) return ACCEPT;
@@ -746,10 +723,8 @@ ParseResult Binc::expectAstring(string &s_in)
return res;
}
-ParseResult Binc::expectAtomChar(int &c_in)
+ParseResult Binc::Parser::expectAtomChar(int &c_in)
{
- Session &session = Session::getInstance();
-
char c;
if (!bincClient.readChar(&c)) {
session.setLastError(bincClient.getLastErrorString());
@@ -856,7 +831,7 @@ ParseResult Binc::expectAtomChar(int &c_in)
return REJECT;
}
-ParseResult Binc::expectAtom(string &s_in)
+ParseResult Binc::Parser::expectAtom(string &s_in)
{
string atom;
int atomchar;
@@ -875,7 +850,7 @@ ParseResult Binc::expectAtom(string &s_in)
return ACCEPT;
}
-ParseResult Binc::expectString(string &s_in)
+ParseResult Binc::Parser::expectString(string &s_in)
{
ParseResult res;
if ((res = expectQuoted(s_in)) == ACCEPT) return ACCEPT;
@@ -885,7 +860,7 @@ ParseResult Binc::expectString(string &s_in)
return res;
}
-ParseResult Binc::expectQuoted(string &s_in)
+ParseResult Binc::Parser::expectQuoted(string &s_in)
{
string quoted;
int quotedchar;
@@ -905,10 +880,8 @@ ParseResult Binc::expectQuoted(string &s_in)
return ACCEPT;
}
-ParseResult Binc::expectQuotedChar(int &c_in)
+ParseResult Binc::Parser::expectQuotedChar(int &c_in)
{
- Session &session = Session::getInstance();
-
char c;
if (!bincClient.readChar(&c)) {
session.setLastError(bincClient.getLastErrorString());
@@ -1069,10 +1042,8 @@ ParseResult Binc::expectQuotedChar(int &c_in)
return REJECT;
}
-ParseResult Binc::expectLiteral(string &s_in)
+ParseResult Binc::Parser::expectLiteral(string &s_in)
{
- Session &session = Session::getInstance();
-
string literal;
ParseResult res;
@@ -1124,7 +1095,7 @@ ParseResult Binc::expectLiteral(string &s_in)
return ACCEPT;
}
-ParseResult Binc::expectNumber(unsigned int &i_in)
+ParseResult Binc::Parser::expectNumber(unsigned int &i_in)
{
i_in = 0;
unsigned int n;
@@ -1141,10 +1112,8 @@ ParseResult Binc::expectNumber(unsigned int &i_in)
return ACCEPT;
}
-ParseResult Binc::expectDigit(unsigned int &i_in)
+ParseResult Binc::Parser::expectDigit(unsigned int &i_in)
{
- Session &session = Session::getInstance();
-
char c;
if (!bincClient.readChar(&c)) {
session.setLastError(bincClient.getLastErrorString());
@@ -1165,10 +1134,8 @@ ParseResult Binc::expectDigit(unsigned int &i_in)
return ACCEPT;
}
-ParseResult Binc::expectDigitNZ(unsigned int &i_in)
+ParseResult Binc::Parser::expectDigitNZ(unsigned int &i_in)
{
- Session &session = Session::getInstance();
-
char c;
if (!bincClient.readChar(&c)) {
session.setLastError(bincClient.getLastErrorString());
@@ -1218,9 +1185,8 @@ ParseResult Binc::expectDigitNZ(unsigned int &i_in)
return ACCEPT;
}
-ParseResult Binc::expectSet(SequenceSet &s_in)
+ParseResult Binc::Parser::expectSet(SequenceSet &s_in)
{
- Session &session = Session::getInstance();
unsigned int seqnum = (unsigned int)-1;
ParseResult res;
@@ -1257,10 +1223,8 @@ ParseResult Binc::expectSet(SequenceSet &s_in)
return ACCEPT;
}
-ParseResult Binc::expectSequenceNum(unsigned int &i_in)
+ParseResult Binc::Parser::expectSequenceNum(unsigned int &i_in)
{
- Session &session = Session::getInstance();
-
char c;
if (!bincClient.readChar(&c)) {
session.setLastError(bincClient.getLastErrorString());
@@ -1282,7 +1246,7 @@ ParseResult Binc::expectSequenceNum(unsigned int &i_in)
return ACCEPT;
}
-ParseResult Binc::expectNZNumber(unsigned int &i_in)
+ParseResult Binc::Parser::expectNZNumber(unsigned int &i_in)
{
unsigned int c;
ParseResult res;