about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/msgid.go34
-rw-r--r--widgets/compose.go3
2 files changed, 1 insertions, 36 deletions
diff --git a/lib/msgid.go b/lib/msgid.go
deleted file mode 100644
index 8282d1d..0000000
--- a/lib/msgid.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package lib
-
-// TODO: Remove this pending merge into github.com/emersion/go-message
-
-import (
-	"bytes"
-	"encoding/binary"
-	"fmt"
-	"math/rand"
-	"os"
-	"time"
-
-	"github.com/martinlindhe/base36"
-)
-
-// Generates an RFC 2822-complaint Message-Id based on the informational draft
-// "Recommendations for generating Message IDs", for lack of a better
-// authoritative source.
-func GenerateMessageId() string {
-	var (
-		now   bytes.Buffer
-		nonce bytes.Buffer
-	)
-	binary.Write(&now, binary.BigEndian, time.Now().UnixNano())
-	binary.Write(&nonce, binary.BigEndian, rand.Uint64())
-	hostname, err := os.Hostname()
-	if err != nil {
-		hostname = "localhost"
-	}
-	return fmt.Sprintf("<%s.%s@%s>",
-		base36.EncodeBytes(now.Bytes()),
-		base36.EncodeBytes(nonce.Bytes()),
-		hostname)
-}
diff --git a/widgets/compose.go b/widgets/compose.go
index dc12e60..d0a4629 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -15,7 +15,6 @@ import (
 	"github.com/pkg/errors"
 
 	"git.sr.ht/~sircmpwn/aerc/config"
-	"git.sr.ht/~sircmpwn/aerc/lib"
 	"git.sr.ht/~sircmpwn/aerc/lib/ui"
 	"git.sr.ht/~sircmpwn/aerc/worker/types"
 )
@@ -210,7 +209,7 @@ func (c *Composer) PrepareHeader() (*mail.Header, []string, error) {
 	// Update headers
 	mhdr := (*message.Header)(&header.Header)
 	mhdr.SetContentType("text/plain", map[string]string{"charset": "UTF-8"})
-	mhdr.SetText("Message-Id", lib.GenerateMessageId())
+	mhdr.SetText("Message-Id", mail.GenerateMessageID())
 	if subject, _ := header.Subject(); subject == "" {
 		header.SetSubject(c.headers.subject.input.String())
 	}