mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
This commit is contained in:
parent
2db3c6339d
commit
47d4fdde60
@ -60,10 +60,11 @@ type QQClient struct {
|
||||
pwdFlag bool
|
||||
|
||||
lastMessageSeq int32
|
||||
lastMessageSeqTmp sync.Map
|
||||
//lastMessageSeqTmp sync.Map
|
||||
lastLostMsg string
|
||||
groupMsgBuilders sync.Map
|
||||
onlinePushCache []int16 // reset on reconnect
|
||||
msgSvcCache *utils.Cache
|
||||
requestPacketRequestId int32
|
||||
groupSeq int32
|
||||
friendSeq int32
|
||||
@ -139,6 +140,7 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
|
||||
ksid: []byte("|454001228437590|A8.2.7.27f6ea96"),
|
||||
eventHandlers: &eventHandlers{},
|
||||
groupListLock: new(sync.Mutex),
|
||||
msgSvcCache: utils.NewCache(time.Second * 5),
|
||||
}
|
||||
rand.Read(cli.RandomKey)
|
||||
return cli
|
||||
|
@ -165,6 +165,13 @@ func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
if message.Head.ToUin != c.Uin {
|
||||
continue
|
||||
}
|
||||
if message.Head.MsgType != 166 {
|
||||
strSeq := strconv.FormatInt(int64(message.Head.MsgSeq), 10)
|
||||
if _, ok := c.msgSvcCache.Get(strSeq); ok {
|
||||
continue
|
||||
}
|
||||
c.msgSvcCache.Add(strSeq, 0, time.Minute*15)
|
||||
}
|
||||
switch message.Head.MsgType {
|
||||
case 33: // 加群同步
|
||||
groupJoinLock.Lock()
|
||||
@ -210,15 +217,7 @@ func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
if mem == nil || message.Head.FromUin == c.Uin {
|
||||
continue
|
||||
}
|
||||
lastSeq, ok := c.lastMessageSeqTmp.Load(mem.Uin)
|
||||
if !ok {
|
||||
c.lastMessageSeqTmp.Store(mem.Uin, int32(-1))
|
||||
lastSeq = int32(-1)
|
||||
}
|
||||
if message.Head.MsgSeq > lastSeq.(int32) {
|
||||
c.lastMessageSeqTmp.Store(mem.Uin, message.Head.MsgSeq)
|
||||
c.dispatchTempMessage(c.parseTempMessage(message))
|
||||
}
|
||||
case 166: // 好友消息
|
||||
if message.Head.FromUin == c.Uin {
|
||||
for {
|
||||
|
Loading…
x
Reference in New Issue
Block a user