49 G_EXCEPTION( InvalidDirectory ,
tx(
"invalid spool directory") ) ;
51 Store(
const G::Path & spool_dir ,
bool by_name ,
bool allow_delete ) ;
72 static bool accessible(
const G::Path &
dir ,
bool ) ;
86 using Size =
unsigned long ;
87 StoreMessage(
const std::string & name , Size size ,
bool in_parent ) ;
91 std::string uidl()
const ;
123 std::vector<StoreMessage> m_list ;
135 G_EXCEPTION( CannotDelete ,
tx(
"cannot delete message file") ) ;
136 G_EXCEPTION( CannotRead ,
tx(
"cannot read message file") ) ;
137 using Size = StoreMessage::Size ;
138 using List = std::vector<StoreMessage> ;
146 List::const_iterator
cbegin()
const ;
149 List::const_iterator
cend()
const ;
152 List::value_type
get(
int id )
const ;
161 std::string
uidl(
int id )
const ;
164 bool valid(
int id )
const ;
170 std::unique_ptr<std::istream>
content(
int id )
const ;
192 void deleteFile(
const G::Path & ,
bool & )
const ;
196 bool m_allow_delete {
false} ;
199 std::vector<StoreMessage> m_list ;
Represents the protocol's view of the pop store having 1-based message ids.
Size messageCount() const
Returns the store's message count.
std::string uidl(int id) const
Returns a message's unique 1-based id.
void rollback()
Rolls back remove()als.
Size byteCount(int id) const
Returns the message size.
bool valid(int id) const
Validates a message id.
StoreList()
Constructor for an empty list.
List::const_iterator cbegin() const
Returns the begin iterator.
std::unique_ptr< std::istream > content(int id) const
Retrieves the message content.
Size totalByteCount() const
Returns the store's total byte count.
void remove(int)
Marks the message files for deletion.
void commit()
Commits remove()als.
List::const_iterator cend() const
Returns the end iterator.
List::value_type get(int id) const
Returns the item with index id-1.
A structure representing a pop message.
Holds the list of messages available to a particular pop user.
StoreUser(Store &, const std::string &user)
Constructor.
bool allowDelete() const
Returns true if files can be deleted.
bool byName() const
Returns true if the spool directory is affected by the user name.
G::Path dir() const
Returns the spool directory path.
Store(const G::Path &spool_dir, bool by_name, bool allow_delete)
Constructor. Throws InvalidDirectory.
A Path object represents a file system path.
constexpr const char * tx(const char *p)
A briefer alternative to G::gettext_noop().