diff options
| author | Vincent Richard <[email protected]> | 2009-07-11 12:39:36 +0000 |
|---|---|---|
| committer | Vincent Richard <[email protected]> | 2009-07-11 12:39:36 +0000 |
| commit | 6bfaff3ce49012e234081a56b63fbb0fde1ea19f (patch) | |
| tree | 0b56d8b88f35b69b705ffc2184fad83730e27b22 /src/net/maildir/maildirFolder.cpp | |
| parent | fsync() in posixFile::fileCreate(); changed posixFile::rename to exclusive se... (diff) | |
| download | vmime-6bfaff3ce49012e234081a56b63fbb0fde1ea19f.tar.gz vmime-6bfaff3ce49012e234081a56b63fbb0fde1ea19f.zip | |
maildirFolder::addMessage() : iff FLAG_RECENT is present, add message to 'new' instead of 'cur' (Georg Sauthoff).
Diffstat (limited to 'src/net/maildir/maildirFolder.cpp')
| -rw-r--r-- | src/net/maildir/maildirFolder.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cpp index 9a52171c..65abdcf2 100644 --- a/src/net/maildir/maildirFolder.cpp +++ b/src/net/maildir/maildirFolder.cpp @@ -835,9 +835,12 @@ void maildirFolder::addMessage(utility::inputStream& is, const int size, utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory(); utility::file::path tmpDirPath = store->getFormat()-> - folderPathToFileSystemPath(m_path, maildirFormat::TMP_DIRECTORY); - utility::file::path curDirPath = store->getFormat()-> - folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY); + folderPathToFileSystemPath(m_path,maildirFormat::TMP_DIRECTORY); + utility::file::path dstDirPath = store->getFormat()-> + folderPathToFileSystemPath(m_path, + flags == message::FLAG_RECENT ? + maildirFormat::NEW_DIRECTORY : + maildirFormat::CUR_DIRECTORY); const utility::file::path::component filename = maildirUtils::buildFilename(maildirUtils::generateId(), @@ -855,7 +858,7 @@ void maildirFolder::addMessage(utility::inputStream& is, const int size, try { - ref <utility::file> curDir = fsf->create(curDirPath); + ref <utility::file> curDir = fsf->create(dstDirPath); curDir->createDirectory(true); } catch (exceptions::filesystem_exception&) @@ -864,7 +867,7 @@ void maildirFolder::addMessage(utility::inputStream& is, const int size, } // Actually add the message - copyMessageImpl(tmpDirPath, curDirPath, filename, is, size, progress); + copyMessageImpl(tmpDirPath, dstDirPath, filename, is, size, progress); // Append the message to the cache list messageInfos msgInfos; @@ -910,7 +913,8 @@ void maildirFolder::addMessage(utility::inputStream& is, const int size, void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath, - const utility::file::path& curDirPath, const utility::file::path::component& filename, + const utility::file::path& dstDirPath, + const utility::file::path::component& filename, utility::inputStream& is, const utility::stream::size_type size, utility::progressListener* progress) { @@ -970,7 +974,7 @@ void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath, // ...then, move it to 'cur' try { - file->rename(curDirPath / filename); + file->rename(dstDirPath / filename); } catch (exception& e) { @@ -980,7 +984,8 @@ void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath, // Delete temporary file try { - ref <utility::file> file = fsf->create(tmpDirPath / filename); + file->remove(); + ref <utility::file> file = fsf->create(dstDirPath / filename); file->remove(); } catch (exceptions::filesystem_exception&) |
