40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
|
|
#include "MailFileSystem.h"
|
|
# include "INotify.h"
|
|
|
|
namespace mail {
|
|
|
|
MailFileSystem::MailFileSystem(coreutils::ZString &mailPath) : mailPath(mailPath) {}
|
|
|
|
bool MailFileSystem::ifMailBoxExists(coreutils::ZString &mailbox) {
|
|
if(stat(getMailBoxPath(mailbox).c_str(), &statbuf) != -1)
|
|
if(S_ISDIR(statbuf.st_mode))
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
bool MailFileSystem::ifAliasExists(coreutils::ZString &alias) {
|
|
if(stat(getMailBoxPath(alias).c_str(), &statbuf) != -1)
|
|
if(S_ISREG(statbuf.st_mode))
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
coreutils::MString MailFileSystem::getMailBoxPath(coreutils::ZString &mailbox) {
|
|
mailbox.split("@", 1);
|
|
coreutils::MString path;
|
|
path << mailPath << "/" << mailbox[1] << "/" << mailbox[0];
|
|
return path;
|
|
}
|
|
|
|
std::vector<coreutils::MString> MailFileSystem::getAliasMailboxes(coreutils::ZString &alias) {
|
|
std::vector<coreutils::MString> returnValue;
|
|
return returnValue;
|
|
}
|
|
|
|
coreutils::ZString& MailFileSystem::getMailPath() {
|
|
return mailPath;
|
|
}
|
|
|
|
}
|