mirror of
https://salsa.debian.org/mdosch/feed-to-muc.git
synced 2024-11-22 22:18:39 +01:00
[golangci-lint] Simplified comparisons to bool constant.
This commit is contained in:
parent
ba3e4a7f67
commit
15900057ad
2 changed files with 6 additions and 6 deletions
|
@ -24,7 +24,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.
|
// Check for room mention of the bots nick if the the message type is groupchat.
|
||||||
if v.Type == "groupchat" {
|
if v.Type == "groupchat" {
|
||||||
// Leave if option quiet is set.
|
// Leave if option quiet is set.
|
||||||
if quiet == true {
|
if quiet {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// Get first word of the message and transform it to lower case.
|
// Get first word of the message and transform it to lower case.
|
||||||
|
@ -178,7 +178,7 @@ func processStanzas(client *xmpp.Client, muc string, mucNick string, feeds []str
|
||||||
if v.Type == "get" {
|
if v.Type == "get" {
|
||||||
// Reply to disco#info requests according to https://xmpp.org/extensions/xep-0030.html.
|
// Reply to disco#info requests according to https://xmpp.org/extensions/xep-0030.html.
|
||||||
if strings.Contains(string(v.Query),
|
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,
|
_, err := client.RawInformation(client.JID(), v.From, v.ID,
|
||||||
"result", "<query xmlns='http://jabber.org/protocol/disco#info'>"+
|
"result", "<query xmlns='http://jabber.org/protocol/disco#info'>"+
|
||||||
"<identity category='client' type='bot' name='feedbot'/>"+
|
"<identity category='client' type='bot' name='feedbot'/>"+
|
||||||
|
@ -186,7 +186,7 @@ func processStanzas(client *xmpp.Client, muc string, mucNick string, feeds []str
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error: Failed to reply to disco#info:", err)
|
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.
|
// Reply to pings.
|
||||||
_, err := client.RawInformation(client.JID(), v.From, v.ID, "result", "")
|
_, err := client.RawInformation(client.JID(), v.From, v.ID, "result", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -28,15 +28,15 @@ func pingMUC(client *xmpp.Client, botJid string, muc string, mucNick string) {
|
||||||
pingReceived = false
|
pingReceived = false
|
||||||
|
|
||||||
// Check for result IQ as long as there was no reply yet.
|
// 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)
|
time.Sleep(1 * time.Second)
|
||||||
if pingReceived == true {
|
if pingReceived {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Quit if no ping reply was received.
|
// Quit if no ping reply was received.
|
||||||
if pingReceived == false {
|
if !pingReceived {
|
||||||
log.Fatal("MUC not available. pingMUC")
|
log.Fatal("MUC not available. pingMUC")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue