1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2026-01-26 13:05:56 +00:00

More basic POP3 implementation

Filestore/Datastore now supports a Size() method.
This commit is contained in:
James Hillyerd
2013-09-10 17:56:04 -07:00
parent 338698d461
commit 983b4f745a
4 changed files with 118 additions and 45 deletions

View File

@@ -30,4 +30,5 @@ type Message interface {
Close() error
Delete() error
String() string
Size() int64
}

View File

@@ -217,6 +217,14 @@ func (m *FileMessage) String() string {
return fmt.Sprintf("\"%v\" from %v", m.Fsubject, m.Ffrom)
}
func (m *FileMessage) Size() int64 {
fi, err := os.Stat(m.rawPath())
if err != nil {
return 0
}
return fi.Size()
}
func (m *FileMessage) gobPath() string {
return filepath.Join(m.mailbox.path, m.Fid+".gob")
}