aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/feed.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-02 20:53:35 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-02 20:53:35 +0200
commit6bd8a6c2cd153bad9ca044b409e55302e10206c1 (patch)
treeda1f175a7260a13fdfaa9a8817fc38351a480837 /internal/feed/feed.go
parent477241a2c2356c61b7317246040aee50d2a7a81d (diff)
downloadfeed2imap-go-6bd8a6c2cd153bad9ca044b409e55302e10206c1.tar.gz
feed2imap-go-6bd8a6c2cd153bad9ca044b409e55302e10206c1.tar.bz2
feed2imap-go-6bd8a6c2cd153bad9ca044b409e55302e10206c1.zip
Restructure
Diffstat (limited to 'internal/feed/feed.go')
-rw-r--r--internal/feed/feed.go43
1 files changed, 1 insertions, 42 deletions
diff --git a/internal/feed/feed.go b/internal/feed/feed.go
index 9ed44df..4a0e724 100644
--- a/internal/feed/feed.go
+++ b/internal/feed/feed.go
@@ -7,13 +7,12 @@ import (
"github.com/Necoro/feed2imap-go/pkg/config"
"github.com/Necoro/feed2imap-go/pkg/log"
- "github.com/Necoro/feed2imap-go/pkg/util"
)
type Feed struct {
*config.Feed
feed *gofeed.Feed
- items []feeditem
+ items []item
cached CachedFeed
Global config.GlobalOptions
}
@@ -23,46 +22,6 @@ type feedDescriptor struct {
Url string
}
-type feedImage struct {
- image []byte
- mime string
-}
-
-type feeditem struct {
- *gofeed.Feed
- *gofeed.Item
- Body string
- updateOnly bool
- reasons []string
- images []feedImage
- itemId string
-}
-
-// Creator returns the name of the creating author.
-// MUST NOT have `*feeditem` has the receiver, because the template breaks then.
-func (item feeditem) Creator() string {
- if item.Item.Author != nil {
- return item.Item.Author.Name
- }
- return ""
-}
-
-func (item *feeditem) addReason(reason string) {
- if !util.StrContains(item.reasons, reason) {
- item.reasons = append(item.reasons, reason)
- }
-}
-
-func (item *feeditem) addImage(img []byte, mime string) int {
- i := feedImage{img, mime}
- item.images = append(item.images, i)
- return len(item.images)
-}
-
-func (item *feeditem) clearImages() {
- item.images = []feedImage{}
-}
-
func (feed *Feed) descriptor() feedDescriptor {
return feedDescriptor{
Name: feed.Name,
d>-2/+5 2009-08-10Add credits for translationRené 'Necoro' Neumann2-0/+2