commit 91962bf1d916e9d9ec6537efea65c6f95b8d35f6
parent 61f0fd308c10d0494b679542d77ff09695da9c64
Author: Emile "iMil" Heitor <imil@netbsd.org>
Date: Mon, 17 Jun 2024 19:23:27 +0000
Merge branch 'secondary' into 'main'
fix: process all `#` when secondary
See merge request gcu-squad/gruik!7
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/main.go b/main.go
@@ -318,12 +318,13 @@ func main() {
}
if viper.GetBool("irc.secondary") {
- _, suffix, found := strings.Cut(e.Last(), "#")
- if found && len(suffix) >= 8 {
- log.Printf("Received hash %s from %s", suffix[:8], e.Source.Name)
- news := News{ Hash: suffix[:8] }
- if !newsExists(news) {
- saveNews(news)
+ for _, suffix, found := strings.Cut(e.Last(), "#"); found && len(suffix) >= 8; _, suffix, found = strings.Cut(suffix, "#") {
+ if strings.Trim(suffix[:8], "0123456789abcdef") == "" {
+ log.Printf("Received hash %s from %s", suffix[:8], e.Source.Name)
+ news := News{Hash: suffix[:8]}
+ if !newsExists(news) {
+ saveNews(news)
+ }
}
}
}