BMAMail  1.0.0
E-Mail System
/home/bradarant/barant/BMAMail/MailFileSystem.h
Go to the documentation of this file.
1 #ifndef __MailFileSystem_h__
2 # define __MailFileSystem_h__
3 
4 # include <sys/types.h>
5 # include <sys/stat.h>
6 # include <unistd.h>
7 
8 namespace mail {
9 
11 
12  public:
13  MailFileSystem(std::string mailPath) : mailPath(mailPath) {}
14 
15  bool ifMailBoxExists(std::string mailbox) {
16  if(stat(getMailboxPath(mailbox).c_str(), &statbuf) != -1)
17  if(S_ISDIR(statbuf.st_mode))
18  return true;
19  return false;
20  }
21 
22  bool ifAliasExists(std::string alias) {
23  if(stat(getMailboxPath(alias).c_str(), &statbuf) != -1)
24  if(S_ISREG(statbuf.st_mode))
25  return true;
26  return false;
27  }
28 
29  std::string getMailboxPath(std::string mailbox) {
30  coreutils::PString email(mailbox);
31  email.split("@");
32  std::string path = mailPath + "/" + email[1].str() + "/" + email[0].str();
33  return path;
34  }
35 
36  std::vector<std::string> getAliasMailboxes(std::string alias);
37 
38  private:
39  std::string mailPath;
40  struct stat statbuf;
41 
42  };
43 
44 }
45 
46 #endif
bool ifMailBoxExists(std::string mailbox)
Definition: MailFileSystem.h:15
Definition: MailFileSystem.h:10
MailFileSystem(std::string mailPath)
Definition: MailFileSystem.h:13
std::string getMailboxPath(std::string mailbox)
Definition: MailFileSystem.h:29
Definition: __IMAP_APPEND.h:7
bool ifAliasExists(std::string alias)
Definition: MailFileSystem.h:22
std::vector< std::string > getAliasMailboxes(std::string alias)