Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 4f767684f3f04c87e940a4cc6877de52afdb47f3 Author: Bruno Bierbaumer <bruno+github@bierbaumer.net> Date: Mon Jun 18 22:55:45 2018 +0000 Add channel password support for XMPP (#451) diff --git a/bridge/config/config.go b/bridge/config/config.go index 0fa76b5..30368f6 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -1267 +1267 @@ type Protocol struct {  }    type ChannelOptions struct { - Key string // irc + Key string // irc, xmpp   WebhookURL string // discord  }   diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go index 0e2d951..4ace2ab 100644 --- a/bridge/xmpp/xmpp.go +++ b/bridge/xmpp/xmpp.go @@ -657 +6512 @@ func (b *Bxmpp) Disconnect() error {  }    func (b *Bxmpp) JoinChannel(channel config.ChannelInfo) error { - b.xc.JoinMUCNoHistory(channel.Name+"@"+b.GetString("Muc"), b.GetString("Nick")) + if channel.Options.Key != "" { + b.Log.Debugf("using key %s for channel %s", channel.Options.Key, channel.Name) + b.xc.JoinProtectedMUC(channel.Name+"@"+b.GetString("Muc"), b.GetString("Nick"), channel.Options.Key, xmpp.NoHistory, 0, nil) + } else { + b.xc.JoinMUCNoHistory(channel.Name+"@"+b.GetString("Muc"), b.GetString("Nick")) + }   return nil  }   diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index 2a77bca..1f942e5 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -13929 +13929 @@ enable=true #REQUIRED channel="#testing"   - #OPTIONAL - only used for IRC protocol at the moment + #OPTIONAL - only used for IRC and XMPP protocols at the moment [gateway.in.options] - #OPTIONAL - your irc channel key + #OPTIONAL - your irc / xmpp channel key key="yourkey"     @@ -14039 +14039 @@ enable=true account="irc.freenode" channel="#testing"   - #OPTIONAL - only used for IRC protocol at the moment + #OPTIONAL - only used for IRC and XMPP protocols at the moment [gateway.out.options] - #OPTIONAL - your irc channel key + #OPTIONAL - your irc / xmpp channel key key="yourkey"   #[[gateway.inout]] can be used when then channel will be used to receive from @@ -14149 +14149 @@ enable=true account="mattermost.work" channel="off-topic"   - #OPTIONAL - only used for IRC protocol at the moment + #OPTIONAL - only used for IRC and XMPP protocols at the moment [gateway.inout.options] - #OPTIONAL - your irc channel key + #OPTIONAL - your irc / xmpp channel key key="yourkey"   [[gateway.inout]]