44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
|
|
#include "MailFileSystem.h"
|
|
# include "INotify.h"
|
|
|
|
namespace mail {
|
|
|
|
MailFileSystem::MailFileSystem(std::string mailPath) : mailPath(mailPath) {}
|
|
|
|
bool MailFileSystem::ifMailBoxExists(std::string 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(std::string alias) {
|
|
if(stat(getMailBoxPath(alias).c_str(), &statbuf) != -1)
|
|
if(S_ISREG(statbuf.st_mode))
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
std::string MailFileSystem::getMailBoxPath(std::string mailbox) {
|
|
coreutils::ZString email(mailbox);
|
|
email.split("@", 1);
|
|
std::cout << email[0] << "-" << email[1] << std::endl;
|
|
std::string path = mailPath + "/" + email[1].str() + "/" + email[0].str();
|
|
std::cout << "{" << path << "}" << std::endl;
|
|
return path;
|
|
}
|
|
|
|
std::vector<std::string> MailFileSystem::getAliasMailboxes(std::string alias) {
|
|
std::vector<std::string> returnValue;
|
|
return returnValue;
|
|
}
|
|
|
|
std::string MailFileSystem::getMailPath() {
|
|
return mailPath;
|
|
}
|
|
|
|
}
|