Unified · Split
| @@ -23,6 +23,7 @@ var ( · 22 unmodified lines | ||
| 23 | 23 | nick = flag.String("nick", "feed2irc", "IRC nickname") |
| 24 | 24 | period = flag.String("period", "10m", "Update period") |
| 25 | 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 | |
| 28 | 29 | func main() { |
| @@ -58,6 +59,10 @@ func main() { · 29 unmodified lines | ||
| 58 | 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 | 67 | cfg := irc.NewConfig(*nick, "feed2ircbot", "feed2irc bot") |
| 63 | 68 | c := irc.Client(cfg) |
| @@ -99,9 +104,11 @@ func main() { · 35 unmodified lines | ||
| 99 | 104 | os.Exit(1) |
| 100 | 105 | } |
| 101 | 106 | seenFile.Sync() |
| 102 | − s := fmt.Sprintf("%s | %s\n", item.Title, item.Link) | |
| 103 | − c.Privmsgln(*channel, s) | |
| 104 | 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 | } |