summaryrefslogtreecommitdiff
path: root/src/operator-search.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/operator-search.cc')
-rw-r--r--src/operator-search.cc354
1 files changed, 208 insertions, 146 deletions
diff --git a/src/operator-search.cc b/src/operator-search.cc
index 0470eb5..08f51c1 100644
--- a/src/operator-search.cc
+++ b/src/operator-search.cc
@@ -2,14 +2,8 @@
* @file operator-search.cc
* @brief Implementation of the SEARCH command.
* @author Andreas Aardal Hanssen
- * @date 2002-2005
+ * @date 2002-2005
* ----------------------------------------------------------------- **/
-#include <string>
-#include <iostream>
-#include <algorithm>
-
-#include <ctype.h>
-
#include "convert.h"
#include "depot.h"
#include "imapparser.h"
@@ -21,52 +15,67 @@
#include "recursivedescent.h"
#include "session.h"
+#include <algorithm>
+#include <iostream>
+#include <string>
+
+#include <ctype.h>
+
using namespace ::std;
using namespace Binc;
//----------------------------------------------------------------------
-bool SearchOperator::SearchNode::convertDate(const string &date,
- time_t &t, const string &delim)
+bool SearchOperator::SearchNode::convertDate(const string &date, time_t &t, const string &delim)
{
vector<string> parts;
split(date, delim, parts);
if (parts.size() < 3) return false;
-
+
struct tm mold;
- memset((char *) &mold, 0, sizeof(struct tm));
+ memset((char *)&mold, 0, sizeof(struct tm));
mold.tm_mday = atoi(parts[0].c_str());
mold.tm_year = atoi(parts[2].c_str()) - 1900;
-
+
// accept mixed case months. this is more than the standard
// accepts.
string month = parts[1];
lowercase(month);
-
- if (month == "jan") mold.tm_mon = 0;
- else if (month == "feb") mold.tm_mon = 1;
- else if (month == "mar") mold.tm_mon = 2;
- else if (month == "apr") mold.tm_mon = 3;
- else if (month == "may") mold.tm_mon = 4;
- else if (month == "jun") mold.tm_mon = 5;
- else if (month == "jul") mold.tm_mon = 6;
- else if (month == "aug") mold.tm_mon = 7;
- else if (month == "sep") mold.tm_mon = 8;
- else if (month == "oct") mold.tm_mon = 9;
- else if (month == "nov") mold.tm_mon = 10;
- else if (month == "dec") mold.tm_mon = 11;
-
+
+ if (month == "jan")
+ mold.tm_mon = 0;
+ else if (month == "feb")
+ mold.tm_mon = 1;
+ else if (month == "mar")
+ mold.tm_mon = 2;
+ else if (month == "apr")
+ mold.tm_mon = 3;
+ else if (month == "may")
+ mold.tm_mon = 4;
+ else if (month == "jun")
+ mold.tm_mon = 5;
+ else if (month == "jul")
+ mold.tm_mon = 6;
+ else if (month == "aug")
+ mold.tm_mon = 7;
+ else if (month == "sep")
+ mold.tm_mon = 8;
+ else if (month == "oct")
+ mold.tm_mon = 9;
+ else if (month == "nov")
+ mold.tm_mon = 10;
+ else if (month == "dec")
+ mold.tm_mon = 11;
+
t = mktime(&mold);
return true;
}
//----------------------------------------------------------------------
-bool SearchOperator::SearchNode::convertDateHeader(const string &d_in,
- time_t &t)
+bool SearchOperator::SearchNode::convertDateHeader(const string &d_in, time_t &t)
{
string date = d_in;
string::size_type n = date.find(',');
- if (n != string::npos)
- date = date.substr(n + 1);
+ if (n != string::npos) date = date.substr(n + 1);
trim(date);
bool result = convertDate(date, t, " ");
@@ -74,9 +83,7 @@ bool SearchOperator::SearchNode::convertDateHeader(const string &d_in,
}
//----------------------------------------------------------------------
-SearchOperator::SearchNode::SearchNode(void)
-{
-}
+SearchOperator::SearchNode::SearchNode(void) {}
//----------------------------------------------------------------------
SearchOperator::SearchNode::SearchNode(const BincImapParserSearchKey &a)
@@ -92,7 +99,8 @@ int SearchOperator::SearchNode::getType(void) const
//----------------------------------------------------------------------
bool SearchOperator::SearchNode::match(Mailbox *mailbox,
- Message *m, unsigned int seqnr,
+ Message *m,
+ unsigned int seqnr,
unsigned int lastmessage,
unsigned int lastuid) const
{
@@ -101,10 +109,10 @@ bool SearchOperator::SearchNode::match(Mailbox *mailbox,
switch (type) {
//--------------------------------------------------------------------
- case S_ALL:
+ case S_ALL:
return true;
//--------------------------------------------------------------------
- case S_ANSWERED:
+ case S_ANSWERED:
return (m->getStdFlags() & Message::F_ANSWERED);
//--------------------------------------------------------------------
case S_BCC:
@@ -123,13 +131,12 @@ bool SearchOperator::SearchNode::match(Mailbox *mailbox,
time_t atime;
if (!convertDate(date, atime)) {
- bincWarning << "warning, unable to convert " << date <<
- " to a time_t" << endl;
+ bincWarning << "warning, unable to convert " << date << " to a time_t" << endl;
return false;
}
return mtime < atime;
- } //--------------------------------------------------------------------
+ } //--------------------------------------------------------------------
case S_BODY:
return m->bodyContains(astring);
//--------------------------------------------------------------------
@@ -145,13 +152,12 @@ bool SearchOperator::SearchNode::match(Mailbox *mailbox,
case S_FROM:
return m->headerContains("from", astring);
//--------------------------------------------------------------------
- case S_KEYWORD:
+ case S_KEYWORD:
// the server does not support keywords
return false;
//--------------------------------------------------------------------
case S_NEW:
- return (m->getStdFlags() & Message::F_RECENT)
- && !(m->getStdFlags() & Message::F_SEEN);
+ return (m->getStdFlags() & Message::F_RECENT) && !(m->getStdFlags() & Message::F_SEEN);
//--------------------------------------------------------------------
case S_OLD:
return !(m->getStdFlags() & Message::F_RECENT);
@@ -169,13 +175,12 @@ bool SearchOperator::SearchNode::match(Mailbox *mailbox,
time_t atime;
if (!convertDate(date, atime)) {
- bincWarning << "warning, unable to convert " << date <<
- " to a time_t" << endl;
+ bincWarning << "warning, unable to convert " << date << " to a time_t" << endl;
return false;
}
return mtime == atime;
- } //--------------------------------------------------------------------
+ } //--------------------------------------------------------------------
case S_RECENT:
return (m->getStdFlags() & Message::F_RECENT);
//--------------------------------------------------------------------
@@ -195,13 +200,12 @@ bool SearchOperator::SearchNode::match(Mailbox *mailbox,
time_t atime;
if (!convertDate(date, atime)) {
- bincWarning << "warning, unable to convert " << date <<
- " to a time_t" << endl;
+ bincWarning << "warning, unable to convert " << date << " to a time_t" << endl;
return false;
}
return mtime >= atime;
- } //--------------------------------------------------------------------
+ } //--------------------------------------------------------------------
case S_SUBJECT:
return m->headerContains("subject", astring);
//--------------------------------------------------------------------
@@ -238,38 +242,34 @@ bool SearchOperator::SearchNode::match(Mailbox *mailbox,
}
//--------------------------------------------------------------------
case S_NOT:
- for (vector<SearchNode>::const_iterator i = children.begin();
- i != children.end(); ++i)
+ for (vector<SearchNode>::const_iterator i = children.begin(); i != children.end(); ++i)
if ((*i).match(mailbox, m, seqnr, lastmessage, lastuid)) return false;
return true;
//--------------------------------------------------------------------
case S_OR:
- for (vector<SearchNode>::const_iterator i = children.begin();
- i != children.end(); ++i)
+ for (vector<SearchNode>::const_iterator i = children.begin(); i != children.end(); ++i)
if ((*i).match(mailbox, m, seqnr, lastmessage, lastuid)) return true;
return false;
//--------------------------------------------------------------------
case S_SENTBEFORE: {
string tmp = m->getHeader("date");
- if (tmp == "")
- return false;
+ if (tmp == "") return false;
lowercase(tmp);
time_t mtime;
if (!convertDateHeader(tmp, mtime)) return false;
- if (mtime == (time_t) -1) return false;
+ if (mtime == (time_t)-1) return false;
time_t atime;
if (!convertDate(date, atime)) {
- bincWarning << "warning, unable to convert " << date <<
- " to a time_t" << endl;
+ bincWarning << "warning, unable to convert " << date << " to a time_t" << endl;
return false;
}
return mtime < atime;
- } //--------------------------------------------------------------------
+ } //--------------------------------------------------------------------
case S_SENTON: {
string tmp = m->getHeader("date");
if (tmp == "") return false;
@@ -279,17 +279,16 @@ bool SearchOperator::SearchNode::match(Mailbox *mailbox,
time_t mtime;
if (!convertDateHeader(tmp, mtime)) return false;
- if (mtime == (time_t) -1) return false;
+ if (mtime == (time_t)-1) return false;
time_t atime;
if (!convertDate(date, atime)) {
- bincWarning << "warning, unable to convert " << date <<
- " to a time_t" << endl;
+ bincWarning << "warning, unable to convert " << date << " to a time_t" << endl;
return false;
}
return mtime == atime;
- } //--------------------------------------------------------------------
+ } //--------------------------------------------------------------------
case S_SENTSINCE: {
string tmp = m->getHeader("date");
if (tmp == "") return false;
@@ -299,17 +298,16 @@ bool SearchOperator::SearchNode::match(Mailbox *mailbox,
time_t mtime;
if (!convertDateHeader(tmp, mtime)) return false;
- if (mtime == (time_t) -1) return false;
+ if (mtime == (time_t)-1) return false;
time_t atime;
if (!convertDate(date, atime)) {
- bincWarning << "warning, unable to convert " << date
- << " to a time_t" << endl;
+ bincWarning << "warning, unable to convert " << date << " to a time_t" << endl;
return false;
}
return mtime >= atime;
- } //--------------------------------------------------------------------
+ } //--------------------------------------------------------------------
case S_SMALLER:
return (m->getSize(true) < number);
//--------------------------------------------------------------------
@@ -327,8 +325,7 @@ bool SearchOperator::SearchNode::match(Mailbox *mailbox,
return true;
//--------------------------------------------------------------------
case S_AND:
- for (vector<SearchNode>::const_iterator i = children.begin();
- i != children.end(); ++i)
+ for (vector<SearchNode>::const_iterator i = children.begin(); i != children.end(); ++i)
if (!(*i).match(mailbox, m, seqnr, lastmessage, lastuid)) return false;
return true;
}
@@ -347,34 +344,88 @@ void SearchOperator::SearchNode::init(const BincImapParserSearchKey &a)
uppercase(bstring);
uppercase(date);
- if (a.name == "ALL") { type = S_ALL; weight = 1; }
- else if (a.name == "ANSWERED") { type = S_ANSWERED; weight = 1; }
- else if (a.name == "BCC") { type = S_BCC; weight = 2; }
- else if (a.name == "BEFORE") { type = S_BEFORE; weight = 2; }
- else if (a.name == "BODY") { type = S_BODY; weight = 1; }
- else if (a.name == "CC") { type = S_CC; weight = 2; }
- else if (a.name == "DELETED") { type = S_DELETED; weight = 1; }
- else if (a.name == "FLAGGED") { type = S_FLAGGED; weight = 1; }
- else if (a.name == "FROM") { type = S_FROM; weight = 2; }
- else if (a.name == "KEYWORD") { type = S_KEYWORD; weight = 3; }
- else if (a.name == "NEW") { type = S_NEW; weight = 1; }
- else if (a.name == "OLD") { type = S_OLD; weight = 1; }
- else if (a.name == "ON") { type = S_ON; weight = 1; }
- else if (a.name == "RECENT") { type = S_RECENT; weight = 1; }
- else if (a.name == "SEEN") { type = S_SEEN; weight = 1; }
- else if (a.name == "SINCE") { type = S_SINCE; weight = 1; }
- else if (a.name == "SUBJECT") { type = S_SUBJECT; weight = 2; }
- else if (a.name == "TEXT") { type = S_TEXT; weight = 4; }
- else if (a.name == "TO") { type = S_TO; weight = 2; }
- else if (a.name == "UNANSWERED") { type = S_UNANSWERED; weight = 1; }
- else if (a.name == "UNDELETED") { type = S_UNDELETED; weight = 1; }
- else if (a.name == "UNFLAGGED") { type = S_UNFLAGGED; weight = 1; }
- else if (a.name == "UNKEYWORD") { type = S_UNKEYWORD; weight = 1; }
- else if (a.name == "UNSEEN") { type = S_UNSEEN; weight = 1; }
- else if (a.name == "DRAFT") { type = S_DRAFT; weight = 1; }
- else if (a.name == "HEADER") { type = S_HEADER; weight = 3; }
- else if (a.name == "LARGER") { type = S_LARGER; weight = 4; }
- else if (a.name == "NOT") {
+ if (a.name == "ALL") {
+ type = S_ALL;
+ weight = 1;
+ } else if (a.name == "ANSWERED") {
+ type = S_ANSWERED;
+ weight = 1;
+ } else if (a.name == "BCC") {
+ type = S_BCC;
+ weight = 2;
+ } else if (a.name == "BEFORE") {
+ type = S_BEFORE;
+ weight = 2;
+ } else if (a.name == "BODY") {
+ type = S_BODY;
+ weight = 1;
+ } else if (a.name == "CC") {
+ type = S_CC;
+ weight = 2;
+ } else if (a.name == "DELETED") {
+ type = S_DELETED;
+ weight = 1;
+ } else if (a.name == "FLAGGED") {
+ type = S_FLAGGED;
+ weight = 1;
+ } else if (a.name == "FROM") {
+ type = S_FROM;
+ weight = 2;
+ } else if (a.name == "KEYWORD") {
+ type = S_KEYWORD;
+ weight = 3;
+ } else if (a.name == "NEW") {
+ type = S_NEW;
+ weight = 1;
+ } else if (a.name == "OLD") {
+ type = S_OLD;
+ weight = 1;
+ } else if (a.name == "ON") {
+ type = S_ON;
+ weight = 1;
+ } else if (a.name == "RECENT") {
+ type = S_RECENT;
+ weight = 1;
+ } else if (a.name == "SEEN") {
+ type = S_SEEN;
+ weight = 1;
+ } else if (a.name == "SINCE") {
+ type = S_SINCE;
+ weight = 1;
+ } else if (a.name == "SUBJECT") {
+ type = S_SUBJECT;
+ weight = 2;
+ } else if (a.name == "TEXT") {
+ type = S_TEXT;
+ weight = 4;
+ } else if (a.name == "TO") {
+ type = S_TO;
+ weight = 2;
+ } else if (a.name == "UNANSWERED") {
+ type = S_UNANSWERED;
+ weight = 1;
+ } else if (a.name == "UNDELETED") {
+ type = S_UNDELETED;
+ weight = 1;
+ } else if (a.name == "UNFLAGGED") {
+ type = S_UNFLAGGED;
+ weight = 1;
+ } else if (a.name == "UNKEYWORD") {
+ type = S_UNKEYWORD;
+ weight = 1;
+ } else if (a.name == "UNSEEN") {
+ type = S_UNSEEN;
+ weight = 1;
+ } else if (a.name == "DRAFT") {
+ type = S_DRAFT;
+ weight = 1;
+ } else if (a.name == "HEADER") {
+ type = S_HEADER;
+ weight = 3;
+ } else if (a.name == "LARGER") {
+ type = S_LARGER;
+ weight = 4;
+ } else if (a.name == "NOT") {
// ******* NOT
type = S_NOT;
weight = 1;
@@ -401,16 +452,26 @@ void SearchOperator::SearchNode::init(const BincImapParserSearchKey &a)
++i;
}
- } else if (a.name == "SENTBEFORE") { type = S_SENTBEFORE; weight = 1; }
- else if (a.name == "SENTON") { type = S_SENTON; weight = 1; }
- else if (a.name == "SENTSINCE") { type = S_SENTSINCE; weight = 1; }
- else if (a.name == "SMALLER") { type = S_SMALLER; weight = 4; }
- else if (a.name == "UID") {
+ } else if (a.name == "SENTBEFORE") {
+ type = S_SENTBEFORE;
+ weight = 1;
+ } else if (a.name == "SENTON") {
+ type = S_SENTON;
+ weight = 1;
+ } else if (a.name == "SENTSINCE") {
+ type = S_SENTSINCE;
+ weight = 1;
+ } else if (a.name == "SMALLER") {
+ type = S_SMALLER;
+ weight = 4;
+ } else if (a.name == "UID") {
bset = &a.getSet();
type = S_UID;
weight = 1;
- } else if (a.name == "UNDRAFT") { type = S_UNDRAFT; weight = 1; }
- else if (a.type == BincImapParserSearchKey::KEY_SET) {
+ } else if (a.name == "UNDRAFT") {
+ type = S_UNDRAFT;
+ weight = 1;
+ } else if (a.type == BincImapParserSearchKey::KEY_SET) {
bset = &a.getSet();
type = S_SET;
weight = 1;
@@ -444,21 +505,16 @@ void SearchOperator::SearchNode::setWeight(int i)
//----------------------------------------------------------------------
void SearchOperator::SearchNode::order(void)
{
- for (vector<SearchNode>::iterator i = children.begin();
- i != children.end(); ++i)
+ for (vector<SearchNode>::iterator i = children.begin(); i != children.end(); ++i)
(*i).order();
::stable_sort(children.begin(), children.end(), compareNodes);
}
//----------------------------------------------------------------------
-SearchOperator::SearchOperator(void)
-{
-}
+SearchOperator::SearchOperator(void) {}
//----------------------------------------------------------------------
-SearchOperator::~SearchOperator(void)
-{
-}
+SearchOperator::~SearchOperator(void) {}
//----------------------------------------------------------------------
const string SearchOperator::getName(void) const
@@ -473,16 +529,14 @@ int SearchOperator::getState(void) const
}
//------------------------------------------------------------------------
-Operator::ProcessResult SearchOperator::process(Depot &depot,
- Request &command)
+Operator::ProcessResult SearchOperator::process(Depot &depot, Request &command)
{
Session &session = Session::getInstance();
Mailbox *mailbox = depot.getSelected();
if (command.getCharSet() != "" && command.getCharSet() != "US-ASCII") {
- session.setLastError("The " + command.getCharSet()
- + " charset is not supported");
+ session.setLastError("The " + command.getCharSet() + " charset is not supported");
session.setResponseCode("[BADCHARSET (\"US-ASCII\")]");
return NO;
}
@@ -496,14 +550,12 @@ Operator::ProcessResult SearchOperator::process(Depot &depot,
const unsigned int maxsqnr = mailbox->getMaxSqnr();
const unsigned int maxuid = mailbox->getMaxUid();
- Mailbox::iterator i
- = mailbox->begin(SequenceSet::all(), Mailbox::SKIP_EXPUNGED);
+ Mailbox::iterator i = mailbox->begin(SequenceSet::all(), Mailbox::SKIP_EXPUNGED);
for (; i != mailbox->end(); ++i) {
Message &message = *i;
if (s.match(mailbox, &message, i.getSqnr(), maxsqnr, maxuid)) {
- bincClient << " "
- << (command.getUidMode() ? message.getUID() : i.getSqnr());
+ bincClient << " " << (command.getUidMode() ? message.getUID() : i.getSqnr());
bincClient.flush();
}
@@ -515,7 +567,7 @@ Operator::ProcessResult SearchOperator::process(Depot &depot,
}
//------------------------------------------------------------------------
-Operator::ParseResult SearchOperator::parse(Request & c_in) const
+Operator::ParseResult SearchOperator::parse(Request &c_in) const
{
Session &session = Session::getInstance();
@@ -538,7 +590,7 @@ Operator::ParseResult SearchOperator::parse(Request & c_in) const
}
c_in.setCharSet(charset);
-
+
if ((res = expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE after CHARSET SPACE astring");
return res;
@@ -553,17 +605,16 @@ Operator::ParseResult SearchOperator::parse(Request & c_in) const
c_in.searchkey.type = BincImapParserSearchKey::KEY_AND;
c_in.searchkey.children.push_back(b);
-
+
while (1) {
- if ((res = expectSPACE()) != ACCEPT)
- break;
+ if ((res = expectSPACE()) != ACCEPT) break;
BincImapParserSearchKey c;
if ((res = expectSearchKey(c)) != ACCEPT) {
session.setLastError("Expected search_key after search_key SPACE");
return res;
}
-
+
c_in.searchkey.children.push_back(c);
}
@@ -571,21 +622,22 @@ Operator::ParseResult SearchOperator::parse(Request & c_in) const
session.setLastError("Expected CRLF after search_key");
return res;
}
-
+
c_in.setName("SEARCH");
return ACCEPT;
}
//----------------------------------------------------------------------
-Operator::ParseResult
-SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
+Operator::ParseResult SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
{
Session &session = Session::getInstance();
Operator::ParseResult res;
s_in.type = BincImapParserSearchKey::KEY_OTHER;
- if ((res = expectThisString("ALL")) == ACCEPT) s_in.name = "ALL";
- else if ((res = expectThisString("ANSWERED")) == ACCEPT) s_in.name = "ANSWERED";
+ if ((res = expectThisString("ALL")) == ACCEPT)
+ s_in.name = "ALL";
+ else if ((res = expectThisString("ANSWERED")) == ACCEPT)
+ s_in.name = "ANSWERED";
else if ((res = expectThisString("BCC")) == ACCEPT) {
s_in.name = "BCC";
if ((res = expectSPACE()) != ACCEPT) {
@@ -599,7 +651,7 @@ SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
}
} else if ((res = expectThisString("BEFORE")) == ACCEPT) {
s_in.name = "BEFORE";
-
+
if ((res = expectSPACE()) != ACCEPT) {
session.setLastError("Expected SPACE");
return res;
@@ -631,8 +683,10 @@ SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
session.setLastError("Expected astring");
return res;
}
- } else if ((res = expectThisString("DELETED")) == ACCEPT) s_in.name = "DELETED";
- else if ((res = expectThisString("FLAGGED")) == ACCEPT) s_in.name = "FLAGGED";
+ } else if ((res = expectThisString("DELETED")) == ACCEPT)
+ s_in.name = "DELETED";
+ else if ((res = expectThisString("FLAGGED")) == ACCEPT)
+ s_in.name = "FLAGGED";
else if ((res = expectThisString("FROM")) == ACCEPT) {
s_in.name = "FROM";
if ((res = expectSPACE()) != ACCEPT) {
@@ -655,8 +709,10 @@ SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
session.setLastError("Expected flag_keyword");
return res;
}
- } else if ((res = expectThisString("NEW")) == ACCEPT) s_in.name = "NEW";
- else if ((res = expectThisString("OLD")) == ACCEPT) s_in.name = "OLD";
+ } else if ((res = expectThisString("NEW")) == ACCEPT)
+ s_in.name = "NEW";
+ else if ((res = expectThisString("OLD")) == ACCEPT)
+ s_in.name = "OLD";
else if ((res = expectThisString("ON")) == ACCEPT) {
s_in.name = "ON";
@@ -669,8 +725,10 @@ SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
session.setLastError("Expected date");
return res;
}
- } else if ((res = expectThisString("RECENT")) == ACCEPT) s_in.name = "RECENT";
- else if ((res = expectThisString("SEEN")) == ACCEPT) s_in.name = "SEEN";
+ } else if ((res = expectThisString("RECENT")) == ACCEPT)
+ s_in.name = "RECENT";
+ else if ((res = expectThisString("SEEN")) == ACCEPT)
+ s_in.name = "SEEN";
else if ((res = expectThisString("SINCE")) == ACCEPT) {
s_in.name = "SINCE";
@@ -680,7 +738,7 @@ SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
}
if ((res = expectDate(s_in.date)) != ACCEPT) {
- session.setLastError("Expected date");
+ session.setLastError("Expected date");
return res;
}
} else if ((res = expectThisString("SUBJECT")) == ACCEPT) {
@@ -718,8 +776,10 @@ SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
}
} else if ((res = expectThisString("UNANSWERED")) == ACCEPT)
s_in.name = "UNANSWERED";
- else if ((res = expectThisString("UNDELETED")) == ACCEPT) s_in.name = "UNDELETED";
- else if ((res = expectThisString("UNFLAGGED")) == ACCEPT) s_in.name = "UNFLAGGED";
+ else if ((res = expectThisString("UNDELETED")) == ACCEPT)
+ s_in.name = "UNDELETED";
+ else if ((res = expectThisString("UNFLAGGED")) == ACCEPT)
+ s_in.name = "UNFLAGGED";
else if ((res = expectThisString("UNKEYWORD")) == ACCEPT) {
s_in.name = "UNKEYWORD";
if ((res = expectSPACE()) != ACCEPT) {
@@ -731,9 +791,11 @@ SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
session.setLastError("Expected flag_keyword");
return res;
}
- } else if ((res = expectThisString("UNSEEN")) == ACCEPT) s_in.name = "UNSEEN";
- else if ((res = expectThisString("DRAFT")) == ACCEPT) s_in.name = "DRAFT";
- else if ((res = expectThisString("HEADER")) == ACCEPT) {
+ } else if ((res = expectThisString("UNSEEN")) == ACCEPT)
+ s_in.name = "UNSEEN";
+ else if ((res = expectThisString("DRAFT")) == ACCEPT)
+ s_in.name = "DRAFT";
+ else if ((res = expectThisString("HEADER")) == ACCEPT) {
s_in.name = "HEADER";
if ((res = expectSPACE()) != ACCEPT) {
@@ -829,7 +891,7 @@ SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
}
if ((res = expectDate(s_in.date)) != ACCEPT) {
- session.setLastError("Expected date");
+ session.setLastError("Expected date");
return res;
}
@@ -867,7 +929,7 @@ SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
session.setLastError("Expected number");
return res;
}
- } else if ((res = expectThisString("UNDRAFT")) == ACCEPT)
+ } else if ((res = expectThisString("UNDRAFT")) == ACCEPT)
s_in.name = "UNDRAFT";
else if ((res = expectSet(s_in.bset)) == ACCEPT) {
s_in.name = "";
@@ -878,7 +940,7 @@ SearchOperator::expectSearchKey(BincImapParserSearchKey &s_in) const
while (1) {
BincImapParserSearchKey c;
if ((res = expectSearchKey(c)) != ACCEPT) {
- session.setLastError("Expected search_key");
+ session.setLastError("Expected search_key");
return res;
}