diff options
author | Wim <wim@42.be> | 2018-12-15 23:11:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-15 23:11:03 +0100 |
commit | 53c86702a35b3f9d12993d613d17b74ebb99258d (patch) | |
tree | 8bfdc2e115ed1f99096733f70186edd418a2e9dd /bridge/slack/handlers.go | |
parent | 192fe89789cb8d35b0be990b7fb9eb4ae2be9d60 (diff) | |
download | matterbridge-msglm-53c86702a35b3f9d12993d613d17b74ebb99258d.tar.gz matterbridge-msglm-53c86702a35b3f9d12993d613d17b74ebb99258d.tar.bz2 matterbridge-msglm-53c86702a35b3f9d12993d613d17b74ebb99258d.zip |
Add wait option for populateUsers/Channels (slack) Fixes #579 (#653)
When setting wait to true, we wait until the populating isn't in progress anymore.
This is used on startup connections where we really need the initial information
which could take a long time on big servers.
Diffstat (limited to 'bridge/slack/handlers.go')
-rw-r--r-- | bridge/slack/handlers.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bridge/slack/handlers.go b/bridge/slack/handlers.go index b9011c92..40a9666a 100644 --- a/bridge/slack/handlers.go +++ b/bridge/slack/handlers.go @@ -75,7 +75,7 @@ func (b *Bslack) handleSlackClient(messages chan *config.Message) { // When we join a channel we update the full list of users as // well as the information for the channel that we joined as this // should now tell that we are a member of it. - b.populateUsers() + b.populateUsers(false) b.channelsMutex.Lock() b.channelsByID[ev.Channel.ID] = &ev.Channel @@ -83,8 +83,8 @@ func (b *Bslack) handleSlackClient(messages chan *config.Message) { b.channelsMutex.Unlock() case *slack.ConnectedEvent: b.si = ev.Info - b.populateChannels() - b.populateUsers() + b.populateChannels(true) + b.populateUsers(true) case *slack.InvalidAuthEvent: b.Log.Fatalf("Invalid Token %#v", ev) case *slack.ConnectionErrorEvent: @@ -200,7 +200,7 @@ func (b *Bslack) handleMessageEvent(ev *slack.MessageEvent) (*config.Message, er func (b *Bslack) handleStatusEvent(ev *slack.MessageEvent, rmsg *config.Message) bool { switch ev.SubType { case sChannelJoined, sMemberJoined: - b.populateUsers() + b.populateUsers(false) // There's no further processing needed on channel events // so we return 'true'. return true @@ -208,7 +208,7 @@ func (b *Bslack) handleStatusEvent(ev *slack.MessageEvent, rmsg *config.Message) rmsg.Username = sSystemUser rmsg.Event = config.EventJoinLeave case sChannelTopic, sChannelPurpose: - b.populateChannels() + b.populateChannels(false) rmsg.Event = config.EventTopicChange case sMessageChanged: rmsg.Text = ev.SubMessage.Text |