diff --git a/feed-to-muc.go b/feed-to-muc.go index c3e2cf9..ad35701 100644 --- a/feed-to-muc.go +++ b/feed-to-muc.go @@ -189,15 +189,15 @@ func pingMUC(client *xmpp.Client, botJid string, muc string, mucNick string) { pingReceived = false // Check for result IQ as long as there was no reply yet. - for (time.Since(pingSent).Seconds() < 10.0) && (pingReceived == false) { + for (time.Since(pingSent).Seconds() < 10.0) && !pingReceived { time.Sleep(1 * time.Second) - if pingReceived == true { + if pingReceived { break } } // Quit if no ping reply was received. - if pingReceived == false { + if !pingReceived { log.Fatal("MUC not available.") } } @@ -232,7 +232,7 @@ func processStanzas(client *xmpp.Client, muc string, mucNick string, feeds []str // Check for room mention of the bots nick if the the message type is groupchat. if v.Type == "groupchat" { // Leave if option quiet is set. - if quiet == true { + if quiet { break } // Get first word of the message and transform it to lower case. @@ -384,7 +384,7 @@ func processStanzas(client *xmpp.Client, muc string, mucNick string, feeds []str if v.Type == "get" { // Reply to disco#info requests according to https://xmpp.org/extensions/xep-0030.html. if strings.Contains(string(v.Query), - "") == true { + "") { _, err := client.RawInformation(client.JID(), v.From, v.ID, "result", ""+ ""+ @@ -392,7 +392,7 @@ func processStanzas(client *xmpp.Client, muc string, mucNick string, feeds []str if err != nil { log.Fatal("Error: Failed to reply to disco#info:", err) } - } else if strings.Contains(string(v.Query), "") == true { + } else if strings.Contains(string(v.Query), "") { // Reply to pings. _, err := client.RawInformation(client.JID(), v.From, v.ID, "result", "") if err != nil { diff --git a/getarticles.go b/getarticles.go index ea6dd1a..e7bc978 100644 --- a/getarticles.go +++ b/getarticles.go @@ -170,7 +170,7 @@ func getArticles(feedURL string, max int, noExcerpt bool, filter []string) (stri // Note: Checking for cached timestamp being newer, instead of not older // lead to duplicate messages for the same article. Probably a corner // case when the time is identical. - if last.Before(updateTime) == false { + if !last.Before(updateTime) { continue } @@ -202,7 +202,7 @@ func getArticles(feedURL string, max int, noExcerpt bool, filter []string) (stri // Only send title and link if option noExcerpt is set, // otherwise add the description. - if noExcerpt == true { + if noExcerpt { output = output + feed.Title + ": *" + article.Title + "*\n" + cleanURL } else { @@ -239,11 +239,11 @@ func getArticles(feedURL string, max int, noExcerpt bool, filter []string) (stri // Remove lines starting with one of the defined filters. filterStrike := false for _, filterString := range filter { - if strings.HasPrefix(line, filterString) == true { + if strings.HasPrefix(line, filterString) { filterStrike = true } } - if filterStrike == false { + if !filterStrike { description = description + line // Add new line, except for the last line. if i < descriptionLength-1 { @@ -267,7 +267,7 @@ func getArticles(feedURL string, max int, noExcerpt bool, filter []string) (stri //} // Only append article link if it is not yet contained in description (e.g. read more: URL). - if strings.Contains(description, article.Link) == true { + if strings.Contains(description, article.Link) { // Replace article link with URL cleaned from redirects and trackers. description = strings.Replace(description, article.Link, cleanURL, -1) output = output + feed.Title + ": *" + article.Title + "*\n\n" + description