while i haven't received any comment from andy for the last question in
Message-ID: <[EMAIL PROTECTED]>, i just assume my
understanding is probably ok and then posting this patch.
thanks,
-- Hiroshima
--- operator-copy.cc.orig Thu Apr 10 06:06:12 2003
+++ operator-copy.cc Wed Jun 11 11:19:45 2003
@@ -92,6 +92,9 @@
else
mode = Mailbox::SQNR_MODE;
+ typedef std::pair<string,int> copiedfile;
+ std::vector<copiedfile> copiedfiles;
+
Mailbox::iterator i = mailbox->begin(command.bset,
Mailbox::SKIP_EXPUNGED|mode);
Mailbox::iterator e = mailbox->end();
@@ -242,6 +245,29 @@
logger << "COPY warning: couldn't unlink " << (char*)safename
<< ": " << strerror(errno) << endl;
delete safename;
+
+ copiedfiles.push_back(copiedfile(filename,message.getStdFlags()));
+ }
+
+ sleep(1); // to make all files at least 1 second old.
+
+ for (vector<copiedfile>::iterator p = copiedfiles.begin(); p != copiedfiles.end();
++p) {
+ string info = ":2,";
+ if (p->second & Message::F_DRAFT) info += "D";
+ if (p->second & Message::F_FLAGGED) info += "F";
+ if (p->second & Message::F_ANSWERED) info += "R";
+ if (p->second & Message::F_SEEN) info += "S";
+ if (p->second & Message::F_DELETED) info += "T";
+
+ string name = p->first + info;
+ name.replace(name.find("/new/"),5,"/cur/",5);
+
+ if (link(p->first.c_str(), name.c_str()) != 0)
+ logger << "warning: link(" << p->first << ", " << name << ") == "
+ << errno << ": " << strerror(errno) << endl;
+ else if (unlink(p->first.c_str()) != 0)
+ logger << "warning: unlink(" << name << ") == "
+ << errno << ": " << strerror(errno) << endl;
}
}