#ifndef __MailFileSystem_h__ # define __MailFileSystem_h__ # include "MString.h" # include # include # include # include namespace mail { class MailFileSystem { public: MailFileSystem(coreutils::ZString &mailPath); bool ifMailBoxExists(coreutils::ZString &mailbox); bool ifAliasExists(coreutils::ZString &alias); coreutils::MString getMailBoxPath(coreutils::ZString &mailbox); std::vector getAliasMailboxes(coreutils::ZString &alias); coreutils::ZString& getMailPath(); coreutils::ZString& getQueuePath(); coreutils::ZString& getSendLogPath(); // Shared by every protocol's login (SMTP AUTH LOGIN, IMAP LOGIN, // POP3 USER/PASS) so there is exactly one place that reads // /.password and compares it - previously // __SMTP_AUTH::authLogin() carried this logic alone, and IMAP/POP3 // login would otherwise have needed their own copies. Still a // plaintext file comparison (a separately tracked, pre-existing // gap) - not something this change fixes, just no longer // triplicated. bool checkPassword(coreutils::ZString &userName, coreutils::ZString &password); // Folder names (Inbox/Spam/Trash/anything CREATEd) as immediate // subdirectories of a mailbox's own directory - used by IMAP // LIST/LSUB/SELECT/CREATE/DELETE/RENAME to enumerate and validate // folders without each command re-implementing the same // directory scan and dotfile-skipping rule. std::vector listFolders(coreutils::ZString &mailbox); coreutils::MString getFolderPath(coreutils::ZString &mailbox, std::string folder); bool ifFolderExists(coreutils::ZString &mailbox, std::string folder); private: coreutils::ZString &mailPath; coreutils::MString queuePath; coreutils::MString sendLogPath; struct stat statbuf; }; } #endif