4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-02 16:16:17 +00:00

Add initial support for getting ChannelMember info of all bridges (#678)

* Add initial support for getting ChannelMember info of all bridges.

Adds an EventGetChannelMembers event, which gets send every x time to
all bridges. Bridges should respond on this event with a Message
containing ChannelMembers in the EventGetChannelMembers key in the
Extra field.

handleEventGetChannelMembers will handle this Message and sets the
contained ChannelMembers to the Bridge struct.

* Add ChannelMembers support to the slack bridge
This commit is contained in:
Wim
2019-01-18 18:35:31 +01:00
committed by GitHub
parent d99eacc2e1
commit fb713ed91b
7 changed files with 189 additions and 21 deletions

View File

@ -37,6 +37,9 @@ type Bslack struct {
channelsByName map[string]*slack.Channel
channelsMutex sync.RWMutex
channelMembers map[string][]string
channelMembersMutex sync.RWMutex
refreshInProgress bool
earliestChannelRefresh time.Time
earliestUserRefresh time.Time
@ -267,6 +270,11 @@ func (b *Bslack) sendWebhook(msg config.Message) error {
}
func (b *Bslack) sendRTM(msg config.Message) (string, error) {
// Handle channelmember messages.
if handled := b.handleGetChannelMembers(&msg); handled {
return "", nil
}
channelInfo, err := b.getChannel(msg.Channel)
if err != nil {
return "", fmt.Errorf("could not send message: %v", err)