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

Move smtpd/utils.go into dedicated stringutil pkg

This commit is contained in:
James Hillyerd
2017-12-26 22:55:20 -08:00
parent 06165cb3d3
commit 25815767a7
8 changed files with 29 additions and 27 deletions

View File

@@ -14,6 +14,7 @@ import (
"github.com/jhillyerd/inbucket/config"
"github.com/jhillyerd/inbucket/datastore"
"github.com/jhillyerd/inbucket/log"
"github.com/jhillyerd/inbucket/stringutil"
)
// Name of index file in each mailbox
@@ -82,11 +83,11 @@ func DefaultFileDataStore() datastore.DataStore {
// MailboxFor retrieves the Mailbox object for a specified email address, if the mailbox
// does not exist, it will attempt to create it.
func (ds *FileDataStore) MailboxFor(emailAddress string) (datastore.Mailbox, error) {
name, err := ParseMailboxName(emailAddress)
name, err := stringutil.ParseMailboxName(emailAddress)
if err != nil {
return nil, err
}
dir := HashMailboxName(name)
dir := stringutil.HashMailboxName(name)
s1 := dir[0:3]
s2 := dir[0:6]
path := filepath.Join(ds.mailPath, s1, s2, dir)