Continued work.
This commit is contained in:
1 parent
e1f33291f7
commit
8e7834a320
17 files changed
+152
-108
No files matched your search
+6
-29
@@ -1,45 +1,22 @@
|
||||
#ifndef __MailFileSystem_h__
|
||||
# define __MailFileSystem_h__
|
||||
|
||||
# include "ZString.h"
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
# include <unistd.h>
|
||||
# include "INotify.h"
|
||||
# include "ZString.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::ZString email(mailbox);
|
||||
email.split("@");
|
||||
std::string path = mailPath + "/" + email[1].str() + "/" + email[0].str();
|
||||
return path;
|
||||
}
|
||||
|
||||
MailFileSystem(std::string mailPath);
|
||||
bool ifMailBoxExists(std::string mailbox);
|
||||
bool ifAliasExists(std::string alias);
|
||||
std::string getMailBoxPath(std::string mailbox);
|
||||
std::vector<std::string> getAliasMailboxes(std::string alias);
|
||||
|
||||
std::string getMailPath() {
|
||||
return mailPath;
|
||||
}
|
||||
std::string getMailPath();
|
||||
|
||||
private:
|
||||
std::string mailPath;
|
||||
|
||||
Reference in new issue
Block a user