list

server

This is the main dovel repository, it has the Go code to run dovel SMTP server.

curl https://dovel.email/server.tar tar

1350260

Author: bmayer3 (bmayer@sibros.tech)

Date: Tue Feb 7 19:18:20 2023 -0300

Parent: c8304fc

Improved interface

Changed parsemail provider

Diff

cmd/dovel/main.go

commit 135026007c4be6c7208ee2c19d9e85f06c8f7081
Author: bmayer3 <bmayer@sibros.tech>
Date:   Tue Feb 7 19:18:20 2023 -0300

    Improved interface
    
    Changed parsemail provider

diff --git a/cmd/dovel/main.go b/cmd/dovel/main.go
index 6e2f485..7ec4893 100644
--- a/cmd/dovel/main.go
+++ b/cmd/dovel/main.go
@@ -14,8 +14,10 @@ import (
 	"blmayer.dev/x/dovel/interfaces"
 	"blmayer.dev/x/dovel/interfaces/file"
 	"blmayer.dev/x/dovel/interfaces/gwi"
+
 	"github.com/emersion/go-smtp"
-	"github.com/vraycc/go-parsemail"
+
+	"github.com/marcospgmelo/parsemail"
 )
 
 type backend struct {

go.mod

commit 135026007c4be6c7208ee2c19d9e85f06c8f7081
Author: bmayer3 <bmayer@sibros.tech>
Date:   Tue Feb 7 19:18:20 2023 -0300

    Improved interface
    
    Changed parsemail provider

diff --git a/go.mod b/go.mod
index adbab2c..c75448e 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.19
 require (
 	github.com/emersion/go-smtp v0.15.0
 	github.com/go-git/go-git/v5 v5.4.2
-	github.com/vraycc/go-parsemail v0.0.0-20221110135954-331ae329fca6
+	github.com/marcospgmelo/parsemail v1.3.0
 )
 
 require (

go.sum

commit 135026007c4be6c7208ee2c19d9e85f06c8f7081
Author: bmayer3 <bmayer@sibros.tech>
Date:   Tue Feb 7 19:18:20 2023 -0300

    Improved interface
    
    Changed parsemail provider

diff --git a/go.sum b/go.sum
index e8a956f..910a71b 100644
--- a/go.sum
+++ b/go.sum
@@ -55,6 +55,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
 github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/marcospgmelo/parsemail v1.3.0 h1:vl7hmg+DYOu3qvoPwLWt9XZUMfBZOG1ULTjjJsSvx+Y=
+github.com/marcospgmelo/parsemail v1.3.0/go.mod h1:bzTPHUEfHfbAxgj0nNHBAEH50bbKSkSuNVx8HEpO+5A=
 github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=
 github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
 github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
@@ -76,8 +78,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/vraycc/go-parsemail v0.0.0-20221110135954-331ae329fca6 h1:heYIND9fCman7upF5lbS2YJja7h6a6jScqtTorle5ds=
-github.com/vraycc/go-parsemail v0.0.0-20221110135954-331ae329fca6/go.mod h1:t/GKLZo41c5vN5lo5suZXFRlFXvEqjLgIOYlVNq1Q1A=
 github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
 github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
 github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=

interfaces/file/file.go

commit 135026007c4be6c7208ee2c19d9e85f06c8f7081
Author: bmayer3 <bmayer@sibros.tech>
Date:   Tue Feb 7 19:18:20 2023 -0300

    Improved interface
    
    Changed parsemail provider

diff --git a/interfaces/file/file.go b/interfaces/file/file.go
index bc75811..9724160 100644
--- a/interfaces/file/file.go
+++ b/interfaces/file/file.go
@@ -12,12 +12,14 @@ import (
 	"net/smtp"
 	"os"
 	"path"
+	"sort"
 	"strconv"
 	"strings"
 	"time"
 
 	"blmayer.dev/x/dovel/interfaces"
-	"github.com/vraycc/go-parsemail"
+
+	"github.com/marcospgmelo/parsemail"
 )
 
 // FileConfig is used to configure the file handler, now it only contains
@@ -258,6 +260,12 @@ func (f FileHandler) Mailboxes(folder string) ([]interfaces.Mailbox, error) {
 
 		threads = append(threads, t)
 	}
+	sort.Slice(
+		threads,
+		func(i, j int) bool {
+			return threads[i].LastMod.After(threads[j].LastMod)
+		},
+	)
 
 	return threads, nil
 }

interfaces/main.go

commit 135026007c4be6c7208ee2c19d9e85f06c8f7081
Author: bmayer3 <bmayer@sibros.tech>
Date:   Tue Feb 7 19:18:20 2023 -0300

    Improved interface
    
    Changed parsemail provider

diff --git a/interfaces/main.go b/interfaces/main.go
index 96352fd..6a31539 100644
--- a/interfaces/main.go
+++ b/interfaces/main.go
@@ -5,9 +5,11 @@ package interfaces
 
 import (
 	"time"
+
 	"github.com/go-git/go-git/v5/plumbing"
 	"github.com/go-git/go-git/v5/plumbing/object"
-	"github.com/vraycc/go-parsemail"
+
+	"github.com/marcospgmelo/parsemail"
 )
 
 type User interface {
@@ -55,13 +57,13 @@ type Email struct {
 
 func ToEmail(mail parsemail.Email) Email {
 	m := Email{
-		From: mail.From[0].Address,
-		To: []string{},
-		Cc: []string{},
+		From:    mail.From[0].Address,
+		To:      []string{},
+		Cc:      []string{},
 		Subject: mail.Subject,
-		ID: mail.MessageID,
-		Date: mail.Date,
-		Body: mail.TextBody,
+		ID:      mail.MessageID,
+		Date:    mail.Date,
+		Body:    mail.TextBody,
 	}
 	for _, to := range mail.To {
 		m.To = append(m.To, to.Address)

www/inboxes.html

commit 135026007c4be6c7208ee2c19d9e85f06c8f7081
Author: bmayer3 <bmayer@sibros.tech>
Date:   Tue Feb 7 19:18:20 2023 -0300

    Improved interface
    
    Changed parsemail provider

diff --git a/www/inboxes.html b/www/inboxes.html
index 5227efc..c370589 100644
--- a/www/inboxes.html
+++ b/www/inboxes.html
@@ -4,6 +4,8 @@
 {{template "style-min.html"}}
 {{with $inbox := (index .inbox 0)}}
 <pre>
+// <a href="index.html">index</a>
+//
 <b>// inbox {{$inbox}}</b>
 
 // <a href="compose.html?inbox={{$inbox}}">compose</a>

www/index.html

commit 135026007c4be6c7208ee2c19d9e85f06c8f7081
Author: bmayer3 <bmayer@sibros.tech>
Date:   Tue Feb 7 19:18:20 2023 -0300

    Improved interface
    
    Changed parsemail provider

diff --git a/www/index.html b/www/index.html
index 5e8a1ff..cdad7f7 100644
--- a/www/index.html
+++ b/www/index.html
@@ -1,6 +1,6 @@
 <title>dovel</title>
 <link rel=icon href=data:;,>
-<meta name="viewport" content="width=541, initial-scale=1"/>
+<meta name="viewport" content="width=device-width, initial-scale=1"/>
 {{template "style-min.html"}}
 <pre>
 <b>// inboxes!</b>

www/mail.html

commit 135026007c4be6c7208ee2c19d9e85f06c8f7081
Author: bmayer3 <bmayer@sibros.tech>
Date:   Tue Feb 7 19:18:20 2023 -0300

    Improved interface
    
    Changed parsemail provider

diff --git a/www/mail.html b/www/mail.html
index eb25b2f..430540d 100644
--- a/www/mail.html
+++ b/www/mail.html
@@ -1,11 +1,11 @@
 <title>dovel</title>
 <link rel=icon href=data:;,>
-<meta name="viewport" content="width=541, initial-scale=1"/>
+<meta name="viewport" content="width=device-widht, initial-scale=1"/>
 {{template "style-min.html"}}
 {{with $subj := printf "%s/%s" (index .inbox 0) (index .subj 0)}}
 {{with $inbox := (index $.inbox 0)}}
 <pre>
-<b>// about {{$subj}}</b>
+// <a href="mails.html?inbox={{$inbox}}&subj={{index $.subj 0}}">back</a>
 {{range (mails $subj)}}
 // From: {{.From}}
 // To: {{index .To 0}}

www/mails.html

commit 135026007c4be6c7208ee2c19d9e85f06c8f7081
Author: bmayer3 <bmayer@sibros.tech>
Date:   Tue Feb 7 19:18:20 2023 -0300

    Improved interface
    
    Changed parsemail provider

diff --git a/www/mails.html b/www/mails.html
index 5e5fdbf..6c8ffd5 100644
--- a/www/mails.html
+++ b/www/mails.html
@@ -1,16 +1,19 @@
 <title>dovel</title>
 <link rel=icon href=data:;,>
-<meta name="viewport" content="width=541, initial-scale=1"/>
+<meta name="viewport" content="width=device-widht, initial-scale=1"/>
 {{template "style-min.html"}}
 {{with $subj := (index .subj 0)}}
 {{with $inbox := (index $.inbox 0)}}
 <pre>
-<b>// about {{$inbox}}/{{$subj}}</b>
+// <a href="inboxes.html?inbox={{$inbox}}">inbox</a>
+//
+<b>// about {{$inbox}}</b>
 {{range (mails (print $inbox "/" $subj))}}
+// <a href="mail.html?inbox={{$inbox}}&subj={{$subj}}&id={{.ID}}">{{$subj}}</a>
 {{if eq $inbox .From -}}
-// To: <a href="mail.html?inbox={{$inbox}}&subj={{$subj}}&id={{.ID}}">{{index .To 0}}</a>
+// To: {{index .To 0}}</a>
 {{- else -}}
-// From: <a href="mail.html?inbox={{$inbox}}&subj={{$subj}}&id={{.ID}}">{{.From}}</a>
+// From: {{.From}}
 {{- end}}
 // Date: {{.Date.Format "Mon, 02 Jan 2006 15:04:05 MST"}}{{if .Cc}}
 // Cc: .Cc{{end}}

www/style-min.html

commit 135026007c4be6c7208ee2c19d9e85f06c8f7081
Author: bmayer3 <bmayer@sibros.tech>
Date:   Tue Feb 7 19:18:20 2023 -0300

    Improved interface
    
    Changed parsemail provider

diff --git a/www/style-min.html b/www/style-min.html
index a993a2d..fd2964f 100644
--- a/www/style-min.html
+++ b/www/style-min.html
@@ -1,2 +1,16 @@
-<style>body{width:541;margin:99 auto;background:#000;color:#0f0;font-size:13pt}a{color:#f0f}</style>
+<style>
+body{
+	width:541;
+	margin:99 auto;
+	background:#000;
+	color:#0f0;
+	font-size:12pt;
+}
+a{
+	color:#f0f
+}
+pre{
+	white-space: pre-wrap;
+}
+</style>