New utility to import mail into PostgreSQL.
Minor leak cleanup in mailhash.
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"xinu.tv/email"
|
||||
|
||||
"github.com/golang/glog"
|
||||
@@ -47,14 +46,22 @@ func (m *Messages) hashMail(path string, info os.FileInfo, err error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
base := filepath.Base(path)
|
||||
if _, ok := m.Skip[base]; ok {
|
||||
glog.Infoln("Skipping", path)
|
||||
return nil
|
||||
}
|
||||
|
||||
r, err := os.Open(path)
|
||||
if err != nil {
|
||||
glog.Fatal(err)
|
||||
}
|
||||
defer r.Close()
|
||||
|
||||
h, err := email.Hash(r, headers)
|
||||
if err != nil {
|
||||
glog.Errorf("%s not an mail file", path)
|
||||
glog.Info("%q", err.Error())
|
||||
glog.Infof("%q", err.Error())
|
||||
return nil
|
||||
}
|
||||
md := email.NewInfo(path)
|
||||
@@ -130,6 +137,7 @@ func (m Messages) Reconcile(maildir string) error {
|
||||
if err != nil {
|
||||
glog.Fatal(err)
|
||||
}
|
||||
defer r.Close()
|
||||
|
||||
h, err := email.Hash(r, headers)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user