From 07c7ab1e987b7ce6cba91b331921d095011a99c0 Mon Sep 17 00:00:00 2001 From: Mrs4s <1844812067@qq.com> Date: Sat, 12 Sep 2020 20:05:10 +0800 Subject: [PATCH] add: group poke sending. --- client/builders.go | 18 +++++++ client/client.go | 4 ++ client/entities.go | 4 ++ client/pb/oidb/oidb.pb.go | 111 ++++++++++++++++++++++++++++++++++++-- client/pb/oidb/oidb.proto | 8 +++ 5 files changed, 140 insertions(+), 5 deletions(-) diff --git a/client/builders.go b/client/builders.go index a2f83a3f..c736d8f5 100644 --- a/client/builders.go +++ b/client/builders.go @@ -915,6 +915,24 @@ func (c *QQClient) buildGroupMutePacket(groupCode, memberUin int64, time uint32) return seq, packet } +// OidbSvc.0xed3 +func (c *QQClient) buildGroupPokePacket(groupCode, target int64) (uint16, []byte) { + seq := c.nextSeq() + body := &oidb.DED3ReqBody{ + ToUin: target, + GroupCode: groupCode, + } + b, _ := proto.Marshal(body) + req := &oidb.OIDBSSOPkg{ + Command: 3795, + ServiceType: 1, + Bodybuffer: b, + } + payload, _ := proto.Marshal(req) + packet := packets.BuildUniPacket(c.Uin, seq, "OidbSvc.0xed3", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload) + return seq, packet +} + // OidbSvc.0x55c_1 func (c *QQClient) buildGroupAdminSetPacket(groupCode, member int64, flag bool) (uint16, []byte) { seq := c.nextSeq() diff --git a/client/client.go b/client/client.go index 556ac519..983d76fa 100644 --- a/client/client.go +++ b/client/client.go @@ -526,6 +526,10 @@ func (c *QQClient) sendGroupLongOrForwardMessage(groupCode int64, isLong bool, m return nil } +func (c *QQClient) sendGroupPoke(groupCode, target int64) { + _, _ = c.sendAndWait(c.buildGroupPokePacket(groupCode, target)) +} + func (c *QQClient) RecallGroupMessage(groupCode int64, msgId, msgInternalId int32) { _, pkt := c.buildGroupRecallPacket(groupCode, msgId, msgInternalId) _ = c.send(pkt) diff --git a/client/entities.go b/client/entities.go index 0537e5cd..7f4a64e1 100644 --- a/client/entities.go +++ b/client/entities.go @@ -263,6 +263,10 @@ func (m *GroupMemberInfo) EditCard(card string) { } } +func (m *GroupMemberInfo) Poke() { + m.Group.client.sendGroupPoke(m.Group.Code, m.Uin) +} + func (m *GroupMemberInfo) SetAdmin(flag bool) { if m.Group.OwnerUin == m.Group.client.Uin { m.Group.client.setGroupAdmin(m.Group.Code, m.Uin, flag) diff --git a/client/pb/oidb/oidb.pb.go b/client/pb/oidb/oidb.pb.go index 22cc489f..ed065a2b 100644 --- a/client/pb/oidb/oidb.pb.go +++ b/client/pb/oidb/oidb.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.25.0 -// protoc v3.12.3 +// protoc v3.11.4 // source: oidb.proto package oidb @@ -1445,6 +1445,85 @@ func (x *D8FCClientInfo) GetIngClientver() string { return "" } +type DED3ReqBody struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ToUin int64 `protobuf:"varint,1,opt,name=toUin,proto3" json:"toUin,omitempty"` + GroupCode int64 `protobuf:"varint,2,opt,name=groupCode,proto3" json:"groupCode,omitempty"` + MsgSeq int32 `protobuf:"varint,3,opt,name=msgSeq,proto3" json:"msgSeq,omitempty"` + MsgRand int32 `protobuf:"varint,4,opt,name=msgRand,proto3" json:"msgRand,omitempty"` + AioUin int64 `protobuf:"varint,5,opt,name=aioUin,proto3" json:"aioUin,omitempty"` +} + +func (x *DED3ReqBody) Reset() { + *x = DED3ReqBody{} + if protoimpl.UnsafeEnabled { + mi := &file_oidb_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DED3ReqBody) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DED3ReqBody) ProtoMessage() {} + +func (x *DED3ReqBody) ProtoReflect() protoreflect.Message { + mi := &file_oidb_proto_msgTypes[15] + 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 DED3ReqBody.ProtoReflect.Descriptor instead. +func (*DED3ReqBody) Descriptor() ([]byte, []int) { + return file_oidb_proto_rawDescGZIP(), []int{15} +} + +func (x *DED3ReqBody) GetToUin() int64 { + if x != nil { + return x.ToUin + } + return 0 +} + +func (x *DED3ReqBody) GetGroupCode() int64 { + if x != nil { + return x.GroupCode + } + return 0 +} + +func (x *DED3ReqBody) GetMsgSeq() int32 { + if x != nil { + return x.MsgSeq + } + return 0 +} + +func (x *DED3ReqBody) GetMsgRand() int32 { + if x != nil { + return x.MsgRand + } + return 0 +} + +func (x *DED3ReqBody) GetAioUin() int64 { + if x != nil { + return x.AioUin + } + return 0 +} + var File_oidb_proto protoreflect.FileDescriptor var file_oidb_proto_rawDesc = []byte{ @@ -1707,8 +1786,17 @@ var file_oidb_proto_rawDesc = []byte{ 0x0a, 0x06, 0x69, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x69, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x67, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, - 0x67, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x76, 0x65, 0x72, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, - 0x6f, 0x69, 0x64, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x76, 0x65, 0x72, 0x22, 0x8b, 0x01, 0x0a, 0x0b, 0x44, + 0x45, 0x44, 0x33, 0x52, 0x65, 0x71, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, + 0x55, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x55, 0x69, 0x6e, + 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x6d, 0x73, 0x67, 0x53, 0x65, 0x71, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, + 0x6d, 0x73, 0x67, 0x53, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x52, 0x61, 0x6e, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x73, 0x67, 0x52, 0x61, 0x6e, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x61, 0x69, 0x6f, 0x55, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x61, 0x69, 0x6f, 0x55, 0x69, 0x6e, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x6f, 0x69, + 0x64, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1723,7 +1811,7 @@ func file_oidb_proto_rawDescGZIP() []byte { return file_oidb_proto_rawDescData } -var file_oidb_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_oidb_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_oidb_proto_goTypes = []interface{}{ (*OIDBSSOPkg)(nil), // 0: OIDBSSOPkg (*D8A0RspBody)(nil), // 1: D8A0RspBody @@ -1740,6 +1828,7 @@ var file_oidb_proto_goTypes = []interface{}{ (*D8FCCardNameElem)(nil), // 12: D8FCCardNameElem (*D8FCLevelName)(nil), // 13: D8FCLevelName (*D8FCClientInfo)(nil), // 14: D8FCClientInfo + (*DED3ReqBody)(nil), // 15: DED3ReqBody } var file_oidb_proto_depIdxs = []int32{ 2, // 0: D8A0RspBody.msgKickResult:type_name -> D8A0KickResult @@ -1945,6 +2034,18 @@ func file_oidb_proto_init() { return nil } } + file_oidb_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DED3ReqBody); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_oidb_proto_msgTypes[7].OneofWrappers = []interface{}{ (*D89AGroupinfo_Val)(nil), @@ -1955,7 +2056,7 @@ func file_oidb_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_oidb_proto_rawDesc, NumEnums: 0, - NumMessages: 15, + NumMessages: 16, NumExtensions: 0, NumServices: 0, }, diff --git a/client/pb/oidb/oidb.proto b/client/pb/oidb/oidb.proto index 53cd69da..d5089bdc 100644 --- a/client/pb/oidb/oidb.proto +++ b/client/pb/oidb/oidb.proto @@ -145,4 +145,12 @@ message D8FCLevelName { message D8FCClientInfo { int32 implat = 1; string ingClientver = 2; +} + +message DED3ReqBody { + int64 toUin = 1; + int64 groupCode = 2; + int32 msgSeq = 3; + int32 msgRand = 4; + int64 aioUin = 5; } \ No newline at end of file