Run gofumpt, remove unneeded 'else'

This commit is contained in:
Kufat 2022-08-08 18:07:17 -04:00
parent b82b7b67a8
commit 5c82f187bc
2 changed files with 26 additions and 21 deletions

View File

@ -96,11 +96,13 @@ func (b *Birc) handleJoinPart(client *girc.Client, event girc.Event) {
time.Sleep(time.Duration(b.GetInt("RejoinDelay")) * time.Second)
b.Remote <- config.Message{Username: "system", Text: "rejoin", Channel: channel, Account: b.Account, Event: config.EventRejoinChannels}
} else {
msg := config.Message{Username: "system",
msg := config.Message{
Username: "system",
Text: event.Source.Name + " kicked " + event.Params[1] + " with message: " + event.Last(),
Channel: channel,
Account: b.Account,
Event: config.EventJoinLeave}
Event: config.EventJoinLeave,
}
b.Log.Debugf("<= Message is %#v", msg)
b.Remote <- msg
}
@ -150,11 +152,13 @@ func (b *Birc) handleNick(client *girc.Client, event girc.Event) {
b.Log.Debugf("handleJoinPart: malformed nick change? %#v", event)
return
} else if isActive, activeTime := b.isUserActive(event.Source.Name); isActive {
msg := config.Message{Username: "system",
msg := config.Message{
Username: "system",
Text: event.Source.Name + " changed nick to " + event.Params[0],
Channel: b.getPseudoChannel(),
Account: b.Account,
Event: config.EventJoinLeave}
Event: config.EventJoinLeave,
}
b.Log.Debugf("<= Message is %#v", msg)
b.Remote <- msg
if b.ActivityTimeout != 0 {
@ -276,6 +280,7 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) {
b.Remote <- rmsg
b.cleanActiveMap()
}
func (b *Birc) handleQuit(client *girc.Client, event girc.Event) {
if event.Source.Name == b.Nick && strings.Contains(event.Last(), "Ping timeout") {
b.Log.Infof("%s reconnecting ..", b.Account)
@ -298,6 +303,7 @@ func (b *Birc) handleQuit(client *girc.Client, event girc.Event) {
return
}
}
func (b *Birc) handleRunCommands() {
for _, cmd := range b.GetStringSlice("RunCommands") {
if err := b.i.Cmd.SendRaw(cmd); err != nil {

View File

@ -438,7 +438,7 @@ func (b *Birc) isUserActive(nick string) (bool, int64) {
b.Log.Debugf("checking activity for %s", nick)
if b.ActivityTimeout == 0 {
return true, 0
} else {
}
b.activeUsersMutex.RLock()
defer b.activeUsersMutex.RUnlock()
if activeTime, ok := b.activeUsers[nick]; ok {
@ -450,7 +450,6 @@ func (b *Birc) isUserActive(nick string) (bool, int64) {
}
return (now - activeTime) < b.ActivityTimeout, activeTime
}
}
return false, 0
}