5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 14:00:27 +00:00

Make unparam linter happy

This commit is contained in:
Wim 2018-11-08 00:29:30 +01:00
parent 0ededb8863
commit 1794922263
4 changed files with 8 additions and 11 deletions

View File

@ -32,7 +32,7 @@ func tableformatter(nicks []string, nicksPerRow int, continued bool) string {
} }
*/ */
func plainformatter(nicks []string, nicksPerRow int) string { func plainformatter(nicks []string) string {
return strings.Join(nicks, ", ") + " currently on IRC" return strings.Join(nicks, ", ") + " currently on IRC"
} }

View File

@ -271,14 +271,12 @@ func (b *Birc) endNames(client *girc.Client, event girc.Event) {
channel := event.Params[1] channel := event.Params[1]
sort.Strings(b.names[channel]) sort.Strings(b.names[channel])
maxNamesPerPost := (300 / b.nicksPerRow()) * b.nicksPerRow() maxNamesPerPost := (300 / b.nicksPerRow()) * b.nicksPerRow()
continued := false
for len(b.names[channel]) > maxNamesPerPost { for len(b.names[channel]) > maxNamesPerPost {
b.Remote <- config.Message{Username: b.Nick, Text: b.formatnicks(b.names[channel][0:maxNamesPerPost], continued), b.Remote <- config.Message{Username: b.Nick, Text: b.formatnicks(b.names[channel][0:maxNamesPerPost]),
Channel: channel, Account: b.Account} Channel: channel, Account: b.Account}
b.names[channel] = b.names[channel][maxNamesPerPost:] b.names[channel] = b.names[channel][maxNamesPerPost:]
continued = true
} }
b.Remote <- config.Message{Username: b.Nick, Text: b.formatnicks(b.names[channel], continued), b.Remote <- config.Message{Username: b.Nick, Text: b.formatnicks(b.names[channel]),
Channel: channel, Account: b.Account} Channel: channel, Account: b.Account}
b.names[channel] = nil b.names[channel] = nil
b.i.Handlers.Clear(girc.RPL_NAMREPLY) b.i.Handlers.Clear(girc.RPL_NAMREPLY)
@ -464,6 +462,6 @@ func (b *Birc) storeNames(client *girc.Client, event girc.Event) {
strings.Split(strings.TrimSpace(event.Trailing), " ")...) strings.Split(strings.TrimSpace(event.Trailing), " ")...)
} }
func (b *Birc) formatnicks(nicks []string, continued bool) string { func (b *Birc) formatnicks(nicks []string) string {
return plainformatter(nicks, b.nicksPerRow()) return plainformatter(nicks)
} }

View File

@ -129,7 +129,7 @@ func (b *Bmatrix) getRoomID(channel string) string {
return "" return ""
} }
func (b *Bmatrix) handlematrix() error { func (b *Bmatrix) handlematrix() {
syncer := b.mc.Syncer.(*matrix.DefaultSyncer) syncer := b.mc.Syncer.(*matrix.DefaultSyncer)
syncer.OnEventType("m.room.redaction", b.handleEvent) syncer.OnEventType("m.room.redaction", b.handleEvent)
syncer.OnEventType("m.room.message", b.handleEvent) syncer.OnEventType("m.room.message", b.handleEvent)
@ -140,7 +140,6 @@ func (b *Bmatrix) handlematrix() error {
} }
} }
}() }()
return nil
} }
func (b *Bmatrix) handleEvent(ev *matrix.Event) { func (b *Bmatrix) handleEvent(ev *matrix.Event) {

View File

@ -218,7 +218,7 @@ func (gw *Gateway) getDestChannel(msg *config.Message, dest bridge.Bridge) []con
} }
continue continue
} }
if strings.Contains(channel.Direction, "out") && channel.Account == dest.Account && gw.validGatewayDest(msg, channel) { if strings.Contains(channel.Direction, "out") && channel.Account == dest.Account && gw.validGatewayDest(msg) {
channels = append(channels, *channel) channels = append(channels, *channel)
} }
} }
@ -537,7 +537,7 @@ func (gw *Gateway) handleFiles(msg *config.Message) {
} }
} }
func (gw *Gateway) validGatewayDest(msg *config.Message, channel *config.ChannelInfo) bool { func (gw *Gateway) validGatewayDest(msg *config.Message) bool {
return msg.Gateway == gw.Name return msg.Gateway == gw.Name
} }