aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/parse.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/parse.go
parent477241a2c2356c61b7317246040aee50d2a7a81d (diff)
downloadfeed2imap-go-6bd8a6c2cd153bad9ca044b409e55302e10206c1.tar.gz
feed2imap-go-6bd8a6c2cd153bad9ca044b409e55302e10206c1.tar.bz2
feed2imap-go-6bd8a6c2cd153bad9ca044b409e55302e10206c1.zip
Restructure
Diffstat (limited to 'internal/feed/parse.go')
-rw-r--r--internal/feed/parse.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/feed/parse.go b/internal/feed/parse.go
index 435c0ed..dfb447a 100644
--- a/internal/feed/parse.go
+++ b/internal/feed/parse.go
@@ -41,7 +41,7 @@ func httpClient(disableTLS bool) *http.Client {
return stdHTTPClient
}
-func parseFeed(feed *Feed) error {
+func (feed *Feed) parse() error {
ctx, cancel := context(feed.Global.Timeout)
defer cancel()
@@ -54,9 +54,9 @@ func parseFeed(feed *Feed) error {
}
feed.feed = parsedFeed
- feed.items = make([]feeditem, len(parsedFeed.Items))
- for idx, item := range parsedFeed.Items {
- feed.items[idx] = feeditem{Feed: parsedFeed, Item: item, itemId: shortuuid.New()}
+ feed.items = make([]item, len(parsedFeed.Items))
+ for idx, feedItem := range parsedFeed.Items {
+ feed.items[idx] = item{Feed: parsedFeed, Item: feedItem, itemId: shortuuid.New(), feed: feed}
}
return nil
}
@@ -64,7 +64,7 @@ func parseFeed(feed *Feed) error {
func handleFeed(feed *Feed) {
log.Printf("Fetching %s from %s", feed.Name, feed.Url)
- err := parseFeed(feed)
+ err := feed.parse()
if err != nil {
if feed.cached.Failures() >= feed.Global.MaxFailures {
log.Error(err)