commit bd8b6804fae3e0adc970799e30603a30d3073ed0
parent 5b058effb9b0dbd318abe5024f15686d9b448a4f
Author: andreaha <andreaha@b31fe1f4-c0d1-0310-8000-a34f4ae90293>
Date: Mon, 26 Jan 2004 20:19:12 +0000
- Handle correctly the case where the cache file is
missing, and when it's empty.
git-svn-id: file:///home/cwright/convert/bincimap/trunk@5 b31fe1f4-c0d1-0310-8000-a34f4ae90293
Diffstat:
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/maildir-readcache.cc b/src/maildir-readcache.cc
@@ -98,6 +98,8 @@ Maildir::ReadCacheResult Maildir::readCache(void)
uidvalfiledropped = true;
return NoCache;
} else if (isdigit(section[0])) {
+ // Perhaps a bit confusing. We need to set all attributes in one
+ // go, so when the section changes, we add the message.
if (lastsection != section) {
lastsection = section;
if (_id != "") {
@@ -132,19 +134,21 @@ Maildir::ReadCacheResult Maildir::readCache(void)
}
// Catch the last message too.
- if (index.find(_id) == 0) {
- MaildirMessage m(*this);
- m.setUnique(_id);
- m.setInternalDate(_internaldate);
- m.setUID(_uid);
- m.setInternalFlag(MaildirMessage::JustArrived);
- add(m);
+ if (lastsection != "") {
+ if (index.find(_id) == 0) {
+ MaildirMessage m(*this);
+ m.setUnique(_id);
+ m.setInternalDate(_internaldate);
+ m.setUID(_uid);
+ m.setInternalFlag(MaildirMessage::JustArrived);
+ add(m);
+ } else {
+ // Remember to insert the uid of the message again - we reset this
+ // at the top of this function.
+ index.insert(_id, _uid);
+ }
}
- // Remember to insert the uid of the message again - we reset this
- // at the top of this function.
- index.insert(_id, _uid);
-
if (!cache.eof()) {
// Assume there is no cache file.
uidnext = 1;