This is the main dovel repository, it has the Go code to run dovel SMTP server.
Author: blmayer (bleemayer@gmail.com)
Date: Sat Mar 11 18:57:45 2023 -0300
Parent: 6494320
Improved docs
commit 66ed831ae62fb827aa0f3950ea262e7f8325a445
Author: blmayer <bleemayer@gmail.com>
Date: Sat Mar 11 18:57:45 2023 -0300
Improved docs
diff --git a/interfaces/file/file.go b/interfaces/file/file.go
index a7c6ea9..50d33b4 100644
--- a/interfaces/file/file.go
+++ b/interfaces/file/file.go
@@ -1,3 +1,6 @@
+// file adds the common email file handling, but with a twist: here we save
+// emails first by inbox and then subject. This package also delivers some
+// functions to be used in the templates, for the web interface.
package file
import (
commit 66ed831ae62fb827aa0f3950ea262e7f8325a445
Author: blmayer <bleemayer@gmail.com>
Date: Sat Mar 11 18:57:45 2023 -0300
Improved docs
diff --git a/interfaces/gwi/gwi.go b/interfaces/gwi/gwi.go
index 427f5f9..8966409 100644
--- a/interfaces/gwi/gwi.go
+++ b/interfaces/gwi/gwi.go
@@ -1,3 +1,4 @@
+// gwi contains the email handler for interacting with gwi.
package gwi
import (
@@ -9,11 +10,18 @@ import (
"blmayer.dev/x/dovel/interfaces"
)
+// GWIConfig is used to configure the GWI interface for dovel. Root is the
+// same root as in GWI: the path to the repositories.
+// Commands lets you add functions that will run for each received email, the
+// key of the map specifies a trigger in the form "key!". That is, if the email
+// body starts with key! then the command key is run.
type GWIConfig struct {
Root string
Commands map[string]func(email interfaces.Email) error
}
+// GwiEmailHandler saves emails to the correct repo using the subject to
+// separate them. Subject fiel must be of form "[%s] %s".
func (g GWIConfig) GwiEmailHandler(email interfaces.Email) error {
userRepoDomain := strings.Split(email.To[0], "@")
userRepo := strings.Split(userRepoDomain[0], "/")