summaryrefslogtreecommitdiff
path: root/src/operator-status.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/operator-status.cc')
-rw-r--r--src/operator-status.cc35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/operator-status.cc b/src/operator-status.cc
index 82c3bcf..2422747 100644
--- a/src/operator-status.cc
+++ b/src/operator-status.cc
@@ -1,9 +1,10 @@
-/** --------------------------------------------------------------------
+/**
* @file operator-status.cc
* @brief Implementation of the STATUS command.
* @author Andreas Aardal Hanssen
* @date 2002-2005
- * ----------------------------------------------------------------- **/
+ */
+
#include "convert.h"
#include "depot.h"
#include "iodevice.h"
@@ -21,28 +22,22 @@
#include <sys/stat.h>
#include <sys/types.h>
-using namespace ::std;
using namespace Binc;
-//----------------------------------------------------------------------
StatusOperator::StatusOperator(void) {}
-//----------------------------------------------------------------------
StatusOperator::~StatusOperator(void) {}
-//----------------------------------------------------------------------
-const string StatusOperator::getName(void) const
+const std::string StatusOperator::getName(void) const
{
return "STATUS";
}
-//----------------------------------------------------------------------
int StatusOperator::getState(void) const
{
return Session::AUTHENTICATED | Session::SELECTED;
}
-//------------------------------------------------------------------------
Operator::ProcessResult StatusOperator::process(Depot &depot, Request &command)
{
Session &session = Session::getInstance();
@@ -55,9 +50,8 @@ Operator::ProcessResult StatusOperator::process(Depot &depot, Request &command)
bincClient << "* STATUS " << toImapString(command.getMailbox()) << " (";
- string prefix;
- for (vector<string>::const_iterator i = command.statuses.begin(); i != command.statuses.end(); ++i) {
- string tmp = *i;
+ std::string prefix;
+ for (auto tmp : command.statuses) {
uppercase(tmp);
if (tmp == "UIDNEXT") {
bincClient << prefix << "UIDNEXT " << status.getUidNext();
@@ -76,12 +70,11 @@ Operator::ProcessResult StatusOperator::process(Depot &depot, Request &command)
prefix = " ";
}
}
- bincClient << ")" << endl;
+ bincClient << ")" << std::endl;
return OK;
}
-//----------------------------------------------------------------------
Operator::ParseResult StatusOperator::parse(Request &c_in) const
{
Session &session = Session::getInstance();
@@ -94,7 +87,7 @@ Operator::ParseResult StatusOperator::parse(Request &c_in) const
return res;
}
- string mailbox;
+ std::string mailbox;
if ((res = expectMailbox(mailbox)) != ACCEPT) {
session.setLastError("Expected mailbox");
return res;
@@ -113,17 +106,17 @@ Operator::ParseResult StatusOperator::parse(Request &c_in) const
}
while (1) {
- if ((res = expectThisString("MESSAGES")) == ACCEPT)
+ if ((res = expectThisString("MESSAGES")) == ACCEPT) {
c_in.getStatuses().push_back("MESSAGES");
- else if ((res = expectThisString("RECENT")) == ACCEPT)
+ } else if ((res = expectThisString("RECENT")) == ACCEPT) {
c_in.getStatuses().push_back("RECENT");
- else if ((res = expectThisString("UIDNEXT")) == ACCEPT)
+ } else if ((res = expectThisString("UIDNEXT")) == ACCEPT) {
c_in.getStatuses().push_back("UIDNEXT");
- else if ((res = expectThisString("UIDVALIDITY")) == ACCEPT)
+ } else if ((res = expectThisString("UIDVALIDITY")) == ACCEPT) {
c_in.getStatuses().push_back("UIDVALIDITY");
- else if ((res = expectThisString("UNSEEN")) == ACCEPT)
+ } else if ((res = expectThisString("UNSEEN")) == ACCEPT) {
c_in.getStatuses().push_back("UNSEEN");
- else {
+ } else {
session.setLastError("Expected status_att");
return res;
}