Thumbnail

rani/matterbridge.git

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

commit 77a8f856a86e8165bdb399075ccfb59ea3a19faa Author: Wim <wim@42.be> Date: Sun Feb 06 17:33:41 2022 +0000 Add UseUsername option (mattermost). Fixes #1665 (#1714) diff --git a/bridge/config/config.go b/bridge/config/config.go index 16b397f..18c6092 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -1707 +1707 @@ 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 5ad4011..00c9445 100644 --- a/bridge/mattermost/handlers.go +++ b/bridge/mattermost/handlers.go @@ -1778 +17710 @@ 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 @@ -2328 +23410 @@ 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 diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index 8bc0f6c..63a614d 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -4086 +40810 @@ 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)