mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-12-24 18:25:40 +00:00
Fix utf-8 issues #193
This commit is contained in:
parent
9e34162a09
commit
8a55c97b4e
@ -235,7 +235,16 @@ func (gw *Gateway) modifyUsername(msg *config.Message, dest *bridge.Bridge) {
|
||||
nick = dest.Config.RemoteNickFormat
|
||||
}
|
||||
if len(msg.Username) > 0 {
|
||||
nick = strings.Replace(nick, "{NOPINGNICK}", msg.Username[:1]+""+msg.Username[1:], -1)
|
||||
// fix utf-8 issue #193
|
||||
i := 0
|
||||
for index := range msg.Username {
|
||||
if i == 1 {
|
||||
i = index
|
||||
break
|
||||
}
|
||||
i++
|
||||
}
|
||||
nick = strings.Replace(nick, "{NOPINGNICK}", msg.Username[:i]+""+msg.Username[i:], -1)
|
||||
}
|
||||
nick = strings.Replace(nick, "{NICK}", msg.Username, -1)
|
||||
nick = strings.Replace(nick, "{BRIDGE}", br.Name, -1)
|
||||
|
Loading…
Reference in New Issue
Block a user