25 string curpath = path +
"/cur/";
26 DIR *pdir = opendir(curpath.c_str());
28 bincError <<
"failed to open " << curpath <<
": "
29 << strerror(errno) << endl;
34 vector<string> entries;
35 struct dirent *pdirent;
36 while ((pdirent = readdir(pdir)) != 0) {
37 string filename = pdirent->d_name;
38 if (filename[0] ==
'.')
40 entries.push_back(filename);
44 bool customFlagsChanged =
false;
48 for (vector<string>::const_iterator it = entries.begin(); it != entries.end(); ++it) {
49 string filename = *it;
54 string::size_type pos;
55 if ((pos = filename.find(
":2,")) != string::npos)
56 uniquename = filename.substr(0, pos);
58 uniquename = filename;
68 customFlagsChanged =
true;
82 string srcname = curpath + filename;
83 string destname = curpath + uniquename +
":2," + flags;
84 if (srcname == destname)
88 if (rename(srcname.c_str(), destname.c_str()) != 0) {
89 if (errno == ENOENT) {
91 if ((pdir = opendir(curpath.c_str())) == 0) {
92 bincError <<
"failed to open " << curpath <<
": "
93 << strerror(errno) << endl;
102 bincError <<
"failed to rename " << srcname
103 <<
" to " << destname <<
": "
104 << strerror(errno) << endl;
106 index.
insert(uniquename, 0, uniquename +
":2," + flags);
111 if (customFlagsChanged) {
MaildirMessage * get(const std::string &id)
void insert(const std::string &unique, unsigned int uid, const std::string &fileName="")
The MaildirMessage class provides an interface for IMAP messages.
unsigned char getStdFlags(void) const
Declaration of the IODevice class.
Declaration of the IOFactory class.
Declaration of the Maildir class.