Conversion of MailFileSystem object to MString.

This commit is contained in:
Brad Arant committed 2022-07-28 08:17:00 -07:00
1 parent 8e7834a320
commit 09c6163a74
8 files changed
+127 -131

No files matched your search

+24 -26
View File
@@ -4,40 +4,38 @@
namespace mail {
MailFileSystem::MailFileSystem(std::string mailPath) : mailPath(mailPath) {}
bool MailFileSystem::ifMailBoxExists(std::string mailbox) {
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;
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;
bool MailFileSystem::ifAliasExists(coreutils::ZString &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();
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<std::string> MailFileSystem::getAliasMailboxes(std::string alias) {
std::vector<std::string> returnValue;
std::vector<coreutils::MString> MailFileSystem::getAliasMailboxes(coreutils::ZString &alias) {
std::vector<coreutils::MString> returnValue;
return returnValue;
}
std::string MailFileSystem::getMailPath() {
}
coreutils::ZString& MailFileSystem::getMailPath() {
return mailPath;
}
}
}