summaryrefslogtreecommitdiff
path: root/src/operator-select.cc
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-10-07 18:49:13 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-10-08 11:35:51 +0200
commit3b1278f5459514a6d6364f068ff97b8a0432057b (patch)
tree6e1369f28c64b45ac3254225242ebf3844ad0291 /src/operator-select.cc
parentc0234d1b0cea8ac830e9397da8b2270a8f2b45ca (diff)
formatted source and header files
Diffstat (limited to 'src/operator-select.cc')
-rw-r--r--src/operator-select.cc71
1 files changed, 28 insertions, 43 deletions
diff --git a/src/operator-select.cc b/src/operator-select.cc
index 854783a..64c4be6 100644
--- a/src/operator-select.cc
+++ b/src/operator-select.cc
@@ -4,30 +4,26 @@
* @author Andreas Aardal Hanssen
* @date 2002-2005
* ----------------------------------------------------------------- **/
-#include <string>
-
+#include "convert.h"
#include "depot.h"
#include "iodevice.h"
#include "iofactory.h"
#include "mailbox.h"
#include "operators.h"
-#include "recursivedescent.h"
#include "pendingupdates.h"
+#include "recursivedescent.h"
#include "session.h"
-#include "convert.h"
+
+#include <string>
using namespace ::std;
using namespace Binc;
//----------------------------------------------------------------------
-SelectOperator::SelectOperator(void)
-{
-}
+SelectOperator::SelectOperator(void) {}
//----------------------------------------------------------------------
-SelectOperator::~SelectOperator(void)
-{
-}
+SelectOperator::~SelectOperator(void) {}
//----------------------------------------------------------------------
const string SelectOperator::getName(void) const
@@ -38,14 +34,11 @@ const string SelectOperator::getName(void) const
//----------------------------------------------------------------------
int SelectOperator::getState(void) const
{
- return Session::NONAUTHENTICATED
- | Session::AUTHENTICATED
- | Session::SELECTED;
+ return Session::NONAUTHENTICATED | Session::AUTHENTICATED | Session::SELECTED;
}
//------------------------------------------------------------------------
-Operator::ProcessResult SelectOperator::process(Depot &depot,
- Request &command)
+Operator::ProcessResult SelectOperator::process(Depot &depot, Request &command)
{
Session &session = Session::getInstance();
@@ -68,18 +61,15 @@ Operator::ProcessResult SelectOperator::process(Depot &depot,
mailbox->setReadOnly(examine);
- if (!mailbox->selectMailbox(canonmailbox,
- depot.mailboxToFilename(canonmailbox))) {
- bincWarning << "selecting mailbox failed: "
- << mailbox->getLastError() << endl;
+ if (!mailbox->selectMailbox(canonmailbox, depot.mailboxToFilename(canonmailbox))) {
+ bincWarning << "selecting mailbox failed: " << mailbox->getLastError() << endl;
session.setLastError(mailbox->getLastError());
return NO;
}
// find first unseen
int unseen = -1;
- Mailbox::iterator i = mailbox->begin(SequenceSet::all(),
- Mailbox::SKIP_EXPUNGED | Mailbox::SQNR_MODE);
+ Mailbox::iterator i = mailbox->begin(SequenceSet::all(), Mailbox::SKIP_EXPUNGED | Mailbox::SQNR_MODE);
for (; i != mailbox->end(); ++i) {
Message &message = *i;
@@ -91,32 +81,30 @@ Operator::ProcessResult SelectOperator::process(Depot &depot,
// show pending updates with only exists and recent response. do not
// re-scan.
- pendingUpdates(mailbox, PendingUpdates::EXISTS
- | PendingUpdates::RECENT, false, true);
+ pendingUpdates(mailbox, PendingUpdates::EXISTS | PendingUpdates::RECENT, false, true);
// unseen
if (unseen != -1)
- bincClient << "*" << " OK [UNSEEN " << unseen << "] Message "
- << unseen << " is first unseen" << endl;
+ bincClient << "*"
+ << " OK [UNSEEN " << unseen << "] Message " << unseen << " is first unseen" << endl;
// uidvalidity
- bincClient << "*" << " OK [UIDVALIDITY " << mailbox->getUidValidity() << "]"
- << endl;
+ bincClient << "*"
+ << " OK [UIDVALIDITY " << mailbox->getUidValidity() << "]" << endl;
// uidnext
- bincClient << "*" << " OK [UIDNEXT " << toString(mailbox->getUidNext()) << "] "
- << toString(mailbox->getUidNext()) << " is the next UID" << endl;
+ bincClient << "*"
+ << " OK [UIDNEXT " << toString(mailbox->getUidNext()) << "] "
+ << toString(mailbox->getUidNext()) << " is the next UID" << endl;
// flags
- bincClient << "*"
- << " FLAGS (\\Answered \\Flagged \\Deleted \\Recent \\Seen \\Draft \\*)"
- << endl;
+ bincClient << "*"
+ << " FLAGS (\\Answered \\Flagged \\Deleted \\Recent \\Seen \\Draft \\*)" << endl;
// permanentflags
- bincClient << "*"
- << " OK [PERMANENTFLAGS (\\Answered \\Flagged \\Deleted "
- << "\\Seen \\Draft \\*)] Limited"
- << endl;
+ bincClient << "*"
+ << " OK [PERMANENTFLAGS (\\Answered \\Flagged \\Deleted "
+ << "\\Seen \\Draft \\*)] Limited" << endl;
session.setState(Session::SELECTED);
depot.setSelected(mailbox);
@@ -130,8 +118,7 @@ Operator::ParseResult SelectOperator::parse(Request &c_in) const
{
Session &session = Session::getInstance();
- if (c_in.getUidMode())
- return REJECT;
+ if (c_in.getUidMode()) return REJECT;
Operator::ParseResult res;
if ((res = expectSPACE()) != ACCEPT) {
@@ -139,16 +126,14 @@ Operator::ParseResult SelectOperator::parse(Request &c_in) const
return res;
}
- string mailbox;
+ string mailbox;
if ((res = expectMailbox(mailbox)) != ACCEPT) {
- session.setLastError("Expected mailbox after " + c_in.getName()
- + " SPACE");
+ session.setLastError("Expected mailbox after " + c_in.getName() + " SPACE");
return res;
}
if ((res = expectCRLF()) != ACCEPT) {
- session.setLastError("Expected CRLF after " + c_in.getName()
- + " SPACE mailbox");
+ session.setLastError("Expected CRLF after " + c_in.getName() + " SPACE mailbox");
return res;
}