From ba3563ad4e2d0d76eecd7a77246039fa1561613a Mon Sep 17 00:00:00 2001 From: Sarv Date: Thu, 10 Apr 2025 16:25:09 +0800 Subject: [PATCH] fix v4 chatroom display name (#26) --- internal/model/chatroom_v4.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/internal/model/chatroom_v4.go b/internal/model/chatroom_v4.go index 673ccec..e202f38 100644 --- a/internal/model/chatroom_v4.go +++ b/internal/model/chatroom_v4.go @@ -20,9 +20,17 @@ func (c *ChatRoomV4) Wrap() *ChatRoom { users = ParseRoomData(c.ExtBuffer) } + user2DisplayName := make(map[string]string, len(users)) + for _, user := range users { + if user.DisplayName != "" { + user2DisplayName[user.UserName] = user.DisplayName + } + } + return &ChatRoom{ - Name: c.UserName, - Owner: c.Owner, - Users: users, + Name: c.UserName, + Owner: c.Owner, + Users: users, + User2DisplayName: user2DisplayName, } }