aboutsummaryrefslogtreecommitdiffstats
path: root/lib/msgid.go
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2019-07-03 10:24:11 -0400
committerDrew DeVault <sir@cmpwn.com>2019-07-04 11:24:19 -0400
commit8d9d94f0ee63216b50674d0857ef1f2c744737d5 (patch)
treea296dd61078903075bdce19e6dc0894aeb8c037d /lib/msgid.go
parentcffa2365be267ca2b243eee0cbb40593c0e01a3d (diff)
downloadaerc-8d9d94f0ee63216b50674d0857ef1f2c744737d5.tar.gz
Use go-message implementation of GenerateMessageID
Now that this is available in the upstream, we no longer need to maintain a parallel implementation.
Diffstat (limited to 'lib/msgid.go')
-rw-r--r--lib/msgid.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/lib/msgid.go b/lib/msgid.go
deleted file mode 100644
index 8282d1d6..00000000
--- 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)
-}