diff options
author | Vincent Richard <[email protected]> | 2005-04-27 11:01:28 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2005-04-27 11:01:28 +0000 |
commit | 4754fd0fab3e95d95359fc8c85e64a19bc4a209f (patch) | |
tree | 4c0b60f809989a9771f99e84f8a8ea64e13d8584 /src | |
parent | Added missing case when replacing '.' in send(). (diff) | |
download | vmime-4754fd0fab3e95d95359fc8c85e64a19bc4a209f.tar.gz vmime-4754fd0fab3e95d95359fc8c85e64a19bc4a209f.zip |
Ignore filenames starting with '.' for message files.
Diffstat (limited to 'src')
-rw-r--r-- | src/messaging/maildir/maildirFolder.cpp | 8 | ||||
-rw-r--r-- | src/messaging/maildir/maildirUtils.cpp | 14 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/messaging/maildir/maildirFolder.cpp b/src/messaging/maildir/maildirFolder.cpp index 0edb0f4c..c3b7e71c 100644 --- a/src/messaging/maildir/maildirFolder.cpp +++ b/src/messaging/maildir/maildirFolder.cpp @@ -282,7 +282,9 @@ void maildirFolder::scanFolder() while (nit->hasMoreElements()) { utility::auto_ptr <utility::file> file = nit->nextElement(); - newMessageFilenames.push_back(file->getFullPath().getLastComponent()); + + if (maildirUtils::isMessageFile(*file)) + newMessageFilenames.push_back(file->getFullPath().getLastComponent()); } delete (nit); // Free directory @@ -294,7 +296,9 @@ void maildirFolder::scanFolder() while (cit->hasMoreElements()) { utility::auto_ptr <utility::file> file = cit->nextElement(); - curMessageFilenames.push_back(file->getFullPath().getLastComponent()); + + if (maildirUtils::isMessageFile(*file)) + curMessageFilenames.push_back(file->getFullPath().getLastComponent()); } delete (cit); // Free directory diff --git a/src/messaging/maildir/maildirUtils.cpp b/src/messaging/maildir/maildirUtils.cpp index 4476b3dd..091fd871 100644 --- a/src/messaging/maildir/maildirUtils.cpp +++ b/src/messaging/maildir/maildirUtils.cpp @@ -88,6 +88,20 @@ const bool maildirUtils::isSubfolderDirectory(const utility::file& file) } +const bool maildirUtils::isMessageFile(const utility::file& file) +{ + // Ignore files which name begins with '.' + if (file.isFile() && + file.getFullPath().getLastComponent().getBuffer().length() >= 1 && + file.getFullPath().getLastComponent().getBuffer()[0] != '.') + { + return (true); + } + + return (false); +} + + const utility::file::path::component maildirUtils::extractId (const utility::file::path::component& filename) { |