mirror of
https://salsa.debian.org/mdosch/feed-to-muc.git
synced 2024-11-10 00:06:49 +01:00
[golangci-lint] Simplified comparisons to bool constant.
This commit is contained in:
parent
c6b881a883
commit
d1fa786a2e
2 changed files with 11 additions and 11 deletions
|
@ -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),
|
||||
"<query xmlns='http://jabber.org/protocol/disco#info'/>") == true {
|
||||
"<query xmlns='http://jabber.org/protocol/disco#info'/>") {
|
||||
_, err := client.RawInformation(client.JID(), v.From, v.ID,
|
||||
"result", "<query xmlns='http://jabber.org/protocol/disco#info'>"+
|
||||
"<identity category='client' type='bot' name='feedbot'/>"+
|
||||
|
@ -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), "<ping xmlns='urn:xmpp:ping'/>") == true {
|
||||
} else if strings.Contains(string(v.Query), "<ping xmlns='urn:xmpp:ping'/>") {
|
||||
// Reply to pings.
|
||||
_, err := client.RawInformation(client.JID(), v.From, v.ID, "result", "")
|
||||
if err != nil {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue