mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-09 16:50:30 +00:00
Add support for anonymous connection (xmpp) (#1548)
This commit is contained in:
parent
9efcc41ab2
commit
1f365c716e
@ -169,11 +169,21 @@ func (b *Bxmpp) postSlackCompatibleWebhook(msg config.Message) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *Bxmpp) createXMPP() error {
|
func (b *Bxmpp) createXMPP() error {
|
||||||
if !strings.Contains(b.GetString("Jid"), "@") {
|
var serverName string
|
||||||
return fmt.Errorf("the Jid %s doesn't contain an @", b.GetString("Jid"))
|
switch {
|
||||||
|
case !b.GetBool("Anonymous"):
|
||||||
|
if !strings.Contains(b.GetString("Jid"), "@") {
|
||||||
|
return fmt.Errorf("the Jid %s doesn't contain an @", b.GetString("Jid"))
|
||||||
|
}
|
||||||
|
serverName = strings.Split(b.GetString("Jid"), "@")[1]
|
||||||
|
case !strings.Contains(b.GetString("Server"), ":"):
|
||||||
|
serverName = strings.Split(b.GetString("Server"), ":")[0]
|
||||||
|
default:
|
||||||
|
serverName = b.GetString("Server")
|
||||||
}
|
}
|
||||||
|
|
||||||
tc := &tls.Config{
|
tc := &tls.Config{
|
||||||
ServerName: strings.Split(b.GetString("Jid"), "@")[1],
|
ServerName: serverName,
|
||||||
InsecureSkipVerify: b.GetBool("SkipTLSVerify"), // nolint: gosec
|
InsecureSkipVerify: b.GetBool("SkipTLSVerify"), // nolint: gosec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,12 +223,16 @@ UseRelayMsg=false
|
|||||||
#REQUIRED
|
#REQUIRED
|
||||||
Server="jabber.example.com:5222"
|
Server="jabber.example.com:5222"
|
||||||
|
|
||||||
|
#Use anonymous MUC login
|
||||||
|
#OPTIONAL (default false)
|
||||||
|
Anonymous=false
|
||||||
|
|
||||||
#Jid
|
#Jid
|
||||||
#REQUIRED
|
#REQUIRED if Anonymous=false
|
||||||
Jid="user@example.com"
|
Jid="user@example.com"
|
||||||
|
|
||||||
#Password
|
#Password
|
||||||
#REQUIRED
|
#REQUIRED if Anonymous=false
|
||||||
Password="yourpass"
|
Password="yourpass"
|
||||||
|
|
||||||
#MUC
|
#MUC
|
||||||
|
Loading…
Reference in New Issue
Block a user