1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00
This commit is contained in:
Mrs4s 2020-08-19 12:15:45 +08:00
parent 14f42ec0df
commit 3561e5f156
2 changed files with 8 additions and 1 deletions

View File

@ -63,6 +63,7 @@ type QQClient struct {
lastMessageSeq int32
//lastMessageSeqTmp sync.Map
msgSvcCache *utils.Cache
lastLostMsg string
groupMsgBuilders sync.Map
onlinePushCache []int16 // reset on reconnect
@ -142,7 +143,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),
msgSvcCache: utils.NewCache(time.Second * 5),
}
rand.Read(cli.RandomKey)
return cli

View File

@ -6,6 +6,7 @@ import (
"fmt"
"github.com/Mrs4s/MiraiGo/client/pb/pttcenter"
"log"
"strconv"
"sync"
"sync/atomic"
"time"
@ -167,6 +168,11 @@ func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{},
if (int64(pairMsg.LastReadTime) & 4294967295) > int64(message.Head.MsgTime) {
continue
}
strKey := strconv.FormatInt(message.Head.MsgUid, 10)
if _, ok := c.msgSvcCache.Get(strKey); ok {
continue
}
c.msgSvcCache.Add(strKey, "", time.Second*15)
switch message.Head.MsgType {
case 33: // 加群同步
groupJoinLock.Lock()