summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-02-06 17:33:41 +0100
committerGitHub <noreply@github.com>2022-02-06 17:33:41 +0100
commitc8d7fdeedcc2fe596055da000bfa8c23c4ba5cab (patch)
treec708b8459745f2c7903f7fa439108fb5cfd66be7 /bridge
parentc211152e236878b72d1a711ba0c6bef5dca07fb2 (diff)
downloadmatterbridge-msglm-c8d7fdeedcc2fe596055da000bfa8c23c4ba5cab.tar.gz
matterbridge-msglm-c8d7fdeedcc2fe596055da000bfa8c23c4ba5cab.tar.bz2
matterbridge-msglm-c8d7fdeedcc2fe596055da000bfa8c23c4ba5cab.zip
Add UseUsername option (mattermost). Fixes #1665 (#1714)
Diffstat (limited to 'bridge')
-rw-r--r--bridge/config/config.go2
-rw-r--r--bridge/mattermost/handlers.go12
2 files changed, 9 insertions, 5 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 16b397f3..18c60920 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -170,7 +170,7 @@ type Protocol struct {
UseTLS bool // IRC
UseDiscriminator bool // discord
UseFirstName bool // telegram
- UseUserName bool // discord, matrix
+ UseUserName bool // discord, matrix, mattermost
UseInsecureURL bool // telegram
UserName string // IRC
VerboseJoinPart bool // IRC
diff --git a/bridge/mattermost/handlers.go b/bridge/mattermost/handlers.go
index 5ad40115..00c9445d 100644
--- a/bridge/mattermost/handlers.go
+++ b/bridge/mattermost/handlers.go
@@ -177,8 +177,10 @@ func (b *Bmattermost) handleMatterClient(messages chan *config.Message) {
}
// Use nickname instead of username if defined
- if nick := b.mc.GetNickName(rmsg.UserID); nick != "" {
- rmsg.Username = nick
+ if !b.GetBool("useusername") {
+ if nick := b.mc.GetNickName(rmsg.UserID); nick != "" {
+ rmsg.Username = nick
+ }
}
messages <- rmsg
@@ -232,8 +234,10 @@ func (b *Bmattermost) handleMatterClient6(messages chan *config.Message) {
}
// Use nickname instead of username if defined
- if nick := b.mc6.GetNickName(rmsg.UserID); nick != "" {
- rmsg.Username = nick
+ if !b.GetBool("useusername") {
+ if nick := b.mc6.GetNickName(rmsg.UserID); nick != "" {
+ rmsg.Username = nick
+ }
}
messages <- rmsg