diff options
Diffstat (limited to 'worker/mbox')
-rw-r--r-- | worker/mbox/io.go | 6 | ||||
-rw-r--r-- | worker/mbox/models.go | 8 | ||||
-rw-r--r-- | worker/mbox/worker.go | 13 |
3 files changed, 14 insertions, 13 deletions
diff --git a/worker/mbox/io.go b/worker/mbox/io.go index 2fe39813..f5fbc596 100644 --- a/worker/mbox/io.go +++ b/worker/mbox/io.go @@ -5,15 +5,15 @@ import ( "io" "time" + "git.sr.ht/~rjarry/aerc/lib/rfc822" "git.sr.ht/~rjarry/aerc/models" - "git.sr.ht/~rjarry/aerc/worker/lib" "github.com/emersion/go-mbox" ) -func Read(r io.Reader) ([]lib.RawMessage, error) { +func Read(r io.Reader) ([]rfc822.RawMessage, error) { mbr := mbox.NewReader(r) uid := uint32(0) - messages := make([]lib.RawMessage, 0) + messages := make([]rfc822.RawMessage, 0) for { msg, err := mbr.NextMessage() if errors.Is(err, io.EOF) { diff --git a/worker/mbox/models.go b/worker/mbox/models.go index 491128c5..5acd6f5a 100644 --- a/worker/mbox/models.go +++ b/worker/mbox/models.go @@ -5,8 +5,8 @@ import ( "fmt" "io" + "git.sr.ht/~rjarry/aerc/lib/rfc822" "git.sr.ht/~rjarry/aerc/models" - "git.sr.ht/~rjarry/aerc/worker/lib" ) type mailboxContainer struct { @@ -91,7 +91,7 @@ func (md *mailboxContainer) Copy(dest, src string, uids []uint32) error { type container struct { filename string - messages []lib.RawMessage + messages []rfc822.RawMessage } func (f *container) Uids() []uint32 { @@ -102,7 +102,7 @@ func (f *container) Uids() []uint32 { return uids } -func (f *container) Message(uid uint32) (lib.RawMessage, error) { +func (f *container) Message(uid uint32) (rfc822.RawMessage, error) { for _, m := range f.messages { if uid == m.UID() { return m, nil @@ -112,7 +112,7 @@ func (f *container) Message(uid uint32) (lib.RawMessage, error) { } func (f *container) Delete(uids []uint32) (deleted []uint32) { - newMessages := make([]lib.RawMessage, 0) + newMessages := make([]rfc822.RawMessage, 0) for _, m := range f.messages { del := false for _, uid := range uids { diff --git a/worker/mbox/worker.go b/worker/mbox/worker.go index ab853b1c..160dfa55 100644 --- a/worker/mbox/worker.go +++ b/worker/mbox/worker.go @@ -10,6 +10,7 @@ import ( "path/filepath" "sort" + "git.sr.ht/~rjarry/aerc/lib/rfc822" "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/handlers" @@ -201,13 +202,13 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { break } - fullMsg, err := lib.ReadMessage(contentReader) + fullMsg, err := rfc822.ReadMessage(contentReader) if err != nil { reterr = fmt.Errorf("could not read message: %w", err) break } - r, err := lib.FetchEntityPartReader(fullMsg, msg.Part) + r, err := rfc822.FetchEntityPartReader(fullMsg, msg.Part) if err != nil { w.worker.Errorf( "could not get body part reader for message=%d, parts=%#v: %w", @@ -282,7 +283,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { msg.Flags, msg.Enable, err) continue } - info, err := lib.MessageInfo(m) + info, err := rfc822.MessageInfo(m) if err != nil { w.worker.Errorf("could not get message info: %v", err) continue @@ -410,7 +411,7 @@ func filterUids(folder *container, uids []uint32, args []string) ([]uint32, erro return nil, err } log.Debugf("Search with parsed criteria: %#v", criteria) - m := make([]lib.RawMessage, 0, len(uids)) + m := make([]rfc822.RawMessage, 0, len(uids)) for _, uid := range uids { msg, err := folder.Message(uid) if err != nil { @@ -448,8 +449,8 @@ func sortUids(folder *container, uids []uint32, return lib.Sort(infos, criteria) } -func messageInfo(m lib.RawMessage, needSize bool) (*models.MessageInfo, error) { - info, err := lib.MessageInfo(m) +func messageInfo(m rfc822.RawMessage, needSize bool) (*models.MessageInfo, error) { + info, err := rfc822.MessageInfo(m) if err != nil { return nil, err } |