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 /lib/messageview.go | |
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 'lib/messageview.go')
-rw-r--r-- | lib/messageview.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/messageview.go b/lib/messageview.go index f2d30086..6c478c6e 100644 --- a/lib/messageview.go +++ b/lib/messageview.go @@ -10,9 +10,9 @@ import ( _ "github.com/emersion/go-message/charset" "git.sr.ht/~rjarry/aerc/lib/crypto" + "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" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -94,7 +94,7 @@ func NewMessageStoreView(messageInfo *models.MessageInfo, setSeen bool, if usePGP(messageInfo.BodyStructure) { msv.FetchFull(func(fm io.Reader) { - reader := lib.NewCRLFReader(fm) + reader := rfc822.NewCRLFReader(fm) md, err := pgp.Decrypt(reader, decryptKeys) if err != nil { cb(nil, err) @@ -105,12 +105,12 @@ func NewMessageStoreView(messageInfo *models.MessageInfo, setSeen bool, cb(nil, err) return } - decrypted, err := lib.ReadMessage(bytes.NewBuffer(msv.message)) + decrypted, err := rfc822.ReadMessage(bytes.NewBuffer(msv.message)) if err != nil { cb(nil, err) return } - bs, err := lib.ParseEntityStructure(decrypted) + bs, err := rfc822.ParseEntityStructure(decrypted) if err != nil { cb(nil, err) return @@ -162,11 +162,11 @@ func (msv *MessageStoreView) FetchBodyPart(part []int, cb func(io.Reader)) { } buf := bytes.NewBuffer(msv.message) - msg, err := lib.ReadMessage(buf) + msg, err := rfc822.ReadMessage(buf) if err != nil { panic(err) } - reader, err := lib.FetchEntityPartReader(msg, part) + reader, err := rfc822.FetchEntityPartReader(msg, part) if err != nil { errMsg := fmt.Errorf("Failed to fetch message part: %w", err) log.Errorf(errMsg.Error()) |