4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 07:29:24 +00:00

Add StripNick option, only allow alphanumerical nicks. Closes #285

This commit is contained in:
Wim
2017-10-27 00:07:33 +02:00
parent 7973baedd0
commit 41aa8ad799
3 changed files with 61 additions and 0 deletions

View File

@ -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