4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-02 11:36:18 +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

@ -30,6 +30,23 @@ func (r *Router) handleEventFailure(msg *config.Message) {
}
}
// handleEventGetChannelMembers handles channel members
func (r *Router) handleEventGetChannelMembers(msg *config.Message) {
if msg.Event != config.EventGetChannelMembers {
return
}
for _, gw := range r.Gateways {
for _, br := range gw.Bridges {
if msg.Account == br.Account {
cMembers := msg.Extra[config.EventGetChannelMembers][0].(config.ChannelMembers)
flog.Debugf("Syncing channelmembers from %s", msg.Account)
br.SetChannelMembers(&cMembers)
return
}
}
}
}
// handleEventRejoinChannels handles rejoining of channels.
func (r *Router) handleEventRejoinChannels(msg *config.Message) {
if msg.Event != config.EventRejoinChannels {