Browse Source

fasterated

Signed-off-by: Erik Hollensbe <github@hollensbe.org>
main
Erik Hollensbe 6 months ago
parent
commit
f84c6dcfd0
  1. 1
      .gitignore
  2. 32
      sink.go

1
.gitignore

@ -0,0 +1 @@
/Mail

32
sink.go

@ -226,20 +226,24 @@ func run(ctx *cli.Context) error {
for msg := range msgs {
if os.Getenv("SINK_NO_WRITE") == "" {
r := msg.GetBody(&section)
_, w, err := dir.Create(nil)
if err != nil {
listdone <- fmt.Errorf("%q: error creating entry in maildir: %v", name, err)
return
}
if _, err := io.Copy(w, r); err != nil {
listdone <- fmt.Errorf("%q: failure writing mail entry: %v", name, err)
return
}
w.Close()
wg.Add(1)
go func(msg *imap.Message, section *imap.BodySectionName) {
wg.Done()
r := msg.GetBody(section)
_, w, err := dir.Create(nil)
if err != nil {
listdone <- fmt.Errorf("%q: error creating entry in maildir: %v", name, err)
return
}
if _, err := io.Copy(w, r); err != nil {
listdone <- fmt.Errorf("%q: failure writing mail entry: %v", name, err)
return
}
w.Close()
}(msg, &section)
}
messages <- msg

Loading…
Cancel
Save