42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
|
|
#include "MailFileSystem.h"
|
|
# include "INotify.h"
|
|
|
|
namespace mail {
|
|
|
|
MailFileSystem::MailFileSystem(coreutils::ZString &mailPath) : mailPath(mailPath) {}
|
|
|
|
bool MailFileSystem::ifMailBoxExists(coreutils::ZString &mailbox) {
|
|
std::cout << "{" << mailbox << "}" << std::endl;
|
|
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);
|
|
std::cout << mailbox[0] << "-" << mailbox[1] << std::endl;
|
|
coreutils::MString path(mailPath + "/" + mailbox[1] + "/" + mailbox[0]);
|
|
std::cout << "{" << path << "}" << std::endl;
|
|
return path;
|
|
}
|
|
|
|
std::vector<coreutils::MString> MailFileSystem::getAliasMailboxes(coreutils::ZString &alias) {
|
|
std::vector<coreutils::MString> returnValue;
|
|
return returnValue;
|
|
}
|
|
|
|
coreutils::ZString& MailFileSystem::getMailPath() {
|
|
return mailPath;
|
|
}
|
|
|
|
}
|