diff options
Diffstat (limited to 'src/maildir-readcache.cc')
-rw-r--r-- | src/maildir-readcache.cc | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/maildir-readcache.cc b/src/maildir-readcache.cc index dbbf4ef..5864ff6 100644 --- a/src/maildir-readcache.cc +++ b/src/maildir-readcache.cc @@ -1,19 +1,20 @@ -/** -------------------------------------------------------------------- +/** * @file maildir-readcache.cc * @brief Implementation of the Maildir class. * @author Andreas Aardal Hanssen * @date 2002-2005 - * ----------------------------------------------------------------- **/ + */ + #include "convert.h" #include "globals.h" #include "maildir.h" #include <algorithm> -using namespace ::std; using namespace Binc; +using std::string; +using std::vector; -//------------------------------------------------------------------------ Maildir::ReadCacheResult Maildir::readCache(void) { index.clearUids(); @@ -21,7 +22,7 @@ Maildir::ReadCacheResult Maildir::readCache(void) const string cachefilename = path + "/bincimap-cache"; FILE *fp = fopen(cachefilename.c_str(), "r"); if (!fp) { - uidvalidity = time(0); + uidvalidity = time(nullptr); uidnext = 1; messages.clear(); index.clear(); @@ -32,7 +33,7 @@ Maildir::ReadCacheResult Maildir::readCache(void) char inputBuffer[512]; if (!fgets(inputBuffer, sizeof(inputBuffer), fp)) { fclose(fp); - uidvalidity = time(0); + uidvalidity = time(nullptr); uidnext = 1; messages.clear(); index.clear(); @@ -52,7 +53,7 @@ Maildir::ReadCacheResult Maildir::readCache(void) { // bump cache fclose(fp); - uidvalidity = time(0); + uidvalidity = time(nullptr); uidnext = 1; messages.clear(); index.clear(); @@ -73,7 +74,7 @@ Maildir::ReadCacheResult Maildir::readCache(void) if (sscanf(inputBuffer, "%u %u %u %s", &readUID, &readInternalDate, &readSize, readUnique) != 4) { // error in input fclose(fp); - uidvalidity = time(0); + uidvalidity = time(nullptr); uidnext = 1; messages.clear(); index.clear(); @@ -84,7 +85,7 @@ Maildir::ReadCacheResult Maildir::readCache(void) vector<string> customFlags; char *flagStart = inputBuffer; - for (int i = 0; flagStart != 0 && *flagStart != '\0' && i < 4; ++i) { + for (int i = 0; flagStart != nullptr && *flagStart != '\0' && i < 4; ++i) { flagStart = strchr(flagStart, ' '); // skip consecutive white space @@ -112,9 +113,8 @@ Maildir::ReadCacheResult Maildir::readCache(void) m.setUnique(readUnique); m.setInternalDate(readInternalDate); - if (index.find(readUnique) == 0) { - for (vector<string>::const_iterator it = customFlags.begin(); it != customFlags.end(); ++it) { - string tmpFlag = *it; + if (index.find(readUnique) == nullptr) { + for (auto tmpFlag : customFlags) { trim(tmpFlag, " \n"); m.setCustomFlag(tmpFlag); } @@ -134,8 +134,7 @@ Maildir::ReadCacheResult Maildir::readCache(void) sort(customFlags.begin(), customFlags.end()); if (oldCustomFlags != customFlags) { existingMessage.resetCustomFlags(); - for (vector<string>::const_iterator it = customFlags.begin(); it != customFlags.end(); ++it) { - string tmpFlag = *it; + for (auto tmpFlag : customFlags) { trim(tmpFlag, " \n"); existingMessage.setCustomFlag(tmpFlag); } |