gruik

Fork of GCU-Squad's RSS-to-IRC bridge
git clone https://git.instinctive.eu/gruik.git
Log | Files | Refs | README | LICENSE

commit 4a325eb5d6cf2775b3e776efa0fdb123728f14ae
parent cb60e9a02b9fefb5c02d5d795e6d1cc139250bfd
Author: Emile 'iMil' Heitor <imil@NetBSD.org>
Date:   Fri, 14 Jul 2023 12:34:56 +0200

docs: comments

Diffstat:
Mmain.go | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/main.go b/main.go @@ -28,6 +28,7 @@ const maxNews = 100 var newsList []News +// Create a hash out of news title and link func mkHash(s1, s2 string) string { s := s1 + s2 h := sha256.Sum256([]byte(s)) @@ -35,6 +36,7 @@ func mkHash(s1, s2 string) string { return hash[:8] } +// Checks if news exists by searching its hash func newsExists(news News) bool { for _, n := range newsList { if n.Hash == news.Hash { @@ -44,6 +46,7 @@ func newsExists(news News) bool { return false } +// Retrieve a news by its hash func getNewsByHash(hash string) News { if strings.Contains(hash, "#") { hash = hash[1:] @@ -56,6 +59,7 @@ func getNewsByHash(hash string) News { return News{} } +// Retrieve news from a certain origin func getNewsByOrigin(origin string) []News { resNews := []News{} @@ -201,6 +205,7 @@ func isOp(nick string) bool { return false } +// Get the second part of a command func getParam(s string) string { if !strings.Contains(s, " ") { return ""