Skip to content

Commit

Permalink
Add JoinDelay option (irc). Fixes #1084
Browse files Browse the repository at this point in the history
  • Loading branch information
42wim committed Apr 18, 2020
1 parent 8e6ddad commit e1b3fc1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"log"
"strings"
"sync"
"time"

"github.com/42wim/matterbridge/bridge/config"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -74,6 +75,7 @@ func (b *Bridge) joinChannels(channels map[string]config.ChannelInfo, exists map
for ID, channel := range channels {
if !exists[ID] {
b.Log.Infof("%s: joining %s (ID: %s)", b.Account, channel.Name, ID)
time.Sleep(time.Duration(b.GetInt("JoinDelay")) * time.Millisecond)
err := b.JoinChannel(channel)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions bridge/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ type Protocol struct {
IgnoreNicks string // all protocols
IgnoreMessages string // all protocols
Jid string // xmpp
JoinDelay string // all protocols
Label string // all protocols
Login string // mattermost, matrix
MediaDownloadBlackList []string
Expand Down
6 changes: 6 additions & 0 deletions matterbridge.toml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ StripNick=false
#OPTIONAL (default false)
ShowTopicChange=false

#Delay in milliseconds between channel joins
#Only useful when you have a LOT of channels to join
#See https://github.com/42wim/matterbridge/issues/1084
#OPTIONAL (default 0)
JoinDelay=0

###################################################################
#XMPP section
###################################################################
Expand Down

0 comments on commit e1b3fc1

Please sign in to comment.