mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
fix Mrs4s/go-cqhttp#121.
This commit is contained in:
parent
47d4fdde60
commit
60142c405d
@ -64,7 +64,6 @@ type QQClient struct {
|
||||
lastLostMsg string
|
||||
groupMsgBuilders sync.Map
|
||||
onlinePushCache []int16 // reset on reconnect
|
||||
msgSvcCache *utils.Cache
|
||||
requestPacketRequestId int32
|
||||
groupSeq int32
|
||||
friendSeq int32
|
||||
@ -73,6 +72,7 @@ type QQClient struct {
|
||||
eventHandlers *eventHandlers
|
||||
|
||||
groupListLock *sync.Mutex
|
||||
msgSvcLock sync.Mutex
|
||||
}
|
||||
|
||||
type loginSigInfo struct {
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/pttcenter"
|
||||
"log"
|
||||
"strconv"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@ -136,6 +135,8 @@ func decodePushReqPacket(c *QQClient, _ uint16, payload []byte) (interface{}, er
|
||||
}
|
||||
|
||||
func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||
c.msgSvcLock.Lock()
|
||||
defer c.msgSvcLock.Unlock()
|
||||
rsp := msg.GetMessageResponse{}
|
||||
err := proto.Unmarshal(payload, &rsp)
|
||||
if err != nil {
|
||||
@ -165,13 +166,9 @@ 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 {
|
||||
if (int64(pairMsg.LastReadTime) & 4294967295) > int64(message.Head.MsgTime) {
|
||||
continue
|
||||
}
|
||||
c.msgSvcCache.Add(strSeq, 0, time.Minute*15)
|
||||
}
|
||||
switch message.Head.MsgType {
|
||||
case 33: // 加群同步
|
||||
groupJoinLock.Lock()
|
||||
@ -234,7 +231,8 @@ func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
if message.Body.RichText == nil || message.Body.RichText.Elems == nil {
|
||||
continue
|
||||
}
|
||||
friend := c.FindFriend(message.Head.FromUin)
|
||||
//friend := c.FindFriend(message.Head.FromUin)
|
||||
/*
|
||||
if friend == nil {
|
||||
return nil, nil
|
||||
}
|
||||
@ -246,6 +244,7 @@ func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
continue
|
||||
}
|
||||
friend.msgSeqList.Add(strSeq, 0, time.Minute*15)
|
||||
*/
|
||||
c.dispatchFriendMessage(c.parsePrivateMessage(message))
|
||||
case 187:
|
||||
_, pkt := c.buildSystemMsgNewFriendPacket()
|
||||
@ -253,8 +252,7 @@ func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{},
|
||||
}
|
||||
}
|
||||
}
|
||||
_, delPkt := c.buildDeleteMessageRequestPacket(delItems)
|
||||
_ = c.send(delPkt)
|
||||
_, _ = c.sendAndWait(c.buildDeleteMessageRequestPacket(delItems))
|
||||
if rsp.SyncFlag != msg.SyncFlag_STOP {
|
||||
_, nextPkt := c.buildGetMessageRequestPacket(rsp.SyncFlag, time.Now().Unix())
|
||||
_ = c.send(nextPkt)
|
||||
|
@ -2,7 +2,6 @@ package client
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/Mrs4s/MiraiGo/utils"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
@ -37,7 +36,7 @@ type (
|
||||
Remark string
|
||||
FaceId int16
|
||||
|
||||
msgSeqList *utils.Cache
|
||||
//msgSeqList *utils.Cache
|
||||
}
|
||||
|
||||
FriendListResponse struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user