mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-25 04:02:03 -08:00
Fail if channel starts with hashtag (mattermost). Closes #625
This commit is contained in:
parent
04567c765e
commit
56749dfb20
@ -1,6 +1,7 @@
|
|||||||
package gateway
|
package gateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -138,6 +139,10 @@ func (gw *Gateway) mapChannelConfig(cfg []config.Bridge, direction string) {
|
|||||||
if strings.HasPrefix(br.Account, "irc.") {
|
if strings.HasPrefix(br.Account, "irc.") {
|
||||||
br.Channel = strings.ToLower(br.Channel)
|
br.Channel = strings.ToLower(br.Channel)
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(br.Account, "mattermost.") && strings.HasPrefix(br.Channel, "#") {
|
||||||
|
flog.Errorf("Mattermost channels do not start with a #: remove the # in %s", br.Channel)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
ID := br.Channel + br.Account
|
ID := br.Channel + br.Account
|
||||||
if _, ok := gw.Channels[ID]; !ok {
|
if _, ok := gw.Channels[ID]; !ok {
|
||||||
channel := &config.ChannelInfo{Name: br.Channel, Direction: direction, ID: ID, Options: br.Options, Account: br.Account,
|
channel := &config.ChannelInfo{Name: br.Channel, Direction: direction, ID: ID, Options: br.Options, Account: br.Account,
|
||||||
|
Loading…
Reference in New Issue
Block a user