summaryrefslogtreecommitdiffstats
path: root/gateway
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-10-27 00:07:33 +0200
committerWim <wim@42.be>2017-10-27 00:07:33 +0200
commit41aa8ad7994075a72aebb2ce14d62a00bef022d7 (patch)
tree9984aab0ae3b9661586f1ffbd28d78dee7b405ac /gateway
parent7973baedd0ced9b57492e0b532b34dfff1329da1 (diff)
downloadmatterbridge-msglm-41aa8ad7994075a72aebb2ce14d62a00bef022d7.tar.gz
matterbridge-msglm-41aa8ad7994075a72aebb2ce14d62a00bef022d7.tar.bz2
matterbridge-msglm-41aa8ad7994075a72aebb2ce14d62a00bef022d7.zip
Add StripNick option, only allow alphanumerical nicks. Closes #285
Diffstat (limited to 'gateway')
-rw-r--r--gateway/gateway.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go
index 06eec560..cdd8247e 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -243,6 +243,10 @@ func (gw *Gateway) ignoreMessage(msg *config.Message) bool {
func (gw *Gateway) modifyUsername(msg config.Message, dest *bridge.Bridge) string {
br := gw.Bridges[msg.Account]
msg.Protocol = br.Protocol
+ if gw.Config.General.StripNick || dest.Config.StripNick {
+ re := regexp.MustCompile("[^a-zA-Z0-9]+")
+ msg.Username = re.ReplaceAllString(msg.Username, "")
+ }
nick := dest.Config.RemoteNickFormat
if nick == "" {
nick = gw.Config.General.RemoteNickFormat