diff options
Diffstat (limited to 'bridge/nctalk')
-rw-r--r-- | bridge/nctalk/nctalk.go | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/bridge/nctalk/nctalk.go b/bridge/nctalk/nctalk.go index 94bb1a08..23b59135 100644 --- a/bridge/nctalk/nctalk.go +++ b/bridge/nctalk/nctalk.go @@ -70,6 +70,13 @@ func (b *Btalk) JoinChannel(channel config.ChannelInfo) error { return err } b.rooms = append(b.rooms, newRoom) + + // Config + guestSuffix := " (Guest)" + if b.IsKeySet("GuestSuffix") { + guestSuffix = b.GetString("GuestSuffix") + } + go func() { for msg := range c { // ignore messages that are one of the following @@ -81,7 +88,7 @@ func (b *Btalk) JoinChannel(channel config.ChannelInfo) error { remoteMessage := config.Message{ Text: formatRichObjectString(msg.Message, msg.MessageParameters), Channel: newRoom.room.Token, - Username: msg.ActorDisplayName, + Username: DisplayName(msg, guestSuffix), UserID: msg.ActorID, Account: b.Account, } @@ -144,3 +151,15 @@ func formatRichObjectString(message string, parameters map[string]ocs.RichObject return message } + +func DisplayName(msg ocs.TalkRoomMessageData, suffix string) string { + if msg.ActorType == ocs.ActorGuest { + if msg.ActorDisplayName == "" { + return "Guest" + } + + return msg.ActorDisplayName + suffix + } + + return msg.ActorDisplayName +} |