From 41aa8ad7994075a72aebb2ce14d62a00bef022d7 Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 27 Oct 2017 00:07:33 +0200 Subject: Add StripNick option, only allow alphanumerical nicks. Closes #285 --- gateway/gateway.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gateway') 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 -- cgit v1.2.3