diff options
author | Robin Jarry <robin@jarry.cc> | 2023-10-17 14:40:08 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-10-28 19:24:55 +0200 |
commit | 57088312fdd8e602a084bd5736a0e22a34be9ec0 (patch) | |
tree | 8c5544262cf8c1772ec661748cfa4d5491ff4c77 /worker/notmuch | |
parent | 591659b52867cb118d1f82d41693a02123935e0c (diff) | |
download | aerc-57088312fdd8e602a084bd5736a0e22a34be9ec0.tar.gz |
worker: move shared code to lib
Avoid importing code from worker/lib into lib. It should only be the
other way around. Move the message parsing code used by maildir,
notmuch, mbox and the eml viewer into a lib/rfc822 package.
Adapt imports accordingly.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
Tested-by: Inwit <inwit@sindominio.net>
Diffstat (limited to 'worker/notmuch')
-rw-r--r-- | worker/notmuch/message.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/worker/notmuch/message.go b/worker/notmuch/message.go index f78adeff..19011679 100644 --- a/worker/notmuch/message.go +++ b/worker/notmuch/message.go @@ -12,6 +12,7 @@ import ( "github.com/emersion/go-maildir" + "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/lib" @@ -35,7 +36,7 @@ func (m *Message) NewReader() (io.ReadCloser, error) { // MessageInfo populates a models.MessageInfo struct for the message. func (m *Message) MessageInfo() (*models.MessageInfo, error) { - info, err := lib.MessageInfo(m) + info, err := rfc822.MessageInfo(m) if err != nil { return nil, err } @@ -62,11 +63,11 @@ func (m *Message) NewBodyPartReader(requestedParts []int) (io.Reader, error) { return nil, err } defer f.Close() - msg, err := lib.ReadMessage(f) + msg, err := rfc822.ReadMessage(f) if err != nil { return nil, fmt.Errorf("could not read message: %w", err) } - return lib.FetchEntityPartReader(msg, requestedParts) + return rfc822.FetchEntityPartReader(msg, requestedParts) } // SetFlag adds or removes a flag from the message. |