Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加好友请求处理 #65

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions client/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,17 @@ func (c *QQClient) SetGroupRequest(accept bool, sequence uint64, typ uint32, gro
}
return oidb2.ParseSetGroupRequestResp(resp)
}

// HandleFriendRequest 处理好友请求
func (c *QQClient) SetFriendRequest(accept bool, targetUid string) error {
// 构造好友请求处理的数据包
pkt, err := oidb2.BuildSetFriendRequest(accept, targetUid)
if err != nil {
return err
}
resp, err := c.sendOidbPacketAndWait(pkt)
if err != nil {
return err
}
return oidb2.ParseSetGroupRequestResp(resp)
}
27 changes: 27 additions & 0 deletions client/packets/oidb/setFriendRequest.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package oidb

import (
"github.com/LagrangeDev/LagrangeGo/client/packets/pb/service/oidb"
"github.com/LagrangeDev/LagrangeGo/utils"
)

func BuildSetFriendRequest(accept bool, targetUid string) (*OidbPacket, error) {
result := uint32(utils.Bool2Int(accept))
if result == 1 {
result = 3
} else {
result = 5
}

packet := oidb.OidbSvcTrpcTcp0XB5D_44{
Accept: result, //utils.Bool2Uint32(accept, 3, 5),
TargetUid: targetUid,
}

return BuildOidbPacket(0xb5d, 44, packet, false, false)
}

func ParseSetFriendRequestResp(data []byte) error {

return CheckError(data)
}
Loading