allow matrix to send localpart of username

This commit is contained in:
Matti R
2017-12-07 23:59:00 -05:00
parent d30ae19e2a
commit 74e1f983f0

View File

@@ -287,6 +287,12 @@ func (gw *Gateway) modifyUsername(msg config.Message, dest *bridge.Bridge) strin
nick = strings.Replace(nick, "{NICK}", msg.Username, -1)
nick = strings.Replace(nick, "{BRIDGE}", br.Name, -1)
nick = strings.Replace(nick, "{PROTOCOL}", br.Protocol, -1)
if br.Protocol == "matrix" {
nick_parts := strings.Split(msg.Username, ":")
nick = strings.Replace(nick, "{LOCALPART}", nick_parts[0], -1)
} else {
nick = strings.Replace(nick, "{LOCALPART}", msg.Username, -1)
}
return nick
}