aboutsummaryrefslogtreecommitdiffstats
path: root/config/converters.go
diff options
context:
space:
mode:
Diffstat (limited to 'config/converters.go')
-rw-r--r--config/converters.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/config/converters.go b/config/converters.go
new file mode 100644
index 00000000..8c6b88df
--- /dev/null
+++ b/config/converters.go
@@ -0,0 +1,34 @@
+package config
+
+import (
+ "fmt"
+ "strings"
+
+ "git.sr.ht/~rjarry/aerc/log"
+ "github.com/go-ini/ini"
+)
+
+func (config *AercConfig) parseConverters(file *ini.File) error {
+ converters, err := file.GetSection("multipart-converters")
+ if err != nil {
+ goto out
+ }
+
+ for mimeType, command := range converters.KeysHash() {
+ mimeType = strings.ToLower(mimeType)
+ if mimeType == "text/plain" {
+ return fmt.Errorf(
+ "multipart-converters: text/plain is reserved")
+ }
+ if !strings.HasPrefix(mimeType, "text/") {
+ return fmt.Errorf(
+ "multipart-converters: %q: only text/* MIME types are supported",
+ mimeType)
+ }
+ config.Converters[mimeType] = command
+ }
+
+out:
+ log.Debugf("aerc.conf: [multipart-converters] %#v", config.Converters)
+ return nil
+}