Skip to content

Commit 3aa85c0

Browse files
committed
修复了FetchFriends函数及一些使用这个直接获得自己uin的函数
1 parent 16174a5 commit 3aa85c0

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

client/cache.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
package client
22

33
import (
4+
"strconv"
45
"time"
56

67
"github.com/LagrangeDev/LagrangeGo/client/entity"
78
)
89

10+
var selfUin string
11+
912
// GetUID 获取缓存中对应uin的uid
1013
func (c *QQClient) GetUID(uin uint32, groupUin ...uint32) string {
1114
if uin == 0 {
1215
return ""
1316
}
17+
if uin == c.Uin {
18+
if selfUin == "" {
19+
selfUin = strconv.FormatUint(uint64(uin), 10)
20+
}
21+
return selfUin
22+
}
1423
if len(groupUin) == 0 && c.cache.FriendCacheIsEmpty() {
1524
if err := c.RefreshFriendCache(); err != nil {
1625
return ""

client/packets/oidb/fetch_friends.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ func BuildFetchFriendsReq(token uint32) (*Packet, error) {
1111
body := oidb.OidbSvcTrpcTcp0XFD4_1{
1212
Field2: 300,
1313
Field4: 0,
14-
NextUin: &oidb.OidbSvcTrpcTcp0XFD4_1Uin{
15-
Uin: token,
16-
},
1714
Field6: 1,
15+
Field7: 2147483647,
1816
Body: []*oidb.OidbSvcTrpcTcp0XFD4_1Body{{
1917
Type: 1,
2018
Number: &oidb.OidbNumber{Numbers: []uint32{103, 102, 20002, 27394}},
@@ -25,6 +23,11 @@ func BuildFetchFriendsReq(token uint32) (*Packet, error) {
2523
Field10002: []uint32{13578, 13579, 13573, 13572, 13568},
2624
Field10003: 4051,
2725
}
26+
if token != 0 {
27+
body.NextUin = &oidb.OidbSvcTrpcTcp0XFD4_1Uin{
28+
Uin: token,
29+
}
30+
}
2831
/*
2932
* OidbNumber里面的东西代表你想要拿到的Property,这些Property将会在返回的数据里面的Preserve的Field,
3033
* 102:个性签名

client/packets/pb/service/oidb/OidbSvcTrpcTcp0xFD4_1.pb.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/packets/pb/service/oidb/OidbSvcTrpcTcp0xFD4_1.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ message OidbSvcTrpcTcp0xFD4_1 {
1010
uint32 Field4 = 4; // 0
1111
OidbSvcTrpcTcp0xFD4_1Uin NextUin = 5;
1212
uint32 Field6 = 6; // 1
13+
uint32 Field7 = 7; // 2,147,483,647
1314
repeated OidbSvcTrpcTcp0xFD4_1Body Body = 10001;
1415
repeated uint32 Field10002 = 10002; // [13578, 13579, 13573, 13572, 13568]
1516
uint32 Field10003 = 10003;

0 commit comments

Comments
 (0)