1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2026-01-08 04:01:55 +00:00

Add REST call for purging an entire mailbox

This commit is contained in:
James Hillyerd
2013-10-14 15:35:09 -07:00
parent 46d4f7be1d
commit 1e85699ccf
7 changed files with 77 additions and 0 deletions

View File

@@ -178,6 +178,12 @@ func (mb *FileMailbox) GetMessage(id string) (Message, error) {
return nil, fmt.Errorf("Message %s not in index", id)
}
// Delete all messages in this mailbox
func (mb *FileMailbox) Purge() error {
mb.messages = mb.messages[:0]
return mb.writeIndex()
}
// readIndex loads the mailbox index data from disk
func (mb *FileMailbox) readIndex() error {
// Clear message slice, open index