aboutsummaryrefslogtreecommitdiff
path: root/internal/config/config.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-20 02:02:15 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-20 02:02:15 +0200
commit9e45db27daa3b682c4d8e1e1aa9e66594cf887a4 (patch)
tree251177708d11f7118541fc49ac1549df18803ad7 /internal/config/config.go
parentf1231aa444bd13aa031fe6e3dac32138436f956b (diff)
downloadfeed2imap-go-9e45db27daa3b682c4d8e1e1aa9e66594cf887a4.tar.gz
feed2imap-go-9e45db27daa3b682c4d8e1e1aa9e66594cf887a4.tar.bz2
feed2imap-go-9e45db27daa3b682c4d8e1e1aa9e66594cf887a4.zip
Started with mail creation
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go28
1 files changed, 25 insertions, 3 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 6497ce1..a37cef1 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -10,15 +10,17 @@ import (
type Map map[string]interface{}
type GlobalOptions struct {
- Timeout int `yaml:"timeout"`
- DefaultEmail string `yaml:"default-email"`
- Target string `yaml:"target"`
+ Timeout int `yaml:"timeout"`
+ DefaultEmail string `yaml:"default-email"`
+ Target string `yaml:"target"`
+ Parts []string `yaml:"parts"`
}
var DefaultGlobalOptions = GlobalOptions{
Timeout: 30,
DefaultEmail: username() + "@" + hostname(),
Target: "",
+ Parts: []string{"text", "html"},
}
type Config struct {
@@ -31,6 +33,26 @@ type Options struct {
InclImages *bool `yaml:"include-images"`
}
+func (c *Config) WithPartText() bool {
+ for _, part := range c.Parts {
+ if part == "text" {
+ return true
+ }
+ }
+
+ return false
+}
+
+func (c *Config) WithPartHtml() bool {
+ for _, part := range c.Parts {
+ if part == "html" {
+ return true
+ }
+ }
+
+ return false
+}
+
func hostname() (hostname string) {
hostname, err := os.Hostname()
if err != nil {
0-04-19Improved IMAPRené 'Necoro' Neumann1-3/+88 2020-04-19Started IMAP connectionRené 'Necoro' Neumann4-0/+152 2020-04-19Use our own logger for debug for convenience sakeRené 'Necoro' Neumann1-2/+3 2020-04-19Fix debug logging m(René 'Necoro' Neumann1-2/+2 2020-04-19Rename util.go to log.go. Add verbose modeRené 'Necoro' Neumann4-24/+54 2020-04-19Clean go.modRené 'Necoro' Neumann2-3/+0 2020-04-19Do not print the parsedCfg anymoreRené 'Necoro' Neumann1-1/+1 2020-04-19Increase go-version to 1.14René 'Necoro' Neumann1-2/+2 2020-04-19CI: go vetRené 'Necoro' Neumann1-0/+3 2020-04-19Fetching and parsing the feedsRené 'Necoro' Neumann5-4/+113 2020-04-19Ignore all config*.ymlRené 'Necoro' Neumann1-1/+1