On Thu, 18 Sep 2003, Henry Baragar wrote:
>OK, here we go:
Yohoo! ;)
> (...) Does the above evidence mean that bincIMAP detects the message,
> but does not properly update all the relevant flags and counts?
Yes, it does. :) I'd like you to try the following patch, and see if it
solves the problem:
Andy
--- src/maildir.cc 2 Sep 2003 18:51:08 -0000 1.6
+++ src/maildir.cc 18 Sep 2003 05:12:33 -0000
@@ -336,7 +336,7 @@
{
unsigned int messages = 0;
unsigned int unseen = 0;
- unsigned int messagesincache = 0;
+ unsigned int recent = 0;
const string cachefilename = path + "/bincimap-cache";
const string uidvalfilename = path + "/bincimap-uidvalidity";
@@ -350,21 +350,24 @@
// ignore
}
+ map<string, bool> mincache;
+
string section;
if (cache.getFirstSection(section))
do {
- if (isdigit(section[0]))
- ++messagesincache;
+ if (isdigit(section[0])) {
+ cache.setSection(section);
+ mincache[cache["_ID"]] = true;
+ }
} while (cache.getNextSection(section));
uidvalfile.setSection("depot");
const unsigned int uidvalidity
= (unsigned int) atoi(uidvalfile["_uidvalidity"].c_str());
- const unsigned int uidnext
+ unsigned int uidnext
= (unsigned int) atoi(uidvalfile["_uidnext"].c_str());
s.setUidValidity(uidvalidity < 1 ? time(0) : uidvalidity);
- s.setUidNext(uidnext < 1 ? 1 : uidnext);
// Scan new
DIR *dirp = opendir((path + "/new").c_str());
@@ -378,8 +381,10 @@
|| filename.find('/') != string::npos)
continue;
- ++messages;
- ++unseen;
+ ++recent;
+ ++uidnext;
+ ++unseen;
+ ++messages;
}
closedir(dirp);
@@ -399,18 +404,29 @@
// flags.
const string::size_type pos = dname.find(':');
if (pos != string::npos) {
+ if (mincache.find(dname.substr(0, pos)) == mincache.end()) {
+ ++recent;
+ ++uidnext;
+ }
+
if (dname.substr(pos).find('S') == string::npos)
++unseen;
- } else
+ } else {
+ if (mincache.find(dname) == mincache.end()) {
+ ++recent;
+ ++uidnext;
+ }
+
++unseen;
+ }
}
closedir(dirp);
- s.setRecent(messages > messagesincache ? messages - messagesincache : 0);
+ s.setRecent(recent);
s.setMessages(messages);
s.setUnseen(unseen);
- s.setUidNext(s.getUidNext() + s.getRecent());
+ s.setUidNext(uidnext);
return true;
}