From 2e441ed9251d898782208b912f250336bee745b9 Mon Sep 17 00:00:00 2001 From: wdvxdr Date: Sun, 14 Nov 2021 21:52:09 +0800 Subject: [PATCH] drop SendGroupGift support QQ no longer provide free group gifts, so we should drop it --- client/builders.go | 19 --- client/client.go | 5 - client/pb/oidb/oidb0xdad.pb.go | 290 --------------------------------- client/pb/oidb/oidb0xdad.proto | 20 --- message/message.go | 17 -- 5 files changed, 351 deletions(-) delete mode 100644 client/pb/oidb/oidb0xdad.pb.go delete mode 100644 client/pb/oidb/oidb0xdad.proto diff --git a/client/builders.go b/client/builders.go index 3451a5bb..529d06c9 100644 --- a/client/builders.go +++ b/client/builders.go @@ -21,7 +21,6 @@ import ( "github.com/Mrs4s/MiraiGo/internal/crypto" "github.com/Mrs4s/MiraiGo/internal/packets" "github.com/Mrs4s/MiraiGo/internal/tlv" - "github.com/Mrs4s/MiraiGo/message" ) var ( @@ -1096,21 +1095,3 @@ func (c *QQClient) buildWordSegmentationPacket(data []byte) (uint16, []byte) { packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvc.0xd79", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload) return seq, packet } - -// OidbSvc.0xdad_1 -func (c *QQClient) sendGroupGiftPacket(groupCode, uin uint64, productID message.GroupGift) (uint16, []byte) { - seq := c.nextSeq() - payload := c.packOIDBPackageProto(3501, 1, &oidb.DADReqBody{ - Client: 1, - ProductId: uint64(productID), - ToUin: uin, - Gc: groupCode, - Version: "V 8.4.5.4745", - Sig: &oidb.DADLoginSig{ - Type: 1, - Sig: []byte(c.getSKey()), - }, - }) - packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvc.0xdad_1", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload) - return seq, packet -} diff --git a/client/client.go b/client/client.go index a46be6e6..6e54fbc4 100644 --- a/client/client.go +++ b/client/client.go @@ -837,11 +837,6 @@ func (c *QQClient) SetCustomServer(servers []*net.TCPAddr) { c.servers = append(servers, c.servers...) } -func (c *QQClient) SendGroupGift(groupCode, uin uint64, gift message.GroupGift) { - _, packet := c.sendGroupGiftPacket(groupCode, uin, gift) - _ = c.sendPacket(packet) -} - func (c *QQClient) registerClient() error { _, err := c.sendAndWait(c.buildClientRegisterPacket()) if err == nil { diff --git a/client/pb/oidb/oidb0xdad.pb.go b/client/pb/oidb/oidb0xdad.pb.go deleted file mode 100644 index 2086f03e..00000000 --- a/client/pb/oidb/oidb0xdad.pb.go +++ /dev/null @@ -1,290 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.17.1 -// source: oidb0xdad.proto - -package oidb - -import ( - reflect "reflect" - sync "sync" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type DADReqBody struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Client int64 `protobuf:"varint,1,opt,name=client,proto3" json:"client,omitempty"` - ProductId uint64 `protobuf:"varint,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` - Amount int64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` - ToUin uint64 `protobuf:"varint,4,opt,name=to_uin,json=toUin,proto3" json:"to_uin,omitempty"` - Gc uint64 `protobuf:"varint,5,opt,name=gc,proto3" json:"gc,omitempty"` - Ip string `protobuf:"bytes,6,opt,name=ip,proto3" json:"ip,omitempty"` - Version string `protobuf:"bytes,7,opt,name=version,proto3" json:"version,omitempty"` - Sig *DADLoginSig `protobuf:"bytes,8,opt,name=sig,proto3" json:"sig,omitempty"` -} - -func (x *DADReqBody) Reset() { - *x = DADReqBody{} - if protoimpl.UnsafeEnabled { - mi := &file_oidb0xdad_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DADReqBody) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DADReqBody) ProtoMessage() {} - -func (x *DADReqBody) ProtoReflect() protoreflect.Message { - mi := &file_oidb0xdad_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DADReqBody.ProtoReflect.Descriptor instead. -func (*DADReqBody) Descriptor() ([]byte, []int) { - return file_oidb0xdad_proto_rawDescGZIP(), []int{0} -} - -func (x *DADReqBody) GetClient() int64 { - if x != nil { - return x.Client - } - return 0 -} - -func (x *DADReqBody) GetProductId() uint64 { - if x != nil { - return x.ProductId - } - return 0 -} - -func (x *DADReqBody) GetAmount() int64 { - if x != nil { - return x.Amount - } - return 0 -} - -func (x *DADReqBody) GetToUin() uint64 { - if x != nil { - return x.ToUin - } - return 0 -} - -func (x *DADReqBody) GetGc() uint64 { - if x != nil { - return x.Gc - } - return 0 -} - -func (x *DADReqBody) GetIp() string { - if x != nil { - return x.Ip - } - return "" -} - -func (x *DADReqBody) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *DADReqBody) GetSig() *DADLoginSig { - if x != nil { - return x.Sig - } - return nil -} - -type DADLoginSig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type uint32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` - Sig []byte `protobuf:"bytes,2,opt,name=sig,proto3" json:"sig,omitempty"` - Appid uint32 `protobuf:"varint,3,opt,name=appid,proto3" json:"appid,omitempty"` -} - -func (x *DADLoginSig) Reset() { - *x = DADLoginSig{} - if protoimpl.UnsafeEnabled { - mi := &file_oidb0xdad_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DADLoginSig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DADLoginSig) ProtoMessage() {} - -func (x *DADLoginSig) ProtoReflect() protoreflect.Message { - mi := &file_oidb0xdad_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DADLoginSig.ProtoReflect.Descriptor instead. -func (*DADLoginSig) Descriptor() ([]byte, []int) { - return file_oidb0xdad_proto_rawDescGZIP(), []int{1} -} - -func (x *DADLoginSig) GetType() uint32 { - if x != nil { - return x.Type - } - return 0 -} - -func (x *DADLoginSig) GetSig() []byte { - if x != nil { - return x.Sig - } - return nil -} - -func (x *DADLoginSig) GetAppid() uint32 { - if x != nil { - return x.Appid - } - return 0 -} - -var File_oidb0xdad_proto protoreflect.FileDescriptor - -var file_oidb0xdad_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x6f, 0x69, 0x64, 0x62, 0x30, 0x78, 0x64, 0x61, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xcc, 0x01, 0x0a, 0x0a, 0x44, 0x41, 0x44, 0x52, 0x65, 0x71, 0x42, 0x6f, 0x64, 0x79, - 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, - 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x15, 0x0a, 0x06, 0x74, 0x6f, 0x5f, 0x75, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x05, 0x74, 0x6f, 0x55, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x67, 0x63, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x02, 0x67, 0x63, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x1e, 0x0a, 0x03, 0x73, 0x69, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, - 0x44, 0x41, 0x44, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x52, 0x03, 0x73, 0x69, 0x67, - 0x22, 0x49, 0x0a, 0x0b, 0x44, 0x41, 0x44, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x12, - 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x03, 0x73, 0x69, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x42, 0x09, 0x5a, 0x07, 0x2e, - 0x2f, 0x3b, 0x6f, 0x69, 0x64, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_oidb0xdad_proto_rawDescOnce sync.Once - file_oidb0xdad_proto_rawDescData = file_oidb0xdad_proto_rawDesc -) - -func file_oidb0xdad_proto_rawDescGZIP() []byte { - file_oidb0xdad_proto_rawDescOnce.Do(func() { - file_oidb0xdad_proto_rawDescData = protoimpl.X.CompressGZIP(file_oidb0xdad_proto_rawDescData) - }) - return file_oidb0xdad_proto_rawDescData -} - -var file_oidb0xdad_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_oidb0xdad_proto_goTypes = []interface{}{ - (*DADReqBody)(nil), // 0: DADReqBody - (*DADLoginSig)(nil), // 1: DADLoginSig -} -var file_oidb0xdad_proto_depIdxs = []int32{ - 1, // 0: DADReqBody.sig:type_name -> DADLoginSig - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_oidb0xdad_proto_init() } -func file_oidb0xdad_proto_init() { - if File_oidb0xdad_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_oidb0xdad_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DADReqBody); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_oidb0xdad_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DADLoginSig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_oidb0xdad_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_oidb0xdad_proto_goTypes, - DependencyIndexes: file_oidb0xdad_proto_depIdxs, - MessageInfos: file_oidb0xdad_proto_msgTypes, - }.Build() - File_oidb0xdad_proto = out.File - file_oidb0xdad_proto_rawDesc = nil - file_oidb0xdad_proto_goTypes = nil - file_oidb0xdad_proto_depIdxs = nil -} diff --git a/client/pb/oidb/oidb0xdad.proto b/client/pb/oidb/oidb0xdad.proto deleted file mode 100644 index 31ecc56e..00000000 --- a/client/pb/oidb/oidb0xdad.proto +++ /dev/null @@ -1,20 +0,0 @@ -syntax = "proto3"; - -option go_package = "./;oidb"; - -message DADReqBody { - int64 client = 1; - uint64 product_id = 2; - int64 amount = 3; - uint64 to_uin = 4; - uint64 gc = 5; - string ip = 6; - string version = 7; - DADLoginSig sig = 8; -} - -message DADLoginSig { - uint32 type = 1; - bytes sig = 2; - uint32 appid = 3; -} \ No newline at end of file diff --git a/message/message.go b/message/message.go index 5c547622..223728a5 100644 --- a/message/message.go +++ b/message/message.go @@ -72,8 +72,6 @@ type ( } ElementType int - - GroupGift int ) // MusicType values. @@ -99,21 +97,6 @@ const ( Video // 视频 LightApp // 轻应用 RedBag // 红包 - - HoldingYourHand GroupGift = 280 - CuteCat GroupGift = 281 - MysteryMask GroupGift = 284 - SweetWink GroupGift = 285 - ImBusy GroupGift = 286 - HappyCola GroupGift = 289 - LuckyBracelet GroupGift = 290 - Cappuccino GroupGift = 299 - CatWatch GroupGift = 302 - FleeceGloves GroupGift = 307 - RainbowCandy GroupGift = 308 - LoveMask GroupGift = 312 - Stronger GroupGift = 313 - LoveMicrophone GroupGift = 367 ) func (s *Sender) IsAnonymous() bool {