summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Bierbaumer <bruno+github@bierbaumer.net>2018-06-18 22:55:45 +0200
committerWim <wim@42.be>2018-06-18 22:55:45 +0200
commit6628a47f236f2d3d2c50023c2ed6552e650afcd6 (patch)
tree40eba1b4c2fb42a36c2c349ca86d70a760794b46
parentec0e6bc3f8a032631f5374e35b1faa486c5b6405 (diff)
downloadmatterbridge-msglm-6628a47f236f2d3d2c50023c2ed6552e650afcd6.tar.gz
matterbridge-msglm-6628a47f236f2d3d2c50023c2ed6552e650afcd6.tar.bz2
matterbridge-msglm-6628a47f236f2d3d2c50023c2ed6552e650afcd6.zip
Add channel password support for XMPP (#451)
-rw-r--r--bridge/config/config.go2
-rw-r--r--bridge/xmpp/xmpp.go7
-rw-r--r--matterbridge.toml.sample12
3 files changed, 13 insertions, 8 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 0fa76b52..30368f66 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -126,7 +126,7 @@ 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 0e2d951c..4ace2abd 100644
--- a/bridge/xmpp/xmpp.go
+++ b/bridge/xmpp/xmpp.go
@@ -65,7 +65,12 @@ 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 2a77bca1..1f942e50 100644
--- a/matterbridge.toml.sample
+++ b/matterbridge.toml.sample
@@ -1392,9 +1392,9 @@ 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"
@@ -1403,9 +1403,9 @@ 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
@@ -1414,9 +1414,9 @@ 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]]