/home/bradarant/barant/BMAMail/MailFileSystem.h
Go to the documentation of this file.
#ifndef __MailFileSystem_h__
# define __MailFileSystem_h__
# include <sys/types.h>
# include <sys/stat.h>
# include <unistd.h>
namespace mail {
class MailFileSystem {
public:
MailFileSystem(std::string mailPath) : mailPath(mailPath) {}
bool ifMailBoxExists(std::string mailbox) {
if(stat(getMailboxPath(mailbox).c_str(), &statbuf) != -1)
if(S_ISDIR(statbuf.st_mode))
return true;
return false;
}
bool ifAliasExists(std::string alias) {
if(stat(getMailboxPath(alias).c_str(), &statbuf) != -1)
if(S_ISREG(statbuf.st_mode))
return true;
return false;
}
std::string getMailboxPath(std::string mailbox) {
coreutils::PString email(mailbox);
email.split("@");
std::string path = mailPath + "/" + email[1].str() + "/" + email[0].str();
return path;
}
std::vector<std::string> getAliasMailboxes(std::string alias);
private:
std::string mailPath;
struct stat statbuf;
};
}
#endif
mail::MailFileSystem::ifMailBoxExists
bool ifMailBoxExists(std::string mailbox)
Definition: MailFileSystem.h:15
mail::MailFileSystem
Definition: MailFileSystem.h:10
mail::MailFileSystem::MailFileSystem
MailFileSystem(std::string mailPath)
Definition: MailFileSystem.h:13
mail::MailFileSystem::getMailboxPath
std::string getMailboxPath(std::string mailbox)
Definition: MailFileSystem.h:29
mail
Definition: __IMAP_APPEND.h:7
mail::MailFileSystem::ifAliasExists
bool ifAliasExists(std::string alias)
Definition: MailFileSystem.h:22
mail::MailFileSystem::getAliasMailboxes
std::vector< std::string > getAliasMailboxes(std::string alias)