diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2023-08-30 15:41:28 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-08-31 00:05:31 +0200 |
commit | 9cc507049b7b4b1c5d431deaec0854f4bec67dba (patch) | |
tree | 79aca74d2188a1aa6979e5b6f9a42dcab03a1b92 /commands | |
parent | a8ac5d3c4ca9a55a4cdc320f8163255a72edd917 (diff) | |
download | aerc-9cc507049b7b4b1c5d431deaec0854f4bec67dba.tar.gz |
postpone: remove datacounter passthrough writer
Remove the use of package datacounter and it's passthrough write
counter. We can directly get the quantity of bytes written to our buffer
with buf.Len()
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/compose/postpone.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/commands/compose/postpone.go b/commands/compose/postpone.go index 9cb337bc..fd59cc11 100644 --- a/commands/compose/postpone.go +++ b/commands/compose/postpone.go @@ -4,7 +4,6 @@ import ( "bytes" "time" - "github.com/miolini/datacounter" "github.com/pkg/errors" "git.sr.ht/~sircmpwn/getopt" @@ -116,20 +115,19 @@ func (p Postpone) Execute(aerc *widgets.Aerc, args []string) error { } aerc.RemoveTab(composer, false) - var buf bytes.Buffer - ctr := datacounter.NewWriterCounter(&buf) - err = composer.WriteMessage(header, ctr) + buf := &bytes.Buffer{} + + err = composer.WriteMessage(header, buf) if err != nil { handleErr(errors.Wrap(err, "WriteMessage")) return } - nbytes := int(ctr.Count()) worker.PostAction(&types.AppendMessage{ Destination: targetFolder, Flags: models.SeenFlag, Date: time.Now(), - Reader: &buf, - Length: int(nbytes), + Reader: buf, + Length: buf.Len(), }, func(msg types.WorkerMessage) { switch msg := msg.(type) { case *types.Done: |