5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-09 23:40:27 +00:00

Add channel password support for XMPP (#451)

This commit is contained in:
Bruno Bierbaumer 2018-06-18 22:55:45 +02:00 committed by Wim
parent ec0e6bc3f8
commit 6628a47f23
3 changed files with 13 additions and 8 deletions

View File

@ -126,7 +126,7 @@ type Protocol struct {
} }
type ChannelOptions struct { type ChannelOptions struct {
Key string // irc Key string // irc, xmpp
WebhookURL string // discord WebhookURL string // discord
} }

View File

@ -65,7 +65,12 @@ func (b *Bxmpp) Disconnect() error {
} }
func (b *Bxmpp) JoinChannel(channel config.ChannelInfo) 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 return nil
} }

View File

@ -1392,9 +1392,9 @@ enable=true
#REQUIRED #REQUIRED
channel="#testing" 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] [gateway.in.options]
#OPTIONAL - your irc channel key #OPTIONAL - your irc / xmpp channel key
key="yourkey" key="yourkey"
@ -1403,9 +1403,9 @@ enable=true
account="irc.freenode" account="irc.freenode"
channel="#testing" 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] [gateway.out.options]
#OPTIONAL - your irc channel key #OPTIONAL - your irc / xmpp channel key
key="yourkey" key="yourkey"
#[[gateway.inout]] can be used when then channel will be used to receive from #[[gateway.inout]] can be used when then channel will be used to receive from
@ -1414,9 +1414,9 @@ enable=true
account="mattermost.work" account="mattermost.work"
channel="off-topic" 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] [gateway.inout.options]
#OPTIONAL - your irc channel key #OPTIONAL - your irc / xmpp channel key
key="yourkey" key="yourkey"
[[gateway.inout]] [[gateway.inout]]