From 4e350e6b2a67bbea88320d428355ee0bde1bad1e Mon Sep 17 00:00:00 2001 From: wdvxdr Date: Thu, 22 Jul 2021 23:38:22 +0800 Subject: [PATCH] refresh skey before getCSRFToken --- client/client.go | 9 ++++----- client/decoders.go | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/client/client.go b/client/client.go index 91f69544..b1b017dc 100644 --- a/client/client.go +++ b/client/client.go @@ -545,7 +545,7 @@ func (c *QQClient) GetFriendList() (*FriendListResponse, error) { if err != nil { return nil, err } - list := rsp.(FriendListResponse) + list := rsp.(*FriendListResponse) r.TotalCount = list.TotalCount r.List = append(r.List, list.List...) curFriendCount += len(list.List) @@ -736,9 +736,8 @@ func (c *QQClient) FindGroupByUin(uin int64) *GroupInfo { func (c *QQClient) FindGroup(code int64) *GroupInfo { for _, g := range c.GroupList { - f := g - if f.Code == code { - return f + if g.Code == code { + return g } } return nil @@ -795,7 +794,7 @@ func (c *QQClient) getCookiesWithDomain(domain string) string { func (c *QQClient) getCSRFToken() int { accu := 5381 - for _, b := range c.sigInfo.sKey { + for _, b := range []byte(c.getSKey()) { accu = accu + (accu << 5) + int(b) } return 2147483647 & accu diff --git a/client/decoders.go b/client/decoders.go index 9856ac39..7e320af4 100644 --- a/client/decoders.go +++ b/client/decoders.go @@ -475,7 +475,7 @@ func decodeFriendGroupListResponse(_ *QQClient, _ *incomingPacketInfo, payload [ FaceId: f.FaceId, }) } - rsp := FriendListResponse{ + rsp := &FriendListResponse{ TotalCount: int32(totalFriendCount), List: l, }