diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-05-01 16:42:31 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-05-01 16:42:31 +0200 |
commit | d7de88398ca67d7213fb849db60e5963fd3bc32f (patch) | |
tree | 9168196dc5053185eefc951c3c0be0e8024b2a1d /internal/feed | |
parent | 042361bc0cf7c0c4a0c14ee554e0e32c6088dee8 (diff) | |
download | feed2imap-go-d7de88398ca67d7213fb849db60e5963fd3bc32f.tar.gz feed2imap-go-d7de88398ca67d7213fb849db60e5963fd3bc32f.tar.bz2 feed2imap-go-d7de88398ca67d7213fb849db60e5963fd3bc32f.zip |
Remove pointers from feed options. Detect unknown fields in feed and group options.
Diffstat (limited to 'internal/feed')
-rw-r--r-- | internal/feed/feed.go | 4 | ||||
-rw-r--r-- | internal/feed/parse.go | 8 | ||||
-rw-r--r-- | internal/feed/state.go | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/internal/feed/feed.go b/internal/feed/feed.go index f111cd6..ddc91ed 100644 --- a/internal/feed/feed.go +++ b/internal/feed/feed.go @@ -53,10 +53,10 @@ func (feed *Feed) descriptor() feedDescriptor { } func (feed *Feed) NeedsUpdate(updateTime time.Time) bool { - if *feed.MinFreq == 0 { // shortcut + if feed.MinFreq == 0 { // shortcut return true } - if !updateTime.IsZero() && int(time.Since(updateTime).Hours()) < *feed.MinFreq { + if !updateTime.IsZero() && int(time.Since(updateTime).Hours()) < feed.MinFreq { log.Printf("Feed '%s' does not need updating, skipping.", feed.Name) return false } diff --git a/internal/feed/parse.go b/internal/feed/parse.go index 539cad0..fe3374a 100644 --- a/internal/feed/parse.go +++ b/internal/feed/parse.go @@ -14,14 +14,14 @@ import ( // share HTTP clients var ( - stdHTTPClient *http.Client - unsafeHTTPClient *http.Client + stdHTTPClient *http.Client + unsafeHTTPClient *http.Client ) func init() { // std stdHTTPClient = &http.Client{Transport: http.DefaultTransport} - + // unsafe tlsConfig := &tls.Config{InsecureSkipVerify: true} transport := http.DefaultTransport.(*http.Transport).Clone() @@ -45,7 +45,7 @@ func parseFeed(feed *Feed) error { defer cancel() fp := gofeed.NewParser() - fp.Client = httpClient(*feed.NoTLS) + fp.Client = httpClient(feed.NoTLS) parsedFeed, err := fp.ParseURLWithContext(feed.Url, ctx) if err != nil { diff --git a/internal/feed/state.go b/internal/feed/state.go index a060a77..cc9dd94 100644 --- a/internal/feed/state.go +++ b/internal/feed/state.go @@ -82,7 +82,7 @@ func filterFeed(feed *Feed) { origLen := len(feed.items) log.Debugf("Filtering %s. Starting with %d items", feed.Name, origLen) - items := feed.cached.filterItems(feed.items, *feed.Options.IgnHash, *feed.Options.AlwaysNew) + items := feed.cached.filterItems(feed.items, feed.IgnHash, feed.AlwaysNew) feed.items = items newLen := len(feed.items) @@ -122,7 +122,7 @@ func NewState(cfg *config.Config) *State { func (state *State) RemoveUndue() { for name, feed := range state.feeds { - if *feed.Options.Disable || !feed.NeedsUpdate(feed.cached.Last()) { + if feed.Disable || !feed.NeedsUpdate(feed.cached.Last()) { delete(state.feeds, name) } } |