From 74e1f983f0383b58d946bd2a354f0ab71d540485 Mon Sep 17 00:00:00 2001 From: Matti R Date: Thu, 7 Dec 2017 23:59:00 -0500 Subject: [PATCH] allow matrix to send localpart of username --- gateway/gateway.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gateway/gateway.go b/gateway/gateway.go index 8b1223f0..076424d4 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -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 }