create empty client, add function of collecting user unread messages on channels

This commit is contained in:
2026-05-09 21:40:59 +02:00
parent 53652d1f79
commit 6e3e27e63d
3367 changed files with 3200 additions and 1128383 deletions
+24 -13
View File
@@ -27,19 +27,30 @@ func RandomRgba() Rgba {
}
type User struct {
Mu sync.RWMutex `json:"-"`
Name string `json:"name"`
Pronouns string `json:"pronouns"`
Description string `json:"description"`
AvatarKey string `json:"avatarType"`
ProfileBgKey string `json:"profileBackgroundType"`
PasswordHash string `json:"-"`
CreatedAt time.Time `json:"createdAt"`
WsConn *websocket.Conn `json:"-"`
Id uuid.UUID `json:"-"`
Connections map[uuid.UUID]*Connection `json:"-"`
Hubs map[uuid.UUID]*Hub `json:"hubs-to-delete"`
Color Rgba `json:"color"`
Mu sync.RWMutex `json:"-"`
Name string `json:"name"`
Pronouns string `json:"pronouns"`
Description string `json:"description"`
AvatarKey string `json:"avatarType"`
ProfileBgKey string `json:"profileBackgroundType"`
PasswordHash string `json:"-"`
CreatedAt time.Time `json:"createdAt"`
WsConn *websocket.Conn `json:"-"`
Id uuid.UUID `json:"-"`
Connections map[uuid.UUID]*Connection `json:"-"`
Hubs map[uuid.UUID]*Hub `json:"hubs-to-delete"`
ChannelUnreadMessage map[uuid.UUID]uint8 `json:"-"`
Color Rgba `json:"color"`
}
func (u *User) IncrementUnreadMessagesWithCap(channel uuid.UUID) {
u.Mu.Lock()
defer u.Mu.Unlock()
if u.ChannelUnreadMessage[channel] == uint8(math.MaxUint8) {
return
}
u.ChannelUnreadMessage[channel]++
}
type UserProfileUpdate struct {