summaryrefslogtreecommitdiffstats
path: root/gateway/handlers.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-01-18 18:35:31 +0100
committerGitHub <noreply@github.com>2019-01-18 18:35:31 +0100
commitfb713ed91bfb48c0037e489f80be85c54e69953a (patch)
treee82901d1a604b02bbb5e3a2c4712f20e61d0513b /gateway/handlers.go
parentd99eacc2e1b0deadc7368b35adf0818493fd2fb9 (diff)
downloadmatterbridge-msglm-fb713ed91bfb48c0037e489f80be85c54e69953a.tar.gz
matterbridge-msglm-fb713ed91bfb48c0037e489f80be85c54e69953a.tar.bz2
matterbridge-msglm-fb713ed91bfb48c0037e489f80be85c54e69953a.zip
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
Diffstat (limited to 'gateway/handlers.go')
-rw-r--r--gateway/handlers.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/gateway/handlers.go b/gateway/handlers.go
index 741c312e..5af13c14 100644
--- a/gateway/handlers.go
+++ b/gateway/handlers.go
@@ -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 {