27 lines
441 B
Go
27 lines
441 B
Go
package main
|
|
|
|
import (
|
|
"cs"
|
|
)
|
|
|
|
const ChatMsgMaxSize = 60
|
|
|
|
type ChatUserRec struct {
|
|
HasUnreadMsg bool
|
|
Dirty bool
|
|
Users map[string]*ChatMsgRec
|
|
}
|
|
|
|
type ChatMsgRec struct {
|
|
CurrID uint64
|
|
LastID uint64
|
|
ChatMsgList []*cs.MFChatMsg
|
|
}
|
|
|
|
func (c *ChatMsgRec) AddChatMsg(msg *cs.MFChatMsg) {
|
|
if len(c.ChatMsgList) >= ChatMsgMaxSize {
|
|
c.ChatMsgList = c.ChatMsgList[1:]
|
|
}
|
|
c.ChatMsgList = append(c.ChatMsgList, msg)
|
|
}
|