diff --git a/client/operation.go b/client/operation.go index 87e1900..d5458c6 100644 --- a/client/operation.go +++ b/client/operation.go @@ -315,6 +315,20 @@ func (c *QQClient) FriendPoke(uin uint32) error { return oidb2.ParsePokeResp(resp) } +// DeleteFriend 删除好友 +func (c *QQClient) DeleteFriend(uin uint32, block bool) error { + uid := c.GetUID(uin) + pkt, err := oidb2.BuildDeleteFriendReq(uid, block) + if err != nil { + return err + } + resp, err := c.sendOidbPacketAndWait(pkt) + if err != nil { + return err + } + return oidb2.ParseDeleteFriendResp(resp) +} + // RecallFriendMessage 撤回私聊消息 func (c *QQClient) RecallFriendMessage(uin, seq, random, clientSeq, timestamp uint32) error { packet := message.C2CRecallMsg{ diff --git a/client/packets/oidb/delete_friend.go b/client/packets/oidb/delete_friend.go new file mode 100644 index 0000000..68ba277 --- /dev/null +++ b/client/packets/oidb/delete_friend.go @@ -0,0 +1,29 @@ +package oidb + +import ( + "github.com/LagrangeDev/LagrangeGo/client/packets/pb/service/oidb" +) + +func BuildDeleteFriendReq(uid string, block bool) (*Packet, error) { + body := oidb.OidbSvcTrpcTcp0X126B_0{ + Field1: &oidb.OidbSvcTrpcTcp0X126B_0_Field1{ + TargetUid: uid, + Field2: &oidb.OidbSvcTrpcTcp0X126B_0_Field1_2{ + Field1: 130, + Field2: 109, + Field3: &oidb.OidbSvcTrpcTcp0X126B_0_Field1_2_3{ + Field1: 8, + Field2: 8, + Field3: 50, + }, + }, + Block: block, + Field4: true, + }, + } + return BuildOidbPacket(0x126B, 0, &body, false, false) +} + +func ParseDeleteFriendResp(data []byte) error { + return CheckError(data) +} diff --git a/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x126B_0.pb.go b/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x126B_0.pb.go new file mode 100644 index 0000000..1ad8994 --- /dev/null +++ b/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x126B_0.pb.go @@ -0,0 +1,31 @@ +// Code generated by protoc-gen-golite. DO NOT EDIT. +// source: pb/service/oidb/OidbSvcTrpcTcp0x126B_0.proto + +package oidb + +type OidbSvcTrpcTcp0X126B_0 struct { + Field1 *OidbSvcTrpcTcp0X126B_0_Field1 `protobuf:"bytes,1,opt"` + _ [0]func() +} + +type OidbSvcTrpcTcp0X126B_0_Field1 struct { + TargetUid string `protobuf:"bytes,1,opt"` + Field2 *OidbSvcTrpcTcp0X126B_0_Field1_2 `protobuf:"bytes,2,opt"` + Block bool `protobuf:"varint,3,opt"` + Field4 bool `protobuf:"varint,4,opt"` // true + _ [0]func() +} + +type OidbSvcTrpcTcp0X126B_0_Field1_2 struct { + Field1 uint32 `protobuf:"varint,1,opt"` // 130 + Field2 uint32 `protobuf:"varint,2,opt"` // 109 + Field3 *OidbSvcTrpcTcp0X126B_0_Field1_2_3 `protobuf:"bytes,3,opt"` + _ [0]func() +} + +type OidbSvcTrpcTcp0X126B_0_Field1_2_3 struct { + Field1 uint32 `protobuf:"varint,1,opt"` // 8 + Field2 uint32 `protobuf:"varint,2,opt"` // 8 + Field3 uint32 `protobuf:"varint,3,opt"` // 50 + _ [0]func() +} diff --git a/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x126B_0.proto b/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x126B_0.proto new file mode 100644 index 0000000..39456ca --- /dev/null +++ b/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x126B_0.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +option go_package = "github.com/LagrangeDev/LagrangeGo/client/packets/pb/service/oidb"; + +message OidbSvcTrpcTcp0x126B_0 { + OidbSvcTrpcTcp0x126B_0_Field1 Field1 = 1; +} + +message OidbSvcTrpcTcp0x126B_0_Field1 { + string TargetUid = 1; + OidbSvcTrpcTcp0x126B_0_Field1_2 Field2 = 2; + bool block = 3; + bool Field4 = 4; // true +} + +message OidbSvcTrpcTcp0x126B_0_Field1_2 { + uint32 Field1 = 1; // 130 + uint32 Field2 = 2; // 109 + OidbSvcTrpcTcp0x126B_0_Field1_2_3 Field3 = 3; +} + +message OidbSvcTrpcTcp0x126B_0_Field1_2_3 { + uint32 Field1 = 1; // 8 + uint32 Field2 = 2; // 8 + uint32 Field3 = 3; // 50 +}