Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 7bd666ae62323f58b929ebd61493fc6238e4a25f Author: Duco van Amstel <duco.vanamstel@gmail.com> Date: Sun Oct 07 14:22:15 2018 +0000 Add Gateway's name to RemoteNickFormat (#501) In order to support extra use cases we should add the `{GATEWAY}` tag to the `RemoteNickFormat` string which would be replaced by the value of the `name=` field from a gateway's configuration. This is _very_ useful when you are forwarding, for example, multiple channels from one chat to a single channel on another one (one-way). It will help you identify the source channel of a message on the target chat. diff --git a/gateway/gateway.go b/gateway/gateway.go index 6529393..a33a9a9 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -3746 +3747 @@ func (gw *Gateway) modifyUsername(msg config.Message, dest *bridge.Bridge) strin     nick = strings.Replace(nick, "{BRIDGE}", br.Name, -1)   nick = strings.Replace(nick, "{PROTOCOL}", br.Protocol, -1) + nick = strings.Replace(nick, "{GATEWAY}", gw.Name, -1)   nick = strings.Replace(nick, "{LABEL}", br.GetString("Label"), -1)   nick = strings.Replace(nick, "{NICK}", msg.Username, -1)   return nick diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index b86fbe3..fbe331e 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -3447 +3447 @@ func (m *MMClient) parseActionPost(rmsg *Message) {   data := model.PostFromJson(strings.NewReader(rmsg.Raw.Data["post"].(string)))   // we don't have the user, refresh the userlist   if m.GetUser(data.UserId) == nil { - m.log.Infof("User %s is not known, ignoring message %s", data) + m.log.Infof("User %s is not known, ignoring message %s", data.UserId, data.Message)   return   }   rmsg.Username = m.GetUserName(data.UserId)