bincimap

Log | Files | Refs | LICENSE

commit 761544f70f379dd18c2d452128c76fe3d5dc1d2e
parent e77787598183582acf33bd2b3d42d14c96733dfd
Author: andreaha <andreaha@b31fe1f4-c0d1-0310-8000-a34f4ae90293>
Date:   Thu,  4 Mar 2004 20:11:49 +0000

- Added option to force scanning when doing a pendingUpdates().
  This will also force all messages in new/ to be moved to cur/
  regardless of how the messages were stored there.


git-svn-id: file:///home/cwright/convert/bincimap/trunk@55 b31fe1f4-c0d1-0310-8000-a34f4ae90293

Diffstat:
Msrc/mailbox.h | 2+-
Msrc/maildir-scan.cc | 6+++---
Msrc/maildir.cc | 4++--
Msrc/maildir.h | 4++--
Msrc/operator-append.cc | 2+-
Msrc/pendingupdates.cc | 5+++--
Msrc/pendingupdates.h | 2+-
7 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/mailbox.h b/src/mailbox.h @@ -129,7 +129,7 @@ namespace Binc { virtual unsigned int getUidValidity(void) const = 0; virtual bool getUpdates(bool scan, unsigned int type, - PendingUpdates &updates) = 0; + PendingUpdates &updates, bool forceScan) = 0; virtual void updateFlags(void) = 0; virtual void expungeMailbox(void) = 0; diff --git a/src/maildir-scan.cc b/src/maildir-scan.cc @@ -113,7 +113,7 @@ namespace { // to cur, setting the recent flag in memory only. check for expunged // messages. give newly arrived messages uids. //------------------------------------------------------------------------ -Maildir::ScanResult Maildir::scan(void) +Maildir::ScanResult Maildir::scan(bool forceScan) { IO &logger = IOFactory::getInstance().get(2); @@ -123,7 +123,7 @@ Maildir::ScanResult Maildir::scan(void) const string cachefilename = path + "/bincimap-cache"; // check wether or not we need to bother scanning the folder. - if (firstscan) { + if (firstscan || forceScan) { struct stat oldstat; if (stat(newpath.c_str(), &oldstat) != 0) { setLastError("Invalid Mailbox, " + newpath + ": " @@ -257,7 +257,7 @@ Maildir::ScanResult Maildir::scan(void) // introduces a special case: we can not cache the old st_ctime // and st_mtime. the next time the mailbox is scanned, it must not // simply be skipped. :-) - if (::time(0) <= mystat.st_mtime) { + if (!forceScan && ::time(0) <= mystat.st_mtime) { old_cur_st_mtime = (time_t) 0; old_cur_st_ctime = (time_t) 0; old_new_st_mtime = (time_t) 0; diff --git a/src/maildir.cc b/src/maildir.cc @@ -211,9 +211,9 @@ void Maildir::setPath(const string &path_in) //------------------------------------------------------------------------ bool Maildir::getUpdates(bool doscan, unsigned int type, - PendingUpdates &updates) + PendingUpdates &updates, bool forceScan) { - if (doscan && scan() != Success) + if (doscan && scan(forceScan) != Success) return false; unsigned int exists = 0; diff --git a/src/maildir.h b/src/maildir.h @@ -121,7 +121,7 @@ namespace Binc { unsigned int getUidNext(void) const; bool getUpdates(bool doscan, unsigned int type, - PendingUpdates &updates); + PendingUpdates &updates, bool forceScan); const std::string &getPath(void) const; void setPath(const std::string &path_in); @@ -170,7 +170,7 @@ namespace Binc { PermanentError = 2 }; - ScanResult scan(void); + ScanResult scan(bool forceScan = false); MaildirMessage *get(const std::string &id); void add(MaildirMessage &m); diff --git a/src/operator-append.cc b/src/operator-append.cc @@ -241,7 +241,7 @@ Operator::ProcessResult AppendOperator::process(Depot &depot, if (mailbox == depot.getSelected()) { pendingUpdates(mailbox, PendingUpdates::EXISTS | PendingUpdates::RECENT - | PendingUpdates::FLAGS, true); + | PendingUpdates::FLAGS, true, true); } return OK; diff --git a/src/pendingupdates.cc b/src/pendingupdates.cc @@ -206,7 +206,8 @@ unsigned int PendingUpdates::flagupdates_const_iterator::second(void) const } //-------------------------------------------------------------------- -bool Binc::pendingUpdates(Mailbox *mailbox, int type, bool rescan, bool showAll) +bool Binc::pendingUpdates(Mailbox *mailbox, int type, bool rescan, bool showAll, + bool forceScan) { Session &session = Session::getInstance(); IO &com = IOFactory::getInstance().get(1); @@ -215,7 +216,7 @@ bool Binc::pendingUpdates(Mailbox *mailbox, int type, bool rescan, bool showAll) return true; PendingUpdates p; - if (!mailbox->getUpdates(rescan, type, p)) { + if (!mailbox->getUpdates(rescan, type, p, forceScan)) { session.setLastError(mailbox->getLastError()); return false; } diff --git a/src/pendingupdates.h b/src/pendingupdates.h @@ -119,7 +119,7 @@ namespace Binc { bool newrecent; }; - bool Binc::pendingUpdates(Mailbox *, int type, bool rescan, bool showAll = false); + bool Binc::pendingUpdates(Mailbox *, int type, bool rescan, bool showAll = false, bool forceScan = false); } #endif