mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
fix online push.
This commit is contained in:
parent
16b1d91e24
commit
d0639731db
@ -76,7 +76,7 @@ type QQClient struct {
|
||||
transCache *utils.Cache
|
||||
lastLostMsg string
|
||||
groupMsgBuilders sync.Map
|
||||
onlinePushCache []int16 // reset on reconnect
|
||||
onlinePushCache *utils.Cache
|
||||
requestPacketRequestId int32
|
||||
groupSeq int32
|
||||
friendSeq int32
|
||||
@ -170,6 +170,7 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
|
||||
eventHandlers: &eventHandlers{},
|
||||
msgSvcCache: utils.NewCache(time.Second * 15),
|
||||
transCache: utils.NewCache(time.Second * 15),
|
||||
onlinePushCache: utils.NewCache(time.Second * 15),
|
||||
version: genVersionInfo(SystemDeviceInfo.Protocol),
|
||||
servers: []*net.TCPAddr{ // default servers
|
||||
{IP: net.IP{42, 81, 169, 46}, Port: 8080},
|
||||
@ -946,7 +947,6 @@ func (c *QQClient) connect() error {
|
||||
c.retryTimes = 0
|
||||
c.ConnectTime = time.Now()
|
||||
c.Conn = conn
|
||||
c.onlinePushCache = []int16{}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -693,19 +693,12 @@ func decodeOnlinePushReqPacket(c *QQClient, seq uint16, payload []byte) (interfa
|
||||
uin := jr.ReadInt64(0)
|
||||
jr.ReadSlice(&msgInfos, 2)
|
||||
_ = c.send(c.buildDeleteOnlinePushPacket(uin, seq, msgInfos))
|
||||
seqExists := func(ms int16) bool {
|
||||
for _, s := range c.onlinePushCache {
|
||||
if ms == s {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
for _, m := range msgInfos {
|
||||
if seqExists(m.MsgSeq) {
|
||||
k := fmt.Sprintf("%v%v%v", m.MsgSeq, m.MsgTime, m.MsgUid)
|
||||
if _, ok := c.onlinePushCache.Get(k); ok {
|
||||
continue
|
||||
}
|
||||
c.onlinePushCache = append(c.onlinePushCache, m.MsgSeq)
|
||||
c.onlinePushCache.Add(k, "", time.Second*30)
|
||||
if m.MsgType == 732 {
|
||||
r := binary.NewReader(m.VMsg)
|
||||
groupId := int64(uint32(r.ReadInt32()))
|
||||
|
Loading…
x
Reference in New Issue
Block a user