Ignore filenames starting with '.' for message files.

This commit is contained in:
Vincent Richard 2005-04-27 11:01:28 +00:00
parent 44ff5f63a1
commit 4754fd0fab
3 changed files with 28 additions and 2 deletions

View File

@ -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

View File

@ -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)
{

View File

@ -85,6 +85,14 @@ public:
*/
static const bool isSubfolderDirectory(const utility::file& file);
/** Test whether the specified file-system object is a message.
*
* @param file reference to a file-system object
* @return true if the specified object is a message file,
* false otherwise
*/
static const bool isMessageFile(const utility::file& file);
/** Extract the unique identifier part of the message filename.
* Eg: for the filename "1071577232.28549.m03s:2,RS", it will
* return "1071577232.28549.m03s".