summaryrefslogtreecommitdiff
path: root/src/operator-lsub.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/operator-lsub.cc')
-rw-r--r--src/operator-lsub.cc49
1 files changed, 19 insertions, 30 deletions
diff --git a/src/operator-lsub.cc b/src/operator-lsub.cc
index f776503..e2bd07d 100644
--- a/src/operator-lsub.cc
+++ b/src/operator-lsub.cc
@@ -2,13 +2,8 @@
* @file operator-lsub.cc
* @brief Implementation of the LSUB command.
* @author Andreas Aardal Hanssen
- * @date 2002-2005
+ * @date 2002-2005
* ----------------------------------------------------------------- **/
-#include <algorithm>
-#include <string>
-#include <vector>
-#include <iostream>
-
#include "convert.h"
#include "depot.h"
#include "iodevice.h"
@@ -19,25 +14,26 @@
#include "regmatch.h"
#include "session.h"
+#include <algorithm>
+#include <iostream>
+#include <string>
+#include <vector>
+
namespace {
- const int DIR_SELECT = 0x01;
- const int DIR_MARKED = 0x02;
+ const int DIR_SELECT = 0x01;
+ const int DIR_MARKED = 0x02;
const int DIR_NOINFERIORS = 0x04;
- const int DIR_LEAF = 0x08;
+ const int DIR_LEAF = 0x08;
}
using namespace ::std;
using namespace Binc;
//----------------------------------------------------------------------
-LsubOperator::LsubOperator(void)
-{
-}
+LsubOperator::LsubOperator(void) {}
//----------------------------------------------------------------------
-LsubOperator::~LsubOperator(void)
-{
-}
+LsubOperator::~LsubOperator(void) {}
//----------------------------------------------------------------------
const string LsubOperator::getName(void) const
@@ -52,8 +48,7 @@ int LsubOperator::getState(void) const
}
//------------------------------------------------------------------------
-Operator::ProcessResult LsubOperator::process(Depot &depot,
- Request &command)
+Operator::ProcessResult LsubOperator::process(Depot &depot, Request &command)
{
const char delim = depot.getDelimiter();
@@ -65,8 +60,7 @@ Operator::ProcessResult LsubOperator::process(Depot &depot,
string regex = toRegex(wildcard, depot.getDelimiter());
string wildcardLower = regex;
lowercase(wildcardLower);
- if (wildcardLower.substr(0, 6) == "^inbox")
- regex = "^[iI][nN][bB][oO][xX]" + regex.substr(6);
+ if (wildcardLower.substr(0, 6) == "^inbox") regex = "^[iI][nN][bB][oO][xX]" + regex.substr(6);
// remove leading or trailing delimiter in reference
string ref = command.getMailbox();
@@ -87,8 +81,7 @@ Operator::ProcessResult LsubOperator::process(Depot &depot,
Mailbox *m = 0;
// skip entries that are not identified as mailboxes
- if ((m = depot.get(mpath)) == 0)
- continue;
+ if ((m = depot.get(mpath)) == 0) continue;
// convert file name to mailbox name. skip it if there is no
// corresponding mailbox name.
@@ -149,9 +142,8 @@ Operator::ProcessResult LsubOperator::process(Depot &depot,
vector<string> subscribed = depot.getSubscriptions();
sort(subscribed.begin(), subscribed.end());
- // finally, print all mailbox entries with flags.
- for (vector<string>::const_iterator j = subscribed.begin();
- j != subscribed.end(); ++j) {
+ // finally, print all mailbox entries with flags.
+ for (vector<string>::const_iterator j = subscribed.begin(); j != subscribed.end(); ++j) {
if (ref == "" || (ref.length() <= (*j).length() && ref == (*j).substr(0, ref.length())))
if (regexMatch((*j).substr(ref.length()), regex) == 0) {
int flags = 0;
@@ -181,10 +173,8 @@ Operator::ProcessResult LsubOperator::process(Depot &depot,
else
bincClient << sep << "\\HasChildren";
sep = " ";
- if (flags & DIR_NOINFERIORS)
- bincClient << sep << "\\Noinferiors";
- bincClient << ") \"" << depot.getDelimiter() << "\" "
- << toImapString(*j) << endl;
+ if (flags & DIR_NOINFERIORS) bincClient << sep << "\\Noinferiors";
+ bincClient << ") \"" << depot.getDelimiter() << "\" " << toImapString(*j) << endl;
}
}
@@ -196,8 +186,7 @@ Operator::ParseResult LsubOperator::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) {