summaryrefslogtreecommitdiff
path: root/src/include
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/include
parentc0234d1b0cea8ac830e9397da8b2270a8f2b45ca (diff)
formatted source and header files
Diffstat (limited to 'src/include')
-rw-r--r--src/include/argparser.h14
-rw-r--r--src/include/authenticate.h10
-rw-r--r--src/include/broker.h12
-rw-r--r--src/include/convert.h109
-rw-r--r--src/include/depot.h11
-rw-r--r--src/include/globals.h10
-rw-r--r--src/include/imapparser.h23
-rw-r--r--src/include/imapserver.h2
-rw-r--r--src/include/iodevice.h54
-rw-r--r--src/include/iofactory.h37
-rw-r--r--src/include/mailbox.h48
-rw-r--r--src/include/maildir.h53
-rw-r--r--src/include/maildirmessage.h42
-rw-r--r--src/include/message.h43
-rw-r--r--src/include/mime-inputsource.h32
-rw-r--r--src/include/mime-utils.h10
-rw-r--r--src/include/mime.h96
-rw-r--r--src/include/operators.h96
-rw-r--r--src/include/pendingupdates.h38
-rw-r--r--src/include/recursivedescent.h8
-rw-r--r--src/include/session.h18
-rw-r--r--src/include/status.h73
-rw-r--r--src/include/stdiodevice.h4
-rw-r--r--src/include/syslogdevice.h8
24 files changed, 466 insertions, 385 deletions
diff --git a/src/include/argparser.h b/src/include/argparser.h
index 6106974..ba7838d 100644
--- a/src/include/argparser.h
+++ b/src/include/argparser.h
@@ -18,8 +18,7 @@ namespace Binc {
bool o;
std::string desc;
- inline ArgOpts(const std::string &chr, bool boolean, bool optional,
- const std::string &descr)
+ inline ArgOpts(const std::string &chr, bool boolean, bool optional, const std::string &descr)
{
c = chr;
b = boolean;
@@ -37,12 +36,10 @@ namespace Binc {
int argc(void) const;
- const std::string operator [](const std::string &arg) const;
+ const std::string operator[](const std::string &arg) const;
- void addOptional(const std::string &arg, const std::string &desc,
- bool boolean);
- void addRequired(const std::string &arg, const std::string &desc,
- bool boolean);
+ void addOptional(const std::string &arg, const std::string &desc, bool boolean);
+ void addRequired(const std::string &arg, const std::string &desc, bool boolean);
bool hasArg(const std::string &arg) const;
std::string usageString(void) const;
@@ -52,8 +49,7 @@ namespace Binc {
const std::vector<std::string> &getUnqualifiedArgs() const;
private:
- void registerArg(const std::string &arg, const std::string &desc,
- bool boolean, bool optional);
+ void registerArg(const std::string &arg, const std::string &desc, bool boolean, bool optional);
std::string errString;
std::map<std::string, ArgOpts> reg;
diff --git a/src/include/authenticate.h b/src/include/authenticate.h
index 0ef6796..a3d63ce 100644
--- a/src/include/authenticate.h
+++ b/src/include/authenticate.h
@@ -6,13 +6,15 @@
* ----------------------------------------------------------------- **/
#ifndef authenticate_h_included
#define authenticate_h_included
-#include <string>
-
#include "depot.h"
+#include <string>
+
namespace Binc {
- int authenticate(Depot &, const std::string &username,
- const std::string &password, const std::string &challenge);
+ int authenticate(Depot &,
+ const std::string &username,
+ const std::string &password,
+ const std::string &challenge);
}
#endif
diff --git a/src/include/broker.h b/src/include/broker.h
index 6d148ae..ac78041 100644
--- a/src/include/broker.h
+++ b/src/include/broker.h
@@ -9,8 +9,8 @@
#include "depot.h"
#include "operators.h"
-#include <string>
#include <map>
+#include <string>
namespace Binc {
@@ -60,7 +60,7 @@ namespace Binc {
std::map<std::string, bool> deletables;
public:
- Operator * get(const std::string &name) const;
+ Operator *get(const std::string &name) const;
void assign(const std::string &fname, Operator *o, bool deletable = false);
Operator::ParseResult parseStub(Request &cmd);
@@ -71,13 +71,9 @@ namespace Binc {
~Broker(void);
};
- inline Broker::Broker(Broker &)
- {
- }
+ inline Broker::Broker(Broker &) {}
- inline Broker::Broker(const Broker &)
- {
- }
+ inline Broker::Broker(const Broker &) {}
}
diff --git a/src/include/convert.h b/src/include/convert.h
index cea2906..9e51027 100644
--- a/src/include/convert.h
+++ b/src/include/convert.h
@@ -2,22 +2,23 @@
* @file convert.h
* @brief Declaration of miscellaneous convertion functions.
* @author Andreas Aardal Hanssen
- * @date 2002-2005
+ * @date 2002-2005
* ----------------------------------------------------------------- **/
#ifndef convert_h_included
#define convert_h_included
+#include "address.h"
+#include "depot.h"
+
#include <cstring>
-#include <string>
-#include <vector>
#include <iomanip>
#include <iostream>
+#include <string>
+#include <vector>
#include <stdio.h>
-#include <sys/stat.h>
-#include "address.h"
-#include "depot.h"
+#include <sys/stat.h>
namespace Binc {
@@ -67,7 +68,7 @@ namespace Binc {
tmp += hexchars[((c & 0xf0) >> 4)];
tmp += hexchars[c & 0x0f];
}
-
+
return tmp;
}
@@ -77,8 +78,7 @@ namespace Binc {
// const
char hexchars[] = "0123456789abcdef";
std::string tmp;
- for (std::string::const_iterator i = s.begin();
- i != s.end() && i + 1 != s.end(); i += 2) {
+ for (std::string::const_iterator i = s.begin(); i != s.end() && i + 1 != s.end(); i += 2) {
int n;
unsigned char c = *i;
unsigned char d = *(i + 1);
@@ -91,14 +91,14 @@ namespace Binc {
n += (t - hexchars);
if (n >= 0 && n <= 255)
- tmp += (char) n;
+ tmp += (char)n;
else
return "out of range";
}
return tmp;
}
-
+
//----------------------------------------------------------------------
inline std::string toImapString(const std::string &s_in)
{
@@ -142,8 +142,7 @@ namespace Binc {
}
//----------------------------------------------------------------------
- inline const std::string unfold(const std::string &a,
- bool removecomment = true)
+ inline const std::string unfold(const std::string &a, bool removecomment = true)
{
std::string tmp;
bool incomment = false;
@@ -152,55 +151,55 @@ namespace Binc {
unsigned char c = (unsigned char)*i;
if (!inquotes && removecomment) {
if (c == '(') {
- incomment = true;
+ incomment = true;
tmp += " ";
} else if (c == ')') {
- incomment = false;
+ incomment = false;
} else if (c != 0x0a && c != 0x0d) {
- tmp += *i;
+ tmp += *i;
}
} else if (c != 0x0a && c != 0x0d) {
- tmp += *i;
+ tmp += *i;
}
if (!incomment) {
- if (*i == '\"')
- inquotes = !inquotes;
+ if (*i == '\"') inquotes = !inquotes;
}
}
trim(tmp);
return tmp;
}
-
+
//----------------------------------------------------------------------
- inline void split(const std::string &s_in, const std::string &delim,
- std::vector<std::string> &dest, bool skipempty = true)
+ inline void split(const std::string &s_in,
+ const std::string &delim,
+ std::vector<std::string> &dest,
+ bool skipempty = true)
{
std::string token;
for (std::string::const_iterator i = s_in.begin(); i != s_in.end(); ++i) {
if (delim.find(*i) != std::string::npos) {
- if (!skipempty || token != "")
- dest.push_back(token);
+ if (!skipempty || token != "") dest.push_back(token);
token = "";
} else
token += *i;
}
- if (token != "")
- dest.push_back(token);
+ if (token != "") dest.push_back(token);
}
//----------------------------------------------------------------------
- inline void splitAddr(const std::string &s_in,
- std::vector<std::string> &dest, bool skipempty = true)
+ inline void splitAddr(const std::string &s_in, std::vector<std::string> &dest, bool skipempty = true)
{
static const std::string delim = ",";
std::string token;
bool inquote = false;
for (std::string::const_iterator i = s_in.begin(); i != s_in.end(); ++i) {
- if (inquote && *i == '\"') inquote = false;
- else if (!inquote && *i == '\"') inquote = true;
+ if (inquote && *i == '\"')
+ inquote = false;
+ else if (!inquote && *i == '\"')
+ inquote = true;
if (!inquote && delim.find(*i) != std::string::npos) {
if (!skipempty || token != "") dest.push_back(token);
@@ -208,8 +207,7 @@ namespace Binc {
} else
token += *i;
}
- if (token != "")
- dest.push_back(token);
+ if (token != "") dest.push_back(token);
}
//----------------------------------------------------------------------
@@ -220,8 +218,7 @@ namespace Binc {
if (s_in.length() >= 5) {
std::string a = s_in.substr(0, 5);
uppercase(a);
- return a == "INBOX" ?
- a + (s_in.length() > 5 ? s_in.substr(5) : "") : s_in;
+ return a == "INBOX" ? a + (s_in.length() > 5 ? s_in.substr(5) : "") : s_in;
}
return s_in;
@@ -232,22 +229,22 @@ namespace Binc {
{
std::string regex = "^";
for (std::string::const_iterator i = s_in.begin(); i != s_in.end(); ++i) {
- if (*i == '.' || *i == '[' || *i == ']' || *i == '{' || *i == '}' ||
- *i == '(' || *i == ')' || *i == '^' || *i == '$' || *i == '?' ||
- *i == '+' || *i == '\\') {
- regex += "\\";
- regex += *i;
- } else if (*i == '*')
- regex += ".*?";
- else if (*i == '%') {
- regex += "(\\";
- regex += delimiter;
- regex += "){0,1}";
- regex += "[^\\";
- regex += delimiter;
- regex += "]*?";
- } else
- regex += *i;
+ if (*i == '.' || *i == '[' || *i == ']' || *i == '{' || *i == '}' || *i == '(' || *i == ')'
+ || *i == '^' || *i == '$' || *i == '?' || *i == '+' || *i == '\\')
+ {
+ regex += "\\";
+ regex += *i;
+ } else if (*i == '*')
+ regex += ".*?";
+ else if (*i == '%') {
+ regex += "(\\";
+ regex += delimiter;
+ regex += "){0,1}";
+ regex += "[^\\";
+ regex += delimiter;
+ regex += "]*?";
+ } else
+ regex += *i;
}
if (regex[regex.length() - 1] == '?')
@@ -265,12 +262,12 @@ namespace Binc {
public:
//--
- BincStream &operator << (std::ostream&(*)(std::ostream&));
- BincStream &operator << (const std::string &t);
- BincStream &operator << (unsigned long t);
- BincStream &operator << (unsigned int t);
- BincStream &operator << (int t);
- BincStream &operator << (char t);
+ BincStream &operator<<(std::ostream &(*)(std::ostream &));
+ BincStream &operator<<(const std::string &t);
+ BincStream &operator<<(unsigned long t);
+ BincStream &operator<<(unsigned int t);
+ BincStream &operator<<(int t);
+ BincStream &operator<<(char t);
//--
std::string popString(unsigned int size);
diff --git a/src/include/depot.h b/src/include/depot.h
index 844a987..bd4f743 100644
--- a/src/include/depot.h
+++ b/src/include/depot.h
@@ -38,10 +38,10 @@ namespace Binc {
//--
class iterator {
public:
- std::string operator * (void) const;
- void operator ++ (void);
- bool operator != (iterator) const;
- bool operator == (iterator) const;
+ std::string operator*(void) const;
+ void operator++(void);
+ bool operator!=(iterator) const;
+ bool operator==(iterator) const;
iterator(void);
iterator(const iterator &copy);
@@ -50,7 +50,7 @@ namespace Binc {
void deref(void);
- iterator &operator =(const iterator &copy);
+ iterator &operator=(const iterator &copy);
friend class Depot;
@@ -134,6 +134,7 @@ namespace Binc {
//--
MaildirPPDepot();
~MaildirPPDepot();
+
private:
std::string privateNamespace;
};
diff --git a/src/include/globals.h b/src/include/globals.h
index dd63b5f..d86ae4d 100644
--- a/src/include/globals.h
+++ b/src/include/globals.h
@@ -9,15 +9,15 @@
#define BINC_VERSION "2.0.14"
#define IMAP_VERSION "IMAP4rev1"
-#define BINC_CACHE "BINC-CACHE-1.0"
-#define IMAP_PORT "143"
-#define IMAPS_PORT "993"
+#define BINC_CACHE "BINC-CACHE-1.0"
+#define IMAP_PORT "143"
+#define IMAPS_PORT "993"
namespace Binc {
- static const int IDLE_TIMEOUT = 30*60;
+ static const int IDLE_TIMEOUT = 30 * 60;
static const int AUTH_TIMEOUT = 60;
static const int AUTH_PENALTY = 5;
- static const int TRANSFER_TIMEOUT = 20*60;
+ static const int TRANSFER_TIMEOUT = 20 * 60;
static const int TRANSFER_BUFFER_SIZE = 1024;
static const int INPUT_BUFFER_LIMIT = 8192;
diff --git a/src/include/imapparser.h b/src/include/imapparser.h
index 4f77985..5dfffb4 100644
--- a/src/include/imapparser.h
+++ b/src/include/imapparser.h
@@ -2,14 +2,14 @@
* @file imapparser.h
* @brief Declaration of the common items for parsing IMAP input
* @author Andreas Aardal Hanssen
- * @date 2002-2005
+ * @date 2002-2005
* ----------------------------------------------------------------- **/
#ifndef imapparser_h_included
#define imapparser_h_included
/* stl includes */
-#include <string>
#include <map>
+#include <string>
#include <vector>
namespace Binc {
@@ -19,13 +19,17 @@ namespace Binc {
void addRange(unsigned int a_in, unsigned int b_in);
bool isInSet(unsigned int n) const;
void addNumber(unsigned int a_in);
- inline bool isLimited(void) const { return limited; }
+
+ inline bool isLimited(void) const
+ {
+ return limited;
+ }
static SequenceSet &all(void);
static SequenceSet &null(void);
- SequenceSet &operator = (const SequenceSet &copy);
+ SequenceSet &operator=(const SequenceSet &copy);
SequenceSet(void);
SequenceSet(const SequenceSet &copy);
@@ -74,11 +78,12 @@ namespace Binc {
int type;
unsigned int number;
SequenceSet bset;
- enum {KEY_AND, KEY_OR, KEY_NOT, KEY_OTHER, KEY_SET};
-
+
+ enum { KEY_AND, KEY_OR, KEY_NOT, KEY_OTHER, KEY_SET };
+
std::vector<BincImapParserSearchKey> children;
- const SequenceSet& getSet(void) const;
+ const SequenceSet &getSet(void) const;
BincImapParserSearchKey(void);
};
@@ -106,9 +111,9 @@ namespace Binc {
std::string literal;
std::string contextInfo;
bool uidmode;
-
+
public:
- BincImapParserData * extra;
+ BincImapParserData *extra;
std::vector<std::string> flags;
std::vector<std::string> statuses;
diff --git a/src/include/imapserver.h b/src/include/imapserver.h
index 940234e..d3268ba 100644
--- a/src/include/imapserver.h
+++ b/src/include/imapserver.h
@@ -19,7 +19,7 @@ namespace Binc {
enum ServerStatus {
OK,
RequestError,
- RequestIgnore, // required for StartTLS, premature answer
+ RequestIgnore, // required for StartTLS, premature answer
RequestRejected,
ClientDisconnected,
Timeout
diff --git a/src/include/iodevice.h b/src/include/iodevice.h
index 070ac3f..73dd2ab 100644
--- a/src/include/iodevice.h
+++ b/src/include/iodevice.h
@@ -7,12 +7,13 @@
#ifndef iodevice_h_included
#define iodevice_h_included
-#include "convert.h" // BincStream
-//#include <iostream>
+#include "convert.h" // BincStream
+// #include <iostream>
#include <string>
-#include <unistd.h> // ::write
-const char CMS_END_OF_LINE[4] = { 0x0d, '\n', 0x00, 0x00 };
+#include <unistd.h> // ::write
+
+const char CMS_END_OF_LINE[4] = {0x0d, '\n', 0x00, 0x00};
namespace Binc {
/*!
@@ -45,13 +46,10 @@ namespace Binc {
/*!
Errors from when an operation returned false.
*/
- enum Error {
- Unknown,
- Timeout
- };
+ enum Error { Unknown, Timeout };
/*!
- Constructs an invalid IODevice.
+ Constructs an invalid IODevice.
Instances of IODevice perform no operations, and all boolean
functions always return false. This constructor is only useful
@@ -132,13 +130,8 @@ namespace Binc {
*/
unsigned int getTimeout(void) const;
- enum LogLevel {
- ErrorLevel,
- InfoLevel,
- WarningLevel,
- DebugLevel
- };
-
+ enum LogLevel { ErrorLevel, InfoLevel, WarningLevel, DebugLevel };
+
/*!
Sets the output level for the following write operations on this
device.
@@ -210,13 +203,13 @@ namespace Binc {
\sa setMaxOutputBufferSize()
*/
- template <class T> IODevice &operator << (const T &source);
+ template<class T> IODevice &operator<<(const T &source);
/*!
Writes data to the device. This function specializes on standard
ostream derivates, such as std::endl.
*/
- IODevice &operator << (std::ostream &(*source)(std::ostream &));
+ IODevice &operator<<(std::ostream &(*source)(std::ostream &));
/*!
Returns true if data can be read from the device; otherwise
@@ -227,7 +220,7 @@ namespace Binc {
/*!
Reads data from the device, and stores this in a string. Returns
true on success; otherwise returns false.
-
+
\param dest The incoming data is stored in this string.
\param max No more than this number of bytes is read from the
device.
@@ -286,7 +279,7 @@ namespace Binc {
return values are "client" and "log".
*/
virtual std::string service(void) const;
-
+
protected:
/*!
Waits until data can be written to the device. If the timeout is
@@ -308,13 +301,9 @@ namespace Binc {
virtual bool waitForRead(void) const;
/*!
- Types of results from a write.
+ Types of results from a write.
*/
- enum WriteResult {
- WriteWait = 0,
- WriteDone = 1 << 0,
- WriteError = 1 << 1
- };
+ enum WriteResult { WriteWait = 0, WriteDone = 1 << 0, WriteError = 1 << 1 };
/*!
Writes as much data as possible to the device. If some but not
@@ -327,7 +316,7 @@ namespace Binc {
/*!
Reads data from the device, and stores it in the input buffer.
Returns true on success; otherwise returns false.
-
+
This method will fail if there is no more data available, if a
timeout occurred or if an error with the device prevents more
data from being read.
@@ -359,20 +348,19 @@ namespace Binc {
};
//----------------------------------------------------------------------
- template <class T> IODevice &IODevice::operator << (const T &source)
+ template<class T> IODevice &IODevice::operator<<(const T &source)
{
if ((flags & IsEnabled) && outputLevel <= outputLevelLimit) {
outputBuffer << source;
- if (dumpfd) {
- BincStream ss;
+ if (dumpfd) {
+ BincStream ss;
ss << source;
- ::write(dumpfd, ss.str().c_str(), ss.getSize());
+ ::write(dumpfd, ss.str().c_str(), ss.getSize());
}
if (flags & HasInputLimit)
- if (outputBuffer.getSize() > maxOutputBufferSize)
- flush();
+ if (outputBuffer.getSize() > maxOutputBufferSize) flush();
}
return *this;
diff --git a/src/include/iofactory.h b/src/include/iofactory.h
index 6ebccaa..1a50e4e 100644
--- a/src/include/iofactory.h
+++ b/src/include/iofactory.h
@@ -6,11 +6,11 @@
* ----------------------------------------------------------------- **/
#ifndef IOFACTORY_H_INCLUDED
#define IOFACTORY_H_INCLUDED
+#include "iodevice.h"
+
#include <map>
#include <string>
-#include "iodevice.h"
-
namespace Binc {
class IOFactory {
public:
@@ -23,31 +23,34 @@ namespace Binc {
private:
IOFactory(void);
-
+
std::map<std::string, IODevice *> devices;
};
}
-#define bincClient \
- IOFactory::getClient()
+#define bincClient IOFactory::getClient()
-#if defined (DEBUG)
-//#define bincError if (false) std::cout
+#if defined(DEBUG)
+// #define bincError if (false) std::cout
#define bincError std::cerr
// #define bincWarning if (false) std::cout
#define bincWarning std::cerr
-#define bincDebug std::cerr
-//#define bincDebug if (false) std::cout
+#define bincDebug std::cerr
+// #define bincDebug if (false) std::cout
#else
-#define bincError \
- IOFactory::getLogger().setOutputLevel(IODevice::ErrorLevel);IOFactory::getLogger()
-#define bincWarning \
- IOFactory::getLogger().setOutputLevel(IODevice::WarningLevel);IOFactory::getLogger()
-#define bincDebug \
- IOFactory::getLogger().setOutputLevel(IODevice::DebugLevel);IOFactory::getLogger()
+#define bincError \
+ IOFactory::getLogger().setOutputLevel(IODevice::ErrorLevel); \
+ IOFactory::getLogger()
+#define bincWarning \
+ IOFactory::getLogger().setOutputLevel(IODevice::WarningLevel); \
+ IOFactory::getLogger()
+#define bincDebug \
+ IOFactory::getLogger().setOutputLevel(IODevice::DebugLevel); \
+ IOFactory::getLogger()
#endif
-#define bincLog \
- IOFactory::getLogger().setOutputLevel(IODevice::InfoLevel);IOFactory::getLogger()
+#define bincLog \
+ IOFactory::getLogger().setOutputLevel(IODevice::InfoLevel); \
+ IOFactory::getLogger()
#endif
diff --git a/src/include/mailbox.h b/src/include/mailbox.h
index db98cc0..870a695 100644
--- a/src/include/mailbox.h
+++ b/src/include/mailbox.h
@@ -7,17 +7,18 @@
#ifndef mailbox_h_included
#define mailbox_h_included
+#include "imapparser.h"
+
#include <map>
-#include <string>
#include <queue>
+#include <string>
#include <vector>
-#include <time.h>
#include <stdio.h>
#include <string.h>
-#include <sys/types.h>
+#include <time.h>
-#include "imapparser.h"
+#include <sys/types.h>
namespace Binc {
@@ -29,17 +30,16 @@ namespace Binc {
//------------------------------------------------------------------------
class Mailbox {
public:
-
//----------------------------------------------------------------------
class BaseIterator {
public:
BaseIterator(int sqn = 0);
virtual ~BaseIterator(void);
- virtual Message &operator *(void) = 0;
- virtual void operator ++(void) = 0;
- virtual bool operator !=(const BaseIterator &d) const = 0;
- virtual bool operator ==(const BaseIterator &d) const = 0;
+ virtual Message &operator*(void) = 0;
+ virtual void operator++(void) = 0;
+ virtual bool operator!=(const BaseIterator &d) const = 0;
+ virtual bool operator==(const BaseIterator &d) const = 0;
virtual void erase(void) = 0;
@@ -51,10 +51,10 @@ namespace Binc {
public:
iterator(BaseIterator &i);
- Message &operator *(void);
- void operator ++(void);
- bool operator ==(const iterator &) const;
- bool operator !=(const iterator &) const;
+ Message &operator*(void);
+ void operator++(void);
+ bool operator==(const iterator &) const;
+ bool operator!=(const iterator &) const;
unsigned int getSqnr() const;
@@ -64,17 +64,12 @@ namespace Binc {
BaseIterator &realIterator;
};
- enum Iterator {
- INCLUDE_EXPUNGED = 1,
- SKIP_EXPUNGED = 2
- };
+ enum Iterator { INCLUDE_EXPUNGED = 1, SKIP_EXPUNGED = 2 };
- enum Mode {
- UID_MODE = 4,
- SQNR_MODE = 8
- };
+ enum Mode { UID_MODE = 4, SQNR_MODE = 8 };
- virtual iterator begin(const SequenceSet &bset, unsigned int mod = INCLUDE_EXPUNGED | SQNR_MODE) const = 0;
+ virtual iterator begin(const SequenceSet &bset,
+ unsigned int mod = INCLUDE_EXPUNGED | SQNR_MODE) const = 0;
virtual iterator end(void) const = 0;
//-- Generic for one mailbox type
@@ -97,13 +92,16 @@ namespace Binc {
virtual unsigned int getUidNext(void) const = 0;
virtual unsigned int getUidValidity(void) const = 0;
- virtual bool getUpdates(bool scan, unsigned int type,
- PendingUpdates &updates, bool forceScan) = 0;
+ virtual bool getUpdates(bool scan, unsigned int type, PendingUpdates &updates, bool forceScan) = 0;
virtual void updateFlags(void) = 0;
virtual void expungeMailbox(void) = 0;
virtual bool selectMailbox(const std::string &name, const std::string &s_in) = 0;
- virtual bool createMailbox(const std::string &s, mode_t mode, uid_t owner = 0, gid_t group = 0, bool root = false) = 0;
+ virtual bool createMailbox(const std::string &s,
+ mode_t mode,
+ uid_t owner = 0,
+ gid_t group = 0,
+ bool root = false) = 0;
virtual bool deleteMailbox(const std::string &s) = 0;
virtual void closeMailbox(void) = 0;
diff --git a/src/include/maildir.h b/src/include/maildir.h
index 4a262b5..dda88df 100644
--- a/src/include/maildir.h
+++ b/src/include/maildir.h
@@ -6,13 +6,13 @@
* ----------------------------------------------------------------- **/
#ifndef maildir_h_included
#define maildir_h_included
-#include <string>
-#include <vector>
-#include <map>
-
#include "mailbox.h"
#include "maildirmessage.h"
+#include <map>
+#include <string>
+#include <vector>
+
namespace Binc {
static const std::string CACHEFILEVERSION = "1.0.5";
static const std::string UIDVALFILEVERSION = "1.0.5";
@@ -26,7 +26,7 @@ namespace Binc {
private:
std::string lock;
};
-
+
//------------------------------------------------------------------------
class MaildirIndexItem {
public:
@@ -35,14 +35,12 @@ namespace Binc {
};
//------------------------------------------------------------------------
- class MaildirIndex
- {
+ class MaildirIndex {
private:
std::map<std::string, MaildirIndexItem> idx;
public:
- void insert(const std::string &unique, unsigned int uid,
- const std::string &fileName = "");
+ void insert(const std::string &unique, unsigned int uid, const std::string &fileName = "");
void remove(const std::string &unique);
void clear(void);
void clearFileNames(void);
@@ -59,18 +57,19 @@ namespace Binc {
class iterator : public BaseIterator {
public:
iterator(void);
- iterator(Maildir *home, MessageMap::iterator i,
+ iterator(Maildir *home,
+ MessageMap::iterator i,
const SequenceSet &bset,
unsigned int mod = INCLUDE_EXPUNGED | SQNR_MODE);
iterator(const iterator &copy);
~iterator(void);
- Message &operator *(void);
- void operator ++(void);
- bool operator ==(const BaseIterator &) const;
- bool operator !=(const BaseIterator &) const;
+ Message &operator*(void);
+ void operator++(void);
+ bool operator==(const BaseIterator &) const;
+ bool operator!=(const BaseIterator &) const;
- iterator &operator =(const iterator &copy);
+ iterator &operator=(const iterator &copy);
void erase(void);
@@ -94,7 +93,8 @@ namespace Binc {
const std::string getTypeName(void) const;
- Mailbox::iterator begin(const SequenceSet &bset, unsigned int mod = INCLUDE_EXPUNGED | SQNR_MODE) const;
+ Mailbox::iterator begin(const SequenceSet &bset,
+ unsigned int mod = INCLUDE_EXPUNGED | SQNR_MODE) const;
Mailbox::iterator end(void) const;
unsigned int getMaxUid(void) const;
@@ -102,8 +102,7 @@ namespace Binc {
unsigned int getUidValidity(void) const;
unsigned int getUidNext(void) const;
- bool getUpdates(bool doscan, unsigned int type,
- PendingUpdates &updates, bool forceScan);
+ bool getUpdates(bool doscan, unsigned int type, PendingUpdates &updates, bool forceScan);
const std::string &getPath(void) const;
void setPath(const std::string &path_in);
@@ -119,7 +118,11 @@ namespace Binc {
bool selectMailbox(const std::string &name, const std::string &s_in);
void closeMailbox(void);
void expungeMailbox(void);
- bool createMailbox(const std::string &s, mode_t mode, uid_t owner = 0, gid_t group = 0, bool root = false);
+ bool createMailbox(const std::string &s,
+ mode_t mode,
+ uid_t owner = 0,
+ gid_t group = 0,
+ bool root = false);
bool deleteMailbox(const std::string &s);
Message *createMessage(const std::string &mbox, time_t idate = 0);
@@ -136,21 +139,13 @@ namespace Binc {
friend class MaildirMessage;
protected:
- enum ReadCacheResult {
- Ok,
- NoCache,
- Error
- };
+ enum ReadCacheResult { Ok, NoCache, Error };
ReadCacheResult readCache(void);
bool writeCache(void);
bool scanFileNames(void) const;
- enum ScanResult {
- Success = 0,
- TemporaryError = 1,
- PermanentError = 2
- };
+ enum ScanResult { Success = 0, TemporaryError = 1, PermanentError = 2 };
ScanResult scan(bool forceScan = false);
diff --git a/src/include/maildirmessage.h b/src/include/maildirmessage.h
index 9e9c717..6bc2a20 100644
--- a/src/include/maildirmessage.h
+++ b/src/include/maildirmessage.h
@@ -6,19 +6,19 @@
* ----------------------------------------------------------------- **/
#ifndef maildirmessage_h_included
#define maildirmessage_h_included
-#include <string>
-#include <map>
-#include <vector>
+#include "address.h"
+#include "message.h"
+#include "mime.h"
+
#include <exception>
#include <iostream>
-#include <time.h>
+#include <map>
+#include <string>
+#include <vector>
#include <stdio.h>
#include <string.h>
-
-#include "message.h"
-#include "address.h"
-#include "mime.h"
+#include <time.h>
namespace Binc {
@@ -84,7 +84,7 @@ namespace Binc {
unsigned char getStdFlags(void) const;
/*
- */
+ */
void setCustomFlag(const std::string &flag);
void removeCustomFlag(const std::string &flag);
void resetCustomFlags(void);
@@ -187,8 +187,7 @@ namespace Binc {
*/
const std::string &getHeader(const std::string &header);
- bool headerContains(const std::string &header,
- const std::string &text);
+ bool headerContains(const std::string &header, const std::string &text);
bool bodyContains(const std::string &text);
bool textContains(const std::string &text);
@@ -202,7 +201,7 @@ namespace Binc {
bool includeHeaders = false,
unsigned int startOffset = 0,
unsigned int length = UINTMAX,
- bool mime = false) const;
+ bool mime = false) const;
unsigned int getHeaderSize(const std::string &section,
std::vector<std::string> headers,
@@ -214,9 +213,9 @@ namespace Binc {
bool printBody(const std::string &section = "",
unsigned int startOffset = 0,
unsigned int length = UINTMAX) const;
- unsigned int getBodySize(const std::string &section,
- unsigned int startOffset = 0,
- unsigned int length = UINTMAX) const;
+ unsigned int getBodySize(const std::string &section,
+ unsigned int startOffset = 0,
+ unsigned int length = UINTMAX) const;
bool printDoc(unsigned int startOffset = 0,
unsigned int length = UINTMAX,
@@ -235,10 +234,10 @@ namespace Binc {
friend class Maildir;
- bool operator < (const MaildirMessage &a) const;
+ bool operator<(const MaildirMessage &a) const;
MaildirMessage(const MaildirMessage &copy);
- MaildirMessage &operator = (const MaildirMessage &copy);
+ MaildirMessage &operator=(const MaildirMessage &copy);
enum Flags {
None = 0x00,
@@ -280,16 +279,11 @@ namespace Binc {
};
//------------------------------------------------------------------------
- class MaildirMessageCache
- {
+ class MaildirMessageCache {
public:
~MaildirMessageCache();
- enum ParseStatus {
- NotParsed,
- HeaderParsed,
- AllParsed
- };
+ enum ParseStatus { NotParsed, HeaderParsed, AllParsed };
static MaildirMessageCache &getInstance(void);
diff --git a/src/include/message.h b/src/include/message.h
index 76607e5..e1bbf2b 100644
--- a/src/include/message.h
+++ b/src/include/message.h
@@ -6,8 +6,9 @@
* ----------------------------------------------------------------- **/
#ifndef message_h_included
#define message_h_included
-#include <vector>
#include <string>
+#include <vector>
+
#include <time.h>
#ifndef UINTMAX
@@ -30,21 +31,20 @@ namespace Binc {
*/
class Message {
public:
-
/*!
Standard IMAP message flags.
*/
enum Flags {
- F_NONE = 0x00, /*!< No flag is set */
- F_SEEN = 0x01, /*!< The message has been seen */
- F_ANSWERED = 0x02, /*!< The message has been answered */
- F_DELETED = 0x04, /*!< The message is marked as deleted */
- F_DRAFT = 0x08, /*!< The message is a draft */
- F_RECENT = 0x10, /*!< The message arrived recently */
- F_FLAGGED = 0x20, /*!< The message is flagged / important */
- F_EXPUNGED = 0x40, /*!< The message has been expunged */
- F_PASSED = 0x80 /*!< The message has been bounced */
+ F_NONE = 0x00, /*!< No flag is set */
+ F_SEEN = 0x01, /*!< The message has been seen */
+ F_ANSWERED = 0x02, /*!< The message has been answered */
+ F_DELETED = 0x04, /*!< The message is marked as deleted */
+ F_DRAFT = 0x08, /*!< The message is a draft */
+ F_RECENT = 0x10, /*!< The message arrived recently */
+ F_FLAGGED = 0x20, /*!< The message is flagged / important */
+ F_EXPUNGED = 0x40, /*!< The message has been expunged */
+ F_PASSED = 0x80 /*!< The message has been bounced */
};
virtual void setUID(unsigned int) = 0;
@@ -79,8 +79,7 @@ namespace Binc {
virtual const std::string &getHeader(const std::string &header) = 0;
- virtual bool headerContains(const std::string &header,
- const std::string &text) = 0;
+ virtual bool headerContains(const std::string &header, const std::string &text) = 0;
virtual bool bodyContains(const std::string &text) = 0;
virtual bool textContains(const std::string &text) = 0;
@@ -90,11 +89,11 @@ namespace Binc {
virtual bool printEnvelope(void) const = 0;
virtual bool printHeader(const std::string &section,
- std::vector<std::string> headers,
- bool includeHeaders = false,
- unsigned int startOffset = 0,
- unsigned int length = UINTMAX,
- bool mime = false) const = 0;
+ std::vector<std::string> headers,
+ bool includeHeaders = false,
+ unsigned int startOffset = 0,
+ unsigned int length = UINTMAX,
+ bool mime = false) const = 0;
virtual unsigned int getHeaderSize(const std::string &section,
std::vector<std::string> headers,
@@ -129,13 +128,9 @@ namespace Binc {
static std::string lastError;
};
- inline Message::Message(void)
- {
- }
+ inline Message::Message(void) {}
- inline Message::~Message(void)
- {
- }
+ inline Message::~Message(void) {}
inline void Message::setLastError(const std::string &error) const
{
diff --git a/src/include/mime-inputsource.h b/src/include/mime-inputsource.h
index e37d508..8ff97f4 100644
--- a/src/include/mime-inputsource.h
+++ b/src/include/mime-inputsource.h
@@ -8,6 +8,7 @@
#define mime_inputsource_h_included
#include <string.h>
+
#include <unistd.h>
namespace Binc {
@@ -50,9 +51,7 @@ namespace Binc {
seek(start);
}
- inline MimeInputSource::~MimeInputSource(void)
- {
- }
+ inline MimeInputSource::~MimeInputSource(void) {}
inline bool MimeInputSource::fillInputBuffer(void)
{
@@ -67,18 +66,18 @@ namespace Binc {
const char c = raw[i];
if (c == '\r') {
if (lastChar == '\r') {
- data[tail++ & (0x4000-1)] = '\r';
- data[tail++ & (0x4000-1)] = '\n';
+ data[tail++ & (0x4000 - 1)] = '\r';
+ data[tail++ & (0x4000 - 1)] = '\n';
}
} else if (c == '\n') {
- data[tail++ & (0x4000-1)] = '\r';
- data[tail++ & (0x4000-1)] = '\n';
+ data[tail++ & (0x4000 - 1)] = '\r';
+ data[tail++ & (0x4000 - 1)] = '\n';
} else {
if (lastChar == '\r') {
- data[tail++ & (0x4000-1)] = '\r';
- data[tail++ & (0x4000-1)] = '\n';
+ data[tail++ & (0x4000 - 1)] = '\r';
+ data[tail++ & (0x4000 - 1)] = '\n';
}
- data[tail++ & (0x4000-1)] = c;
+ data[tail++ & (0x4000 - 1)] = c;
}
lastChar = c;
@@ -92,15 +91,13 @@ namespace Binc {
offset = head = tail = 0;
lastChar = '\0';
- if (fd != -1)
- lseek(fd, 0, SEEK_SET);
+ if (fd != -1) lseek(fd, 0, SEEK_SET);
}
inline void MimeInputSource::seek(unsigned int seekToOffset)
{
- if (offset > seekToOffset)
- reset();
-
+ if (offset > seekToOffset) reset();
+
char c;
int n = 0;
while (seekToOffset > offset) {
@@ -111,10 +108,9 @@ namespace Binc {
inline bool MimeInputSource::getChar(char *c)
{
- if (head == tail && !fillInputBuffer())
- return false;
+ if (head == tail && !fillInputBuffer()) return false;
- *c = data[head++ & (0x4000-1)];
+ *c = data[head++ & (0x4000 - 1)];
++offset;
return true;
}
diff --git a/src/include/mime-utils.h b/src/include/mime-utils.h
index 732234a..8a59041 100644
--- a/src/include/mime-utils.h
+++ b/src/include/mime-utils.h
@@ -7,19 +7,17 @@
#ifndef mime_utils_h_included
#define mime_utils_h_included
-#include <string.h>
#include <ctype.h>
-#include <stdio.h>
#include <errno.h>
+#include <stdio.h>
+#include <string.h>
using namespace ::std;
-inline bool compareStringToQueue(const char *s_in, char *bqueue,
- int pos, int size)
+inline bool compareStringToQueue(const char *s_in, char *bqueue, int pos, int size)
{
for (int i = 0; i < size; ++i)
- if (s_in[i] != bqueue[(pos + i) % size])
- return false;
+ if (s_in[i] != bqueue[(pos + i) % size]) return false;
return true;
}
diff --git a/src/include/mime.h b/src/include/mime.h
index 2033442..f35ebb2 100644
--- a/src/include/mime.h
+++ b/src/include/mime.h
@@ -6,28 +6,36 @@
* ----------------------------------------------------------------- **/
#ifndef mime_h_included
#define mime_h_included
+#include <map>
#include <string>
#include <vector>
-#include <map>
+
#include <stdio.h>
namespace Binc {
- //----------------------------------------------------------------------
+ //----------------------------------------------------------------------
class HeaderItem {
private:
mutable std::string key;
mutable std::string value;
public:
- inline const std::string &getKey(void) const { return key; }
- inline const std::string &getValue(void) const { return value; }
+ inline const std::string &getKey(void) const
+ {
+ return key;
+ }
+
+ inline const std::string &getValue(void) const
+ {
+ return value;
+ }
//--
HeaderItem(void);
HeaderItem(const std::string &key, const std::string &value);
};
- //----------------------------------------------------------------------
+ //----------------------------------------------------------------------
class Header {
private:
mutable std::vector<HeaderItem> content;
@@ -46,6 +54,7 @@ namespace Binc {
//----------------------------------------------------------------------
class IODevice;
class MimeDocument;
+
class MimePart {
protected:
public:
@@ -64,32 +73,66 @@ namespace Binc {
mutable unsigned int size;
public:
- enum FetchType {
- FetchBody,
- FetchHeader,
- FetchMime
- };
+ enum FetchType { FetchBody, FetchHeader, FetchMime };
mutable Header h;
mutable std::vector<MimePart> members;
- inline const std::string &getSubType(void) const { return subtype; }
- inline bool isMultipart(void) const { return multipart; }
- inline bool isMessageRFC822(void) const { return messagerfc822; }
- inline unsigned int getSize(void) const { return bodylength; }
- inline unsigned int getNofLines(void) const { return nlines; }
- inline unsigned int getNofBodyLines(void) const { return nbodylines; }
- inline unsigned int getBodyLength(void) const { return bodylength; }
- inline unsigned int getBodyStartOffset(void) const { return bodystartoffsetcrlf; }
+ inline const std::string &getSubType(void) const
+ {
+ return subtype;
+ }
+
+ inline bool isMultipart(void) const
+ {
+ return multipart;
+ }
+
+ inline bool isMessageRFC822(void) const
+ {
+ return messagerfc822;
+ }
+
+ inline unsigned int getSize(void) const
+ {
+ return bodylength;
+ }
+
+ inline unsigned int getNofLines(void) const
+ {
+ return nlines;
+ }
+
+ inline unsigned int getNofBodyLines(void) const
+ {
+ return nbodylines;
+ }
+
+ inline unsigned int getBodyLength(void) const
+ {
+ return bodylength;
+ }
+
+ inline unsigned int getBodyStartOffset(void) const
+ {
+ return bodystartoffsetcrlf;
+ }
void printBody(int fd, Binc::IODevice &output, unsigned int startoffset, unsigned int length) const;
- void printHeader(int fd, Binc::IODevice &output, std::vector<std::string> headers,
- bool includeheaders, unsigned int startoffset, unsigned int length, std::string &storage) const;
+ void printHeader(int fd,
+ Binc::IODevice &output,
+ std::vector<std::string> headers,
+ bool includeheaders,
+ unsigned int startoffset,
+ unsigned int length,
+ std::string &storage) const;
void printDoc(int fd, Binc::IODevice &output, unsigned int startoffset, unsigned int length) const;
virtual void clear(void) const;
- const MimePart *getPart(const std::string &findpart, std::string genpart, FetchType fetchType = FetchBody) const;
+ const MimePart *getPart(const std::string &findpart,
+ std::string genpart,
+ FetchType fetchType = FetchBody) const;
virtual int parseOnlyHeader(const std::string &toboundary) const;
virtual int parseFull(const std::string &toboundary, int &boundarysize) const;
@@ -108,8 +151,15 @@ namespace Binc {
void parseFull(int fd) const;
void clear(void) const;
- inline bool isHeaderParsed(void) { return headerIsParsed; }
- inline bool isAllParsed(void) { return allIsParsed; }
+ inline bool isHeaderParsed(void)
+ {
+ return headerIsParsed;
+ }
+
+ inline bool isAllParsed(void)
+ {
+ return allIsParsed;
+ }
//--
MimeDocument(void);
diff --git a/src/include/operators.h b/src/include/operators.h
index c030918..a4e0f74 100644
--- a/src/include/operators.h
+++ b/src/include/operators.h
@@ -6,20 +6,21 @@
* ----------------------------------------------------------------- **/
#ifndef operators_h_included
#define operators_h_included
-#include <string>
-#include <vector>
-
-#include "imapparser.h"
#include "depot.h"
+#include "imapparser.h"
#include "message.h"
+#include <string>
+#include <vector>
+
namespace Binc {
-
+
//--------------------------------------------------------------------
class Operator {
public:
- enum ProcessResult {OK, BAD, NO, NOTHING, ABORT};
- enum ParseResult {ACCEPT, REJECT, ERROR, TIMEOUT};
+ enum ProcessResult { OK, BAD, NO, NOTHING, ABORT };
+
+ enum ParseResult { ACCEPT, REJECT, ERROR, TIMEOUT };
virtual ProcessResult process(Depot &, Request &) = 0;
virtual ParseResult parse(Request &) const = 0;
@@ -27,7 +28,7 @@ namespace Binc {
virtual const std::string getName(void) const = 0;
//--
- virtual ~Operator(void) {};
+ virtual ~Operator(void){};
};
//--------------------------------------------------------------------
@@ -51,10 +52,9 @@ namespace Binc {
const std::string getName(void) const;
int getState(void) const;
- ProcessResult Login(std::string& username, std::string& password);
- ProcessResult Plain(std::string& username, std::string& password);
- ProcessResult Cram(std::string& username, std::string& password,
- std::string& challenge);
+ ProcessResult Login(std::string &username, std::string &password);
+ ProcessResult Plain(std::string &username, std::string &password);
+ ProcessResult Cram(std::string &username, std::string &password, std::string &challenge);
AuthenticateOperator(void);
~AuthenticateOperator(void);
@@ -63,13 +63,14 @@ namespace Binc {
//--------------------------------------------------------------------
class CapabilityOperator : public Operator {
std::vector<std::string> capabilities;
+
public:
ProcessResult process(Depot &, Request &);
virtual ParseResult parse(Request &) const;
const std::string getName(void) const;
int getState(void) const;
-
+
void addCapability(const std::string &cap);
CapabilityOperator(void);
@@ -162,6 +163,7 @@ namespace Binc {
ParseResult expectFetchAtt(BincImapParserFetchAtt &f_in) const;
ParseResult expectOffset(BincImapParserFetchAtt &f_in) const;
ParseResult expectHeaderList(BincImapParserFetchAtt &f_in) const;
+
public:
ProcessResult process(Depot &, Request &);
virtual ParseResult parse(Request &) const;
@@ -194,6 +196,7 @@ namespace Binc {
ParseResult expectFetchAtt(BincImapParserFetchAtt &f_in) const;
ParseResult expectOffset(BincImapParserFetchAtt &f_in) const;
ParseResult expectHeaderList(BincImapParserFetchAtt &f_in) const;
+
public:
ProcessResult process(Depot &, Request &);
virtual ParseResult parse(Request &) const;
@@ -208,15 +211,11 @@ namespace Binc {
//--------------------------------------------------------------------
class ListOperator : public Operator {
protected:
- enum MailboxFlags {
- DIR_SELECT = 0x01,
- DIR_MARKED = 0x02,
- DIR_NOINFERIORS = 0x04,
- DIR_LEAF = 0x08
- };
+ enum MailboxFlags { DIR_SELECT = 0x01, DIR_MARKED = 0x02, DIR_NOINFERIORS = 0x04, DIR_LEAF = 0x08 };
std::map<std::string, unsigned int> cache;
time_t cacheTimeout;
+
public:
ProcessResult process(Depot &, Request &);
virtual ParseResult parse(Request &) const;
@@ -322,7 +321,6 @@ namespace Binc {
//------------------------------------------------------------------
class SearchNode {
-
std::string date;
std::string astring;
std::string bstring;
@@ -336,12 +334,43 @@ namespace Binc {
public:
enum {
- S_ALL, S_ANSWERED, S_BCC, S_BEFORE, S_BODY, S_CC, S_DELETED,
- S_FLAGGED, S_FROM, S_KEYWORD, S_NEW, S_OLD, S_ON, S_RECENT,
- S_SEEN, S_SINCE, S_SUBJECT, S_TEXT, S_TO, S_UNANSWERED,
- S_UNDELETED, S_UNFLAGGED, S_UNKEYWORD, S_UNSEEN, S_DRAFT,
- S_HEADER, S_LARGER, S_NOT, S_OR, S_SENTBEFORE, S_SENTON,
- S_SENTSINCE, S_SMALLER, S_UID, S_UNDRAFT, S_SET, S_AND
+ S_ALL,
+ S_ANSWERED,
+ S_BCC,
+ S_BEFORE,
+ S_BODY,
+ S_CC,
+ S_DELETED,
+ S_FLAGGED,
+ S_FROM,
+ S_KEYWORD,
+ S_NEW,
+ S_OLD,
+ S_ON,
+ S_RECENT,
+ S_SEEN,
+ S_SINCE,
+ S_SUBJECT,
+ S_TEXT,
+ S_TO,
+ S_UNANSWERED,
+ S_UNDELETED,
+ S_UNFLAGGED,
+ S_UNKEYWORD,
+ S_UNSEEN,
+ S_DRAFT,
+ S_HEADER,
+ S_LARGER,
+ S_NOT,
+ S_OR,
+ S_SENTBEFORE,
+ S_SENTON,
+ S_SENTSINCE,
+ S_SMALLER,
+ S_UID,
+ S_UNDRAFT,
+ S_SET,
+ S_AND
};
static bool convertDate(const std::string &date, time_t &t, const std::string &delim = "-");
@@ -349,8 +378,10 @@ namespace Binc {
void order(void);
- bool match(Mailbox *, Message *,
- unsigned seqnr, unsigned int lastmessage,
+ bool match(Mailbox *,
+ Message *,
+ unsigned seqnr,
+ unsigned int lastmessage,
unsigned int lastuid) const;
int getType(void) const;
@@ -360,10 +391,9 @@ namespace Binc {
void init(const BincImapParserSearchKey &a);
//-
- static bool compareNodes(const SearchNode &a,
- const SearchNode &b)
+ static bool compareNodes(const SearchNode &a, const SearchNode &b)
{
- return a.getWeight() < b.getWeight();
+ return a.getWeight() < b.getWeight();
}
SearchNode(void);
@@ -371,7 +401,6 @@ namespace Binc {
};
public:
-
ProcessResult process(Depot &, Request &);
virtual ParseResult parse(Request &) const;
@@ -411,7 +440,7 @@ namespace Binc {
const std::string getName(void) const;
int getState(void) const;
- int goStartTLS(void) const;
+ int goStartTLS(void) const;
StarttlsOperator(void);
~StarttlsOperator(void);
@@ -419,7 +448,6 @@ namespace Binc {
//--------------------------------------------------------------------
class StatusOperator : public Operator {
-
std::map<int, Status> statuses;
public:
diff --git a/src/include/pendingupdates.h b/src/include/pendingupdates.h
index ea192de..c1adda0 100644
--- a/src/include/pendingupdates.h
+++ b/src/include/pendingupdates.h
@@ -16,12 +16,7 @@ namespace Binc {
//------------------------------------------------------------------------
class PendingUpdates {
public:
- enum {
- EXPUNGE = 0x01,
- FLAGS = 0x02,
- EXISTS = 0x04,
- RECENT = 0x08
- };
+ enum { EXPUNGE = 0x01, FLAGS = 0x02, EXISTS = 0x04, RECENT = 0x08 };
//----------------------------------------------------------------------
class expunged_const_iterator {
@@ -29,10 +24,10 @@ namespace Binc {
std::vector<unsigned int>::iterator internal;
public:
- unsigned int operator * (void) const;
- void operator ++ (void);
- bool operator != (expunged_const_iterator) const;
- bool operator == (expunged_const_iterator) const;
+ unsigned int operator*(void) const;
+ void operator++(void);
+ bool operator!=(expunged_const_iterator) const;
+ bool operator==(expunged_const_iterator) const;
//--
expunged_const_iterator(void);
@@ -48,7 +43,7 @@ namespace Binc {
private:
std::map<unsigned int, unsigned int>::iterator internal;
std::map<unsigned int, unsigned int> *sqnrtouid;
- std::map<unsigned int, std::vector<std::string> > *sqnrtocflags;
+ std::map<unsigned int, std::vector<std::string>> *sqnrtocflags;
public:
unsigned int first(void) const;
@@ -56,13 +51,13 @@ namespace Binc {
std::vector<std::string> getCustomFlags(void) const;
unsigned int getUID(void) const;
- void operator ++ (void);
- bool operator != (flagupdates_const_iterator) const;
+ void operator++(void);
+ bool operator!=(flagupdates_const_iterator) const;
//--
flagupdates_const_iterator(void);
flagupdates_const_iterator(std::map<unsigned int, unsigned int>::iterator i,
- std::map<unsigned int, std::vector<std::string> > *,
+ std::map<unsigned int, std::vector<std::string>> *,
std::map<unsigned int, unsigned int> *);
};
@@ -72,8 +67,9 @@ namespace Binc {
//--
void addExpunged(unsigned int uid);
- void addFlagUpdates(unsigned int sqnr, unsigned int uid,
- unsigned int flags,
+ void addFlagUpdates(unsigned int sqnr,
+ unsigned int uid,
+ unsigned int flags,
const std::vector<std::string> &cflags);
void setExists(unsigned int n);
void setRecent(unsigned int n);
@@ -90,7 +86,7 @@ namespace Binc {
std::vector<unsigned int> expunges;
std::map<unsigned int, unsigned int> flagupdates;
std::map<unsigned int, unsigned int> sqnrtouid;
- std::map<unsigned int, std::vector<std::string> > sqnrtocflags;
+ std::map<unsigned int, std::vector<std::string>> sqnrtocflags;
unsigned int exists;
unsigned int recent;
@@ -98,9 +94,11 @@ namespace Binc {
bool newrecent;
};
- bool pendingUpdates(Mailbox *, int type, bool rescan,
- bool showAll = false,
- bool forceScan = false,
+ bool pendingUpdates(Mailbox *,
+ int type,
+ bool rescan,
+ bool showAll = false,
+ bool forceScan = false,
bool uidfetchflags = false);
}
diff --git a/src/include/recursivedescent.h b/src/include/recursivedescent.h
index ea8fe33..96c3a7e 100644
--- a/src/include/recursivedescent.h
+++ b/src/include/recursivedescent.h
@@ -6,12 +6,12 @@
* ----------------------------------------------------------------- **/
#ifndef expectcommand_h_inluded
#define expectcommand_h_inluded
-#include <stack>
-#include <string>
-
#include "imapparser.h"
#include "operators.h"
+#include <stack>
+#include <string>
+
namespace Binc {
extern std::stack<int> inputBuffer;
@@ -39,7 +39,7 @@ namespace Binc {
Operator::ParseResult expectAtom(std::string &s_in);
Operator::ParseResult expectAtomChar(int &i_in);
Operator::ParseResult expectString(std::string &s_in);
-
+
Operator::ParseResult expectDate(std::string &s_in);
Operator::ParseResult expectNumber(unsigned int &i_in);
diff --git a/src/include/session.h b/src/include/session.h
index 94825cd..ee96613 100644
--- a/src/include/session.h
+++ b/src/include/session.h
@@ -6,17 +6,18 @@
* ----------------------------------------------------------------- **/
#ifndef session_h_included
#define session_h_included
+#include "argparser.h"
+
+#include <map>
#include <string>
#include <vector>
-#include <map>
-#include <sys/types.h>
-#include "argparser.h"
+#include <sys/types.h>
namespace Binc {
class Depot;
-
+
//--------------------------------------------------------------------
class Session {
public:
@@ -32,12 +33,7 @@ namespace Binc {
bool mailboxchanges;
- enum State {
- NONAUTHENTICATED = 0x01,
- AUTHENTICATED = 0x02,
- SELECTED = 0x04,
- LOGOUT = 0x00
- };
+ enum State { NONAUTHENTICATED = 0x01, AUTHENTICATED = 0x02, SELECTED = 0x04, LOGOUT = 0x00 };
CommandLineArgs args;
@@ -49,7 +45,7 @@ namespace Binc {
const int getState(void) const;
void setState(int n);
- bool parseCommandLine(int argc, char * argv[]);
+ bool parseCommandLine(int argc, char *argv[]);
void assignCommandLineArgs(void);
int getWriteBytes(void) const;
int getReadBytes(void) const;
diff --git a/src/include/status.h b/src/include/status.h
index f7f9e1f..9248505 100644
--- a/src/include/status.h
+++ b/src/include/status.h
@@ -11,7 +11,6 @@ namespace Binc {
//------------------------------------------------------------------------
class Status {
-
//--
int recent;
int messages;
@@ -23,23 +22,67 @@ namespace Binc {
int statusid;
public:
-
//--
- inline void setMessages(int i) { messages = i; }
- inline void setRecent(int i) { recent = i; }
- inline void setStatusID(int i) { statusid = i; }
- inline void setUnseen(int i) { unseen = i; }
- inline void setUidValidity(int i) { uidvalidity = i; }
- inline void setUidNext(int i) { uidnext = i; }
-
+ inline void setMessages(int i)
+ {
+ messages = i;
+ }
+
+ inline void setRecent(int i)
+ {
+ recent = i;
+ }
+
+ inline void setStatusID(int i)
+ {
+ statusid = i;
+ }
+
+ inline void setUnseen(int i)
+ {
+ unseen = i;
+ }
+
+ inline void setUidValidity(int i)
+ {
+ uidvalidity = i;
+ }
+
+ inline void setUidNext(int i)
+ {
+ uidnext = i;
+ }
+
//--
- inline int getMessages(void) const { return messages; }
- inline int getRecent(void) const { return recent; }
- inline int getStatusID(void) const { return statusid; }
- inline int getUnseen(void) const { return unseen; }
- inline int getUidValidity(void) const { return uidvalidity; }
- inline int getUidNext(void) const { return uidnext; }
+ inline int getMessages(void) const
+ {
+ return messages;
+ }
+
+ inline int getRecent(void) const
+ {
+ return recent;
+ }
+
+ inline int getStatusID(void) const
+ {
+ return statusid;
+ }
+
+ inline int getUnseen(void) const
+ {
+ return unseen;
+ }
+
+ inline int getUidValidity(void) const
+ {
+ return uidvalidity;
+ }
+ inline int getUidNext(void) const
+ {
+ return uidnext;
+ }
//--
Status(void);
diff --git a/src/include/stdiodevice.h b/src/include/stdiodevice.h
index 026386c..7b4f465 100644
--- a/src/include/stdiodevice.h
+++ b/src/include/stdiodevice.h
@@ -2,7 +2,7 @@
* @file stdiodevice.h
* @brief Declaration of the StdIODevice class.
* @author Andreas Aardal Hanssen
- * @date 2002, 2003
+ * @date 2002, 2003
* ----------------------------------------------------------------- **/
#ifndef stdiodevice_h_included
#define stdiodevice_h_included
@@ -24,7 +24,7 @@ namespace Binc {
bool waitForRead(void) const;
WriteResult write(void);
- bool fillInputBuffer(void);
+ bool fillInputBuffer(void);
};
}
diff --git a/src/include/syslogdevice.h b/src/include/syslogdevice.h
index 2269fb2..68d4112 100644
--- a/src/include/syslogdevice.h
+++ b/src/include/syslogdevice.h
@@ -8,13 +8,15 @@
#define syslogdevice_h_included
#include "iodevice.h"
+
#include <syslog.h>
namespace Binc {
class SyslogDevice : public IODevice {
public:
- SyslogDevice(int flags, const char *ident = "bincimap",
- int option = LOG_NDELAY | LOG_PID,
+ SyslogDevice(int flags,
+ const char *ident = "bincimap",
+ int option = LOG_NDELAY | LOG_PID,
int facility = LOG_USER);
~SyslogDevice();
@@ -27,7 +29,7 @@ namespace Binc {
bool waitForRead(void) const;
WriteResult write(void);
- bool fillInputBuffer(void);
+ bool fillInputBuffer(void);
private:
static std::string ident;