aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-02 16:48:51 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-02 16:48:51 +0200
commitd75bbcf9a7fe589f119b103d357ffa874008ab07 (patch)
tree9f5b27e5e9c48e3d0e5acd5bf6f16f60f47b6b29 /internal
parent3e219c232c0bb4a64f615c599473c959691e6319 (diff)
downloadfeed2imap-go-d75bbcf9a7fe589f119b103d357ffa874008ab07.tar.gz
feed2imap-go-d75bbcf9a7fe589f119b103d357ffa874008ab07.tar.bz2
feed2imap-go-d75bbcf9a7fe589f119b103d357ffa874008ab07.zip
Option 'body'
Diffstat (limited to 'internal')
-rw-r--r--internal/feed/mail.go35
1 files changed, 22 insertions, 13 deletions
diff --git a/internal/feed/mail.go b/internal/feed/mail.go
index 297aeff..4b0e38b 100644
--- a/internal/feed/mail.go
+++ b/internal/feed/mail.go
@@ -209,20 +209,29 @@ func cidNr(idx int) string {
return fmt.Sprintf("cid_%d", idx)
}
-func (feed *Feed) buildBody(item *feeditem) {
- var body string
- var comment string
-
- if item.Item.Content != "" {
- comment = "<!-- Content -->\n"
- body = item.Item.Content
- } else if item.Item.Description != "" {
- comment = "<!-- Description -->\n"
- body = item.Item.Description
+func getBody(content, description string, bodyCfg config.Body) string {
+ switch bodyCfg {
+ case "default":
+ if content != "" {
+ return content
+ }
+ return description
+ case "description":
+ return description
+ case "content":
+ return content
+ case "both":
+ return description + content
+ default:
+ panic(fmt.Sprintf("Unknown value for Body: %v", bodyCfg))
}
+}
+
+func (feed *Feed) buildBody(item *feeditem) {
+ body := getBody(item.Item.Content, item.Item.Description, feed.Body)
if !feed.InclImages {
- item.Body = comment + body
+ item.Body = body
return
}
@@ -230,7 +239,7 @@ func (feed *Feed) buildBody(item *feeditem) {
if err != nil {
log.Debugf("Feed %s: Error while parsing html content: %s", feed.Name, err)
if body != "" {
- item.Body = "<br />" + comment + body
+ item.Body = "<br />" + body
}
return
}
@@ -271,5 +280,5 @@ func (feed *Feed) buildBody(item *feeditem) {
}
}
- item.Body = comment + body
+ item.Body = body
}
ns'>-35/+57 An ALL category 2008-01-14 r617@Devoty: necoro | 2008-01-14 19:12:59 +0100Necoro2-10/+10 Remove unnecessairy loads of the shm module 2008-01-14 r609@Devoty: necoro | 2008-01-14 17:04:38 +0100Necoro9-394/+477 Allowed '-' and '_' in key names. Also use group names instead of their number. r610@Devoty: necoro | 2008-01-14 17:05:42 +0100 Disabled saving of the queues r611@Devoty: necoro | 2008-01-14 17:08:53 +0100 Added the possibility to permanently en-/disable plugins r612@Devoty: necoro | 2008-01-14 17:14:09 +0100 adjust changelog and translations r613@Devoty: necoro | 2008-01-14 17:40:53 +0100 Dropdown should be localized too 2008-01-14 r605@Devoty: necoro | 2008-01-14 11:43:34 +0100Necoro2-26/+129 Updated shm module to version 1.1.4 2008-01-14 r603@Devoty: necoro | 2008-01-14 11:30:26 +0100Necoro4-26/+38 Improved 'update world'; really support new use defaults 2008-01-11 r598@Devoty: necoro | 2008-01-10 16:36:29 +0100Necoro4-10/+50 Handle the new useflag format correctly 2008-01-11 r597@Devoty: necoro | 2008-01-10 14:12:35 +0100Necoro1-3/+3 updated todo 2008-01-10 r595@Devoty: necoro | 2008-01-10 04:04:15 +0100Necoro1-52/+3 Re-Introduced etc-proposals 2008-01-09 r586@Devoty: necoro | 2008-01-09 14:54:18 +0100Necoro1-1/+1 Disabled catapult till it is really usable 2007-12-06 r577@Devoty: necoro | 2007-12-06 20:37:36 +0100Necoro1-1/+1 Fixed desktop file 2007-12-06 r572@Devoty: necoro | 2007-11-28 08:48:15 +0100Necoro1-0/+1 2007-11-27 r570@Devoty: necoro | 2007-11-27 02:08:21 +0100Necoro3-84/+108 Added scrollbars to update window