Merge b502420de8
into c4157a4d5b
This commit is contained in:
commit
4ede82486c
@ -170,7 +170,9 @@ type Protocol struct {
|
|||||||
UseSASL bool // IRC
|
UseSASL bool // IRC
|
||||||
UseTLS bool // IRC
|
UseTLS bool // IRC
|
||||||
UseDiscriminator bool // discord
|
UseDiscriminator bool // discord
|
||||||
UseFirstName bool // telegram
|
UseFullName bool // mattermost
|
||||||
|
UseFirstName bool // telegram, mattermost
|
||||||
|
UseLastName bool // mattermost
|
||||||
UseUserName bool // discord, matrix, mattermost
|
UseUserName bool // discord, matrix, mattermost
|
||||||
UseInsecureURL bool // telegram
|
UseInsecureURL bool // telegram
|
||||||
UserName string // IRC
|
UserName string // IRC
|
||||||
|
@ -144,10 +144,28 @@ func (b *Bmattermost) handleMatterClient(messages chan *config.Message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use nickname instead of username if defined
|
// Choose what to use as user nick Nickname/FullName/FirstName/LastName (or Username if neither is set)
|
||||||
if !b.GetBool("useusername") {
|
if b.GetBool("UseNickName") {
|
||||||
if nick := b.mc.GetNickName(rmsg.UserID); nick != "" {
|
if b.mc.GetNickName(rmsg.UserID) != "" {
|
||||||
rmsg.Username = nick
|
rmsg.Username = b.mc.GetNickName(rmsg.UserID)
|
||||||
|
}
|
||||||
|
} else if b.GetBool("UseFirstName") {
|
||||||
|
if b.mc.GetFirstName(rmsg.UserID) != "" {
|
||||||
|
rmsg.Username = b.mc.GetFirstName(rmsg.UserID)
|
||||||
|
}
|
||||||
|
} else if b.GetBool("UseLastName") {
|
||||||
|
if b.mc.GetLastName(rmsg.UserID) != "" {
|
||||||
|
rmsg.Username = b.mc.GetLastName(rmsg.UserID)
|
||||||
|
}
|
||||||
|
} else if b.GetBool("UseFullName") {
|
||||||
|
if b.mc.GetFirstName(rmsg.UserID) != "" && b.mc.GetLastName(rmsg.UserID) != "" {
|
||||||
|
rmsg.Username = b.mc.GetFirstName(rmsg.UserID) + " " + b.mc.GetLastName(rmsg.UserID)
|
||||||
|
} else if b.mc.GetFirstName(rmsg.UserID) != "" {
|
||||||
|
rmsg.Username = b.mc.GetFirstName(rmsg.UserID)
|
||||||
|
} else if b.mc.GetLastName(rmsg.UserID) != "" {
|
||||||
|
rmsg.Username = b.mc.GetLastName(rmsg.UserID)
|
||||||
|
} else {
|
||||||
|
rmsg.Username = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,9 +409,13 @@ SkipTLSVerify=true
|
|||||||
## RELOADABLE SETTINGS
|
## RELOADABLE SETTINGS
|
||||||
## Settings below can be reloaded by editing the file
|
## Settings below can be reloaded by editing the file
|
||||||
|
|
||||||
# UseUserName shows the username instead of the server nickname
|
# Choose what use as user nick NickName/FullName/FirstName/LastName/UserName
|
||||||
# OPTIONAL (default false)
|
# OPTIONAL (default false)
|
||||||
UseUserName=false
|
UseNickName=false
|
||||||
|
UseFullName=false
|
||||||
|
UseFirstName=false
|
||||||
|
UseLastName=false
|
||||||
|
#if neither is set as true will use username
|
||||||
|
|
||||||
#how to format the list of IRC nicks when displayed in mattermost.
|
#how to format the list of IRC nicks when displayed in mattermost.
|
||||||
#Possible options are "table" and "plain"
|
#Possible options are "table" and "plain"
|
||||||
|
16
vendor/github.com/matterbridge/matterclient/users.go
generated
vendored
16
vendor/github.com/matterbridge/matterclient/users.go
generated
vendored
@ -14,6 +14,22 @@ func (m *Client) GetNickName(userID string) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Client) GetFirstName(userID string) string {
|
||||||
|
if user := m.GetUser(userID); user != nil {
|
||||||
|
return user.FirstName
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Client) GetLastName(userID string) string {
|
||||||
|
if user := m.GetUser(userID); user != nil {
|
||||||
|
return user.LastName
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Client) GetStatus(userID string) string {
|
func (m *Client) GetStatus(userID string) string {
|
||||||
res, _, err := m.Client.GetUserStatus(context.TODO(), userID, "")
|
res, _, err := m.Client.GetUserStatus(context.TODO(), userID, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user