aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-26 17:52:55 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-26 17:52:55 +0200
commit63d20f3f7b02f33475049c12e03569a4f67fe810 (patch)
tree42cf1c8bd5d839a410c106c8a1d86b4d4180db37 /internal
parent9e69c102b596924d589693ce537c4fecae3aa44c (diff)
downloadfeed2imap-go-63d20f3f7b02f33475049c12e03569a4f67fe810.tar.gz
feed2imap-go-63d20f3f7b02f33475049c12e03569a4f67fe810.tar.bz2
feed2imap-go-63d20f3f7b02f33475049c12e03569a4f67fe810.zip
Options: "disable" and "ignore-hash"
Diffstat (limited to '')
-rw-r--r--internal/feed/cache.go2
-rw-r--r--internal/feed/cache_v1.go6
-rw-r--r--internal/feed/state.go4
3 files changed, 6 insertions, 6 deletions
diff --git a/internal/feed/cache.go b/internal/feed/cache.go
index 2a51cb5..b92bfa7 100644
--- a/internal/feed/cache.go
+++ b/internal/feed/cache.go
@@ -27,7 +27,7 @@ type CachedFeed interface {
Checked(withFailure bool)
Failures() uint
Last() time.Time
- filterItems([]feeditem) []feeditem
+ filterItems([]feeditem, bool) []feeditem
Commit()
}
diff --git a/internal/feed/cache_v1.go b/internal/feed/cache_v1.go
index a8e40ed..fb16027 100644
--- a/internal/feed/cache_v1.go
+++ b/internal/feed/cache_v1.go
@@ -171,7 +171,7 @@ func (cf *cachedFeed) deleteItem(index int) {
cf.Items = cf.Items[:len(cf.Items)-1]
}
-func (cf *cachedFeed) filterItems(items []feeditem) []feeditem {
+func (cf *cachedFeed) filterItems(items []feeditem, ignoreHash bool) []feeditem {
if len(items) == 0 {
return items
}
@@ -209,7 +209,7 @@ CACHE_ITEMS:
for idx, oldItem := range cf.Items {
if oldItem.Guid == ci.Guid {
log.Debugf("Guid matches with: %s", oldItem)
- if !oldItem.similarTo(&ci, false) {
+ if !oldItem.similarTo(&ci, ignoreHash) {
item.addReason("guid (upd)")
app(item, ci, &idx)
} else {
@@ -227,7 +227,7 @@ CACHE_ITEMS:
}
for idx, oldItem := range cf.Items {
- if oldItem.similarTo(&ci, false) {
+ if oldItem.similarTo(&ci, ignoreHash) {
log.Debugf("Similarity matches, ignoring: %s", oldItem)
continue CACHE_ITEMS
}
diff --git a/internal/feed/state.go b/internal/feed/state.go
index 6f284ad..ea9239a 100644
--- a/internal/feed/state.go
+++ b/internal/feed/state.go
@@ -72,7 +72,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)
+ items := feed.cached.filterItems(feed.items, *feed.Options.IgnHash)
feed.items = items
newLen := len(feed.items)
@@ -112,7 +112,7 @@ func NewState(cfg *config.Config) *State {
func (state *State) RemoveUndue() {
for name, feed := range state.feeds {
- if !feed.NeedsUpdate(feed.cached.Last()) {
+ if *feed.Options.Disable || !feed.NeedsUpdate(feed.cached.Last()) {
delete(state.feeds, name)
}
}
class='insertions'>+1 2012-09-06Use --noreport instead of head -n -2 for tree so that it works on mac.Jason A. Donenfeld1-1/+1 Reported-by: Theo Belaire <tbelaire@uwaterloo.ca> 2012-09-05Be sure to explicitly state that install is a phony target.Jason A. Donenfeld1-0/+2 2012-09-05Bump debian version horribly.1.1Jason A. Donenfeld2-2/+2 2012-09-04No echo mode.Jason A. Donenfeld2-16/+42 Add a --no-echo flag to the insert operation so that the password isn't echoed when entering it. This requires the user to echo the password twice for confirmation. Reported-by: Dominic Lüchinger <d.luechinger@snowgarden.ch> 2012-09-04Properly quote the path too.Jason A. Donenfeld1-1/+1 2012-09-04Allow passwords having spaces to go unbroken to the clipboard.Bernardo Freitas Paulo da Costa1-1/+1 This also prevents showing the second <word> of the password in the prompt. 2012-09-04Separate out the massive git example.Jason A. Donenfeld1-10/+14 2012-09-04Prepare for debianification.1.0Jason A. Donenfeld9-4/+60 2012-09-03Fix readme typo.Jason A. Donenfeld1-1/+1 2012-09-03Show program name properly in error message.Jason A. Donenfeld1-1/+1 2012-09-03Move examples into manpage.Jason A. Donenfeld4-93/+224 2012-09-03Make into a real project.Jason A. Donenfeld8-5/+173 2012-09-03Support pass gitJason A. Donenfeld2-1/+15 2012-08-31Add remove synonyms.Jason A. Donenfeld1-2/+2 2012-08-31Use basename in usage.Jason A. Donenfeld1-2/+1 2012-08-19now using gpg_id as a varMatthew Ramirez1-2/+2 2012-08-07Forty five seconds.Jason A. Donenfeld1-1/+1 2012-08-06Deal with klipper and new lines.Jason A. Donenfeld1-3/+19 2012-08-06Update examples.Jason A. Donenfeld1-7/+7 2012-08-06Update readme.Jason A. Donenfeld1-11/+13 2012-08-06Be slicker and more like git.Jason A. Donenfeld1-114/+173