History

don't post all entries on the first fetch

Sigrid Solveig Haflínudóttir committed 3 months ago

Commit 50fdc581 parent 6f185841 file · +9 −2Browse files

Unified · Split

main.go+9−2
@@ -23,6 +23,7 @@ var ( · 22 unmodified lines
23 nick = flag.String("nick", "feed2irc", "IRC nickname")23 nick = flag.String("nick", "feed2irc", "IRC nickname")
24 period = flag.String("period", "10m", "Update period")24 period = flag.String("period", "10m", "Update period")
25 seenPath = flag.String("seen", "", "\"Seen\" entries store")25 seenPath = flag.String("seen", "", "\"Seen\" entries store")
26 postOld = flag.Bool("post-old", false, "Post all entries on the first fetch ever")
26)27)
27 28
28func main() {29func main() {
@@ -58,6 +59,10 @@ func main() { · 29 unmodified lines
58 seen[md5.Sum(url)] = struct{}{}59 seen[md5.Sum(url)] = struct{}{}
59 }60 }
60 }61 }
62 var skip bool
63 if len(seen) == 0 && !*postOld {
64 skip = true
65 }
61 66
62 cfg := irc.NewConfig(*nick, "feed2ircbot", "feed2irc bot")67 cfg := irc.NewConfig(*nick, "feed2ircbot", "feed2irc bot")
63 c := irc.Client(cfg)68 c := irc.Client(cfg)
@@ -99,9 +104,11 @@ func main() { · 35 unmodified lines
99 os.Exit(1)104 os.Exit(1)
100 }105 }
101 seenFile.Sync()106 seenFile.Sync()
102 s := fmt.Sprintf("%s | %s\n", item.Title, item.Link)
103 c.Privmsgln(*channel, s)
104 seen[sum] = struct{}{}107 seen[sum] = struct{}{}
108 if !skip {
109 s := fmt.Sprintf("%s | %s\n", item.Title, item.Link)
110 c.Privmsgln(*channel, s)
111 }
105 }112 }
106 }113 }
107 }114 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t