diff --git a/bridge/nctalk/nctalk.go b/bridge/nctalk/nctalk.go index 23b59135cf..fb38b050fb 100644 --- a/bridge/nctalk/nctalk.go +++ b/bridge/nctalk/nctalk.go @@ -76,6 +76,7 @@ func (b *Btalk) JoinChannel(channel config.ChannelInfo) error { if b.IsKeySet("GuestSuffix") { guestSuffix = b.GetString("GuestSuffix") } + userIDAsNick := b.GetBool("UserIdAsNick") go func() { for msg := range c { @@ -88,7 +89,7 @@ func (b *Btalk) JoinChannel(channel config.ChannelInfo) error { remoteMessage := config.Message{ Text: formatRichObjectString(msg.Message, msg.MessageParameters), Channel: newRoom.room.Token, - Username: DisplayName(msg, guestSuffix), + Username: DisplayName(msg, guestSuffix, userIDAsNick), UserID: msg.ActorID, Account: b.Account, } @@ -152,7 +153,7 @@ func formatRichObjectString(message string, parameters map[string]ocs.RichObject return message } -func DisplayName(msg ocs.TalkRoomMessageData, suffix string) string { +func DisplayName(msg ocs.TalkRoomMessageData, suffix string, userIDAsName bool) string { if msg.ActorType == ocs.ActorGuest { if msg.ActorDisplayName == "" { return "Guest" @@ -160,6 +161,9 @@ func DisplayName(msg ocs.TalkRoomMessageData, suffix string) string { return msg.ActorDisplayName + suffix } - + // Use the user ID instead of the display name for non-guest users + if userIDAsName { + return msg.ActorID + } return msg.ActorDisplayName } diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index c82b33ceb2..a552feb431 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -1407,6 +1407,9 @@ Password = "talkuserpass" # Suffix for Guest Users GuestSuffix = " (Guest)" +# If true, use the User ID instead of Display Name for non-guest users (default false) +# WARNING: Before using this, verify that your user IDs are indeed human-readable and intended for display. +UserIdAsNick = false ################################################################### #