1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

fix session miss.

This commit is contained in:
Mrs4s 2021-02-02 07:03:55 +08:00
parent 681dd6d407
commit 0a256bc3e0

View File

@ -46,6 +46,7 @@ type (
sessionSyncEvent struct { sessionSyncEvent struct {
IsEnd bool IsEnd bool
GroupNum int32
GroupSessions []*GroupSessionInfo GroupSessions []*GroupSessionInfo
} }
) )
@ -81,7 +82,7 @@ func (c *QQClient) SyncSessions() (*SessionSyncResponse, error) {
} }
ret := &SessionSyncResponse{} ret := &SessionSyncResponse{}
notifyChan := make(chan bool) notifyChan := make(chan bool)
ended := false var groupNum int32 = -1
p := 0 p := 0
stop := c.waitPacket("RegPrxySvc.PbSyncMsg", func(i interface{}, err error) { stop := c.waitPacket("RegPrxySvc.PbSyncMsg", func(i interface{}, err error) {
if err != nil { if err != nil {
@ -92,10 +93,10 @@ func (c *QQClient) SyncSessions() (*SessionSyncResponse, error) {
if len(e.GroupSessions) > 0 { if len(e.GroupSessions) > 0 {
ret.GroupSessions = append(ret.GroupSessions, e.GroupSessions...) ret.GroupSessions = append(ret.GroupSessions, e.GroupSessions...)
} }
if e.IsEnd { if e.GroupNum != -1 {
ended = true groupNum = e.GroupNum
} }
if p > 1 { if groupNum != -1 && len(ret.GroupSessions) >= int(groupNum) {
notifyChan <- true notifyChan <- true
} }
}) })
@ -350,6 +351,10 @@ func decodeMsgSyncResponse(c *QQClient, _ uint16, payload []byte) (interface{},
} }
ret := &sessionSyncEvent{ ret := &sessionSyncEvent{
IsEnd: (rsp.GetFlag() & 2) == 2, IsEnd: (rsp.GetFlag() & 2) == 2,
GroupNum: -1,
}
if rsp.Info != nil {
ret.GroupNum = int32(rsp.Info.GetGroupNum())
} }
if len(rsp.GroupMsg) > 0 { if len(rsp.GroupMsg) > 0 {
for _, gm := range rsp.GroupMsg { for _, gm := range rsp.GroupMsg {