Skip to content

Commit

Permalink
Add UseUsername option (mattermost). Fixes 42wim#1665 (42wim#1714)
Browse files Browse the repository at this point in the history
  • Loading branch information
42wim authored Feb 6, 2022
1 parent c211152 commit c8d7fde
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bridge/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions bridge/mattermost/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions matterbridge.toml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ SkipTLSVerify=true
## RELOADABLE SETTINGS
## Settings below can be reloaded by editing the file

# UseUserName shows the username instead of the server nickname
# OPTIONAL (default false)
UseUserName=false

#how to format the list of IRC nicks when displayed in mattermost.
#Possible options are "table" and "plain"
#OPTIONAL (default plain)
Expand Down

0 comments on commit c8d7fde

Please sign in to comment.