From 6bd8a6c2cd153bad9ca044b409e55302e10206c1 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Sat, 2 May 2020 20:53:35 +0200 Subject: Restructure --- internal/feed/feed.go | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) (limited to 'internal/feed/feed.go') 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, -- cgit v1.2.3-70-g09d2