Skip to content

Commit

Permalink
fix: 好友语音上传
Browse files Browse the repository at this point in the history
  • Loading branch information
Fripine committed Oct 11, 2024
1 parent 9838138 commit 9ff32cd
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 26 deletions.
2 changes: 2 additions & 0 deletions binary/jce/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ type (
NewLoverDiamondFlag byte `jceId:"54"`
ExtSnsFrdData []byte `jceId:"55"`
MutualMarkData []byte `jceId:"56"`
Uid string `jceId:"63"`
}

TroopListRequest struct {
Expand Down Expand Up @@ -635,6 +636,7 @@ func (pkt *FriendInfo) ReadFrom(r *JceReader) {
pkt.Network = r.ReadByte(20)
pkt.NetworkType = r.ReadInt32(24)
pkt.CardID = r.ReadBytes(41)
pkt.Uid = r.ReadString(63)
}

func (pkt *TroopNumber) ReadFrom(r *JceReader) {
Expand Down
10 changes: 7 additions & 3 deletions client/builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -679,12 +679,16 @@ func (c *QQClient) buildConfPushRespPacket(t int32, pktSeq int64, jceBuf []byte)
// friendlist.getFriendGroupList
func (c *QQClient) buildFriendGroupListRequestPacket(friendStartIndex, friendListCount, groupStartIndex, groupListCount int16) (uint16, []byte) {
d50, _ := proto.Marshal(&pb.D50ReqBody{
Appid: 1002,
Appid: 10002,
ReqMusicSwitch: 1,
ReqMutualmarkAlienation: 1,
ReqMutualmarkScore: 1,
ReqKsingSwitch: 1,
ReqMutualmarkLbsshare: 1,
})
d6B, _ := proto.Marshal(&pb.D6BReqBody{
Field1: "1",
})
req := &jce.FriendListRequest{
Reqtype: 3,
IfReflush: func() byte {
Expand All @@ -707,13 +711,13 @@ func (c *QQClient) buildFriendGroupListRequestPacket(friendStartIndex, friendLis
GroupCount: byte(groupListCount),
IfGetMSFGroup: 0,
IfShowTermType: 1,
Version: 27,
Version: 41,
UinList: nil,
AppType: 0,
IfGetDOVId: 0,
IfGetBothFlag: 0,
D50: d50,
D6B: EmptyBytes,
D6B: d6B,
SnsTypeList: []int64{13580, 13581, 13582},
}
buf := &jce.RequestDataVersion3{
Expand Down
37 changes: 26 additions & 11 deletions client/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,35 @@ func (c *QQClient) RefreshAllRkeyInfoCache() error {
// GetFriendsData 获取好友列表数据
func (c *QQClient) GetFriendsData() (map[uint32]*entity.Friend, error) {
friendsData := make(map[uint32]*entity.Friend)
friends, token, err := c.FetchFriends(0)
// friends, token, err := c.FetchFriends(0)
// if err != nil {
// return friendsData, err
// }
// for _, friend := range friends {
// friendsData[friend.Uin] = friend
// }
// for token != 0 {
// friends, token, err = c.FetchFriends(token)
// if err != nil {
// return friendsData, err
// }
// for _, friend := range friends {
// friendsData[friend.Uin] = friend
// }
// }
rsp, err := c.GetFriendList()
if err != nil {
c.warning("获取好友UID失败")
return friendsData, err
}
for _, friend := range friends {
friendsData[friend.Uin] = friend
}
for token != 0 {
friends, token, err = c.FetchFriends(token)
if err != nil {
return friendsData, err
}
for _, friend := range friends {
friendsData[friend.Uin] = friend
for _, fi := range rsp.List {
friendsData[uint32(fi.Uin)] = &entity.Friend{
Uin: uint32(fi.Uin),
Uid: fi.Uid,
Nickname: fi.Nickname,
Remarks: fi.Remark,
PersonalSign: "",
Avatar: "",
}
}
c.debug("获取%d个好友", len(friendsData))
Expand Down
1 change: 1 addition & 0 deletions client/decoders.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ func decodeFriendGroupListResponse(_ *QQClient, pkt *network.Packet) (any, error
Nickname: f.Nick,
Remark: f.Remark,
FaceId: f.FaceId,
Uid: f.Uid,
})
}
rsp := &FriendListResponse{
Expand Down
1 change: 1 addition & 0 deletions client/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type (
Nickname string
Remark string
FaceId int16
Uid string
// msgSeqList *utils.Cache
}

Expand Down
10 changes: 7 additions & 3 deletions client/pb/data.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 12 additions & 9 deletions client/pb/data.proto
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,21 @@ message D50ReqBody {
repeated int64 uinList = 6;
int32 reqMusicSwitch = 91001;
int32 reqMutualmarkAlienation = 101001;
int32 reqMutualmarkScore = 141001;
int32 reqKsingSwitch = 151001;
int32 reqMutualmarkLbsshare = 181001;
int32 reqMutualmarkScore = 151001;
int32 reqKsingSwitch = 181001;
int32 reqMutualmarkLbsshare = 251001;
}

message D6BReqBody {
string field1 = 1;
}

message ReqDataHighwayHead {
DataHighwayHead msgBasehead = 1;
SegHead msgSeghead = 2;
bytes reqExtendinfo = 3;
int64 timestamp = 4;
//LoginSigHead? msgLoginSigHead = 5;
// LoginSigHead? msgLoginSigHead = 5;
}

message RspDataHighwayHead {
Expand Down Expand Up @@ -222,8 +226,8 @@ message GroupMemberInfo {
bytes lev = 13;
int64 join = 14;
int64 lastSpeak = 15;
//repeated CustomEntry customEnties = 16;
//repeated GBarInfo gbarConcerned = 17;
// repeated CustomEntry customEnties = 16;
// repeated GBarInfo gbarConcerned = 17;
bytes gbarTitle = 18;
bytes gbarUrl = 19;
int32 gbarCnt = 20;
Expand All @@ -239,8 +243,8 @@ message GroupMemberInfo {
int32 concernType = 30;
bytes specialTitle = 31;
int32 specialTitleExpireTime = 32;
//FlowersEntry flowerEntry = 33;
//TeamEntry teamEntry = 34;
// FlowersEntry flowerEntry = 33;
// TeamEntry teamEntry = 34;
bytes phoneNum = 35;
bytes job = 36;
int32 medalId = 37;
Expand All @@ -249,4 +253,3 @@ message GroupMemberInfo {

string honor = 41;
}

0 comments on commit 9ff32cd

Please sign in to comment.