From b6aee75d67c2d4322823709a8d05fd90a4022a14 Mon Sep 17 00:00:00 2001 From: Mrs4s <1844812067@qq.com> Date: Tue, 7 Jul 2020 02:58:36 +0800 Subject: [PATCH] more event supported. --- README.md | 4 +- binary/jce/reader.go | 4 + binary/jce/structs.go | 40 ++++- binary/reader.go | 24 ++- client/builders.go | 6 +- client/client.go | 49 ++++-- client/decoders.go | 53 ++++++- client/entities.go | 15 ++ client/events.go | 97 +++++++++--- client/pb/data.pb.go | 360 +++++++++++++++++++++++++++++++++++++++--- client/pb/data.proto | 25 +++ 11 files changed, 608 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index 013cab32..a882401d 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,13 @@ qq-android协议的golang实现 移植于Mirai | 功能 | 状态 | | -------- | ------ | | 登录 | 完成 | -| 自动重连 | 正在做 | +| 自动重连 | 大概能用了 | | 好友/群列表 | 完成 | | 好友消息接受 | 完成 | | 好友消息发送 | 正在做| | 群消息接受 |完成| | 群消息发送 | 50% (仅支持 文本/图片/表情)| -| QQ各种事件 | 正在做 | +| QQ各种事件 | 正在做, 已支持 群内禁言/群内消息撤回 | | Cookies相关 | 咕咕| | MiraiGo文档 | 咕咕| | QQ协议说明文档| 自用整理 有空了应该会做| \ No newline at end of file diff --git a/binary/jce/reader.go b/binary/jce/reader.go index 9f637c1a..764c9baa 100644 --- a/binary/jce/reader.go +++ b/binary/jce/reader.go @@ -414,3 +414,7 @@ func (r *JceReader) ReadObject(i interface{}, tag int) { o.ReadFrom(r) } } + +func (r *JceReader) ReadAvailable() []byte { + return r.readBytes(r.buf.Len()) +} diff --git a/binary/jce/structs.go b/binary/jce/structs.go index 00c37cfe..3ff8d8b1 100644 --- a/binary/jce/structs.go +++ b/binary/jce/structs.go @@ -5,7 +5,6 @@ type IJecStruct interface { ReadFrom(*JceReader) } -// TODO: code gen type ( RequestPacket struct { IVersion int16 `jceId:"1"` @@ -67,6 +66,28 @@ type ( SetMute byte `jceId:"36"` } + PushMessageInfo struct { + FromUin int64 `jceId:"0"` + MsgTime int64 `jceId:"1"` + MsgType int16 `jceId:"2"` + MsgSeq int16 `jceId:"3"` + Msg string `jceId:"4"` + RealMsgTime int32 `jceId:"5"` + VMsg []byte `jceId:"6"` + AppShareID int64 `jceId:"7"` + MsgCookies []byte `jceId:"8"` + AppShareCookie []byte `jceId:"9"` + MsgUid int64 `jceId:"10"` + LastChangeTime int64 `jceId:"11"` + FromInstId int64 `jceId:"14"` + RemarkOfSender []byte `jceId:"15"` + FromMobile string `jceId:"16"` + FromName string `jceId:"17"` + } + + SvcRespPushMsg struct { + } + FriendListRequest struct { Reqtype int32 `jceId:"0"` IfReflush byte `jceId:"1"` @@ -395,3 +416,20 @@ func (pkt *TroopMemberInfo) ReadFrom(r *JceReader) { pkt.SpecialTitleExpireTime = r.ReadInt64(24) pkt.Job = r.ReadString(25) } + +func (pkt *PushMessageInfo) ToBytes() []byte { + w := NewJceWriter() + w.WriteJceStructRaw(pkt) + return w.Bytes() +} + +func (pkt *PushMessageInfo) ReadFrom(r *JceReader) { + pkt.FromUin = r.ReadInt64(0) + pkt.MsgTime = r.ReadInt64(1) + pkt.MsgType = r.ReadInt16(2) + pkt.MsgSeq = r.ReadInt16(3) + pkt.Msg = r.ReadString(4) + pkt.VMsg = r.ReadAny(6).([]byte) + pkt.FromMobile = r.ReadString(16) + pkt.FromName = r.ReadString(17) +} diff --git a/binary/reader.go b/binary/reader.go index 0313290a..2e5a6602 100644 --- a/binary/reader.go +++ b/binary/reader.go @@ -121,26 +121,34 @@ func NewNetworkReader(conn net.Conn) *NetworkReader { return &NetworkReader{conn: conn} } -func (r *NetworkReader) ReadByte() byte { +func (r *NetworkReader) ReadByte() (byte, error) { buf := make([]byte, 1) n, err := r.conn.Read(buf) if err != nil { - panic(err) + return 0, err } if n != 1 { return r.ReadByte() } - return buf[0] + return buf[0], nil } -func (r *NetworkReader) ReadBytes(len int) []byte { +func (r *NetworkReader) ReadBytes(len int) ([]byte, error) { buf := make([]byte, len) for i := 0; i < len; i++ { - buf[i] = r.ReadByte() + b, err := r.ReadByte() + if err != nil { + return nil, err + } + buf[i] = b } - return buf + return buf, nil } -func (r *NetworkReader) ReadInt32() int32 { - return (int32(r.ReadByte()) << 24) | (int32(r.ReadByte()) << 16) | (int32(r.ReadByte()) << 8) | int32(r.ReadByte()) +func (r *NetworkReader) ReadInt32() (int32, error) { + b, err := r.ReadBytes(4) + if err != nil { + return 0, err + } + return (int32(b[0]) << 24) | (int32(b[1]) << 16) | (int32(b[2]) << 8) | int32(b[3]), nil } diff --git a/client/builders.go b/client/builders.go index 25316692..932db50b 100644 --- a/client/builders.go +++ b/client/builders.go @@ -139,7 +139,7 @@ func (c *QQClient) buildClientRegisterPacket() (uint16, []byte) { return seq, packet } -func (c *QQClient) buildPushResponsePacket(t int32, pktSeq int64, jceBuf []byte) (uint16, []byte) { +func (c *QQClient) buildConfPushRespPacket(t int32, pktSeq int64, jceBuf []byte) (uint16, []byte) { seq := c.nextSeq() req := jce.NewJceWriter() req.WriteInt32(t, 1) @@ -162,6 +162,10 @@ func (c *QQClient) buildPushResponsePacket(t int32, pktSeq int64, jceBuf []byte) return seq, packet } +func (c *QQClient) buildOnlinePushRespPacket() { + +} + func (c *QQClient) buildFriendGroupListRequestPacket(friendStartIndex, friendListCount, groupStartIndex, groupListCount int16) (uint16, []byte) { seq := c.nextSeq() d50, _ := proto.Marshal(&pb.D50ReqBody{ diff --git a/client/client.go b/client/client.go index 99cf1b07..1c4715a3 100644 --- a/client/client.go +++ b/client/client.go @@ -9,6 +9,7 @@ import ( "github.com/Mrs4s/MiraiGo/message" "github.com/Mrs4s/MiraiGo/protocol/packets" "github.com/golang/protobuf/proto" + "io" "log" "math/rand" "net" @@ -54,9 +55,7 @@ type QQClient struct { requestPacketRequestId int32 messageSeq int32 groupDataTransSeq int32 - - privateMessageHandlers []func(*QQClient, *message.PrivateMessage) - groupMessageHandlers []func(*QQClient, *message.GroupMessage) + eventHandlers *eventHandlers } type loginSigInfo struct { @@ -90,6 +89,7 @@ func NewClient(uin int64, password string) *QQClient { "StatSvc.register": decodeClientRegisterResponse, "MessageSvc.PushNotify": decodeSvcNotify, "OnlinePush.PbPushGroupMsg": decodeGroupMessagePacket, + "OnlinePush.ReqPush": decodeOnlinePushReqPacket, "ConfigPushSvc.PushReq": decodePushReqPacket, "MessageSvc.PbGetMsg": decodeMessageSvcPacket, "friendlist.getFriendGroupList": decodeFriendGroupListResponse, @@ -102,6 +102,7 @@ func NewClient(uin int64, password string) *QQClient { requestPacketRequestId: 1921334513, messageSeq: 22911, ksid: []byte("|454001228437590|A8.2.7.27f6ea96"), + eventHandlers: &eventHandlers{}, } rand.Read(cli.RandomKey) return cli @@ -112,11 +113,10 @@ func (c *QQClient) Login() (*LoginResponse, error) { if c.running { return nil, ErrAlreadyRunning } - conn, err := net.Dial("tcp", "125.94.60.146:80") //TODO: more servers + err := c.connect() if err != nil { return nil, err } - c.Conn = conn c.running = true go c.loop() seq, packet := c.buildLoginPacket() @@ -214,10 +214,13 @@ func (c *QQClient) UploadGroupImage(groupCode int64, img []byte) (*message.Group continue } r := binary.NewNetworkReader(conn) - r.ReadByte() - hl := r.ReadInt32() - r.ReadBytes(4) - payload := r.ReadBytes(int(hl)) + _, err = r.ReadByte() + if err != nil { + continue + } + hl, _ := r.ReadInt32() + _, _ = r.ReadBytes(4) + payload, _ := r.ReadBytes(int(hl)) _ = conn.Close() rsp := pb.RspDataHighwayHead{} if proto.Unmarshal(payload, &rsp) != nil { @@ -303,9 +306,18 @@ func (g *GroupInfo) FindMember(uin int64) *GroupMemberInfo { return nil } +func (c *QQClient) connect() error { + conn, err := net.Dial("tcp", "125.94.60.146:80") //TODO: more servers + if err != nil { + return err + } + c.Conn = conn + return nil +} + func (c *QQClient) registerClient() { - seq, packet := c.buildClientRegisterPacket() - _, _ = c.sendAndWait(seq, packet) + _, packet := c.buildClientRegisterPacket() + _ = c.send(packet) } func (c *QQClient) nextSeq() uint16 { @@ -363,7 +375,20 @@ func (c *QQClient) sendAndWait(seq uint16, pkt []byte) (interface{}, error) { func (c *QQClient) loop() { reader := binary.NewNetworkReader(c.Conn) for c.running { - data := reader.ReadBytes(int(reader.ReadInt32()) - 4) + l, err := reader.ReadInt32() + if err == io.EOF || err == io.ErrClosedPipe { + err = c.connect() + if err != nil { + c.running = false + return + } + reader = binary.NewNetworkReader(c.Conn) + c.registerClient() + } + if l <= 0 { + continue + } + data, err := reader.ReadBytes(int(l) - 4) pkt, err := packets.ParseIncomingPacket(data, c.sigInfo.d2Key) if err != nil { log.Println("parse incoming packet error: " + err.Error()) diff --git a/client/decoders.go b/client/decoders.go index eab754cd..1dbf4d89 100644 --- a/client/decoders.go +++ b/client/decoders.go @@ -109,7 +109,7 @@ func decodePushReqPacket(c *QQClient, payload []byte) (interface{}, error) { t := r.ReadInt32(1) r.ReadSlice(&jceBuf, 2) seq := r.ReadInt64(3) - _, pkt := c.buildPushResponsePacket(t, seq, jceBuf) + _, pkt := c.buildConfPushRespPacket(t, seq, jceBuf) return nil, c.send(pkt) } @@ -280,3 +280,54 @@ func decodeGroupImageStoreResponse(c *QQClient, payload []byte) (interface{}, er UploadPort: rsp.Uint32UpPort, }, nil } + +func decodeOnlinePushReqPacket(c *QQClient, payload []byte) (interface{}, error) { + request := &jce.RequestPacket{} + request.ReadFrom(jce.NewJceReader(payload)) + data := &jce.RequestDataVersion2{} + data.ReadFrom(jce.NewJceReader(request.SBuffer)) + jr := jce.NewJceReader(data.Map["req"]["OnlinePushPack.SvcReqPushMsg"][1:]) + msgInfos := []jce.PushMessageInfo{} + jr.ReadSlice(&msgInfos, 2) + for _, m := range msgInfos { + if m.MsgType == 732 { + r := binary.NewReader(m.VMsg) + groupId := int64(uint32(r.ReadInt32())) + iType := r.ReadByte() + r.ReadByte() + switch iType { + case 0x0c: // 群内禁言 + operator := int64(uint32(r.ReadInt32())) + if operator == c.Uin { + continue + } + r.ReadBytes(6) + target := int64(uint32(r.ReadInt32())) + t := r.ReadInt32() + c.dispatchGroupMuteEvent(&GroupMuteEvent{ + GroupUin: groupId, + OperatorUin: operator, + TargetUin: target, + Time: t, + }) + case 0x11: // 撤回消息 + r.ReadByte() + b := pb.NotifyMsgBody{} + _ = proto.Unmarshal(r.ReadAvailable(), &b) + if b.OptMsgRecall == nil { + continue + } + for _, rm := range b.OptMsgRecall.RecalledMsgList { + c.dispatchGroupMessageRecalledEvent(&GroupMessageRecalledEvent{ + GroupUin: groupId, + OperatorUin: b.OptMsgRecall.Uin, + AuthorUin: rm.AuthorUin, + MessageId: rm.Seq, + Time: rm.Time, + }) + } + } + } + } + return nil, nil +} diff --git a/client/entities.go b/client/entities.go index 8f26a562..c8f11e2e 100644 --- a/client/entities.go +++ b/client/entities.go @@ -55,6 +55,21 @@ type ( Job string } + GroupMuteEvent struct { + GroupUin int64 + OperatorUin int64 + TargetUin int64 + Time int32 + } + + GroupMessageRecalledEvent struct { + GroupUin int64 + OperatorUin int64 + AuthorUin int64 + MessageId int32 + Time int32 + } + groupMemberListResponse struct { NextUin int64 list []GroupMemberInfo diff --git a/client/events.go b/client/events.go index 3a532a9f..f579c55c 100644 --- a/client/events.go +++ b/client/events.go @@ -1,13 +1,41 @@ package client -import "github.com/Mrs4s/MiraiGo/message" +import ( + "errors" + "github.com/Mrs4s/MiraiGo/message" +) + +var ErrEventUndefined = errors.New("event undefined") + +type eventHandlers struct { + privateMessageHandlers []func(*QQClient, *message.PrivateMessage) + groupMessageHandlers []func(*QQClient, *message.GroupMessage) + groupMuteEventHandlers []func(*QQClient, *GroupMuteEvent) + groupRecalledHandlers []func(*QQClient, *GroupMessageRecalledEvent) +} + +func (c *QQClient) OnEvent(i interface{}) error { + switch f := i.(type) { + case func(*QQClient, *message.PrivateMessage): + c.OnPrivateMessage(f) + case func(*QQClient, *message.GroupMessage): + c.OnGroupMessage(f) + case func(*QQClient, *GroupMuteEvent): + c.OnGroupMuted(f) + case func(*QQClient, *GroupMessageRecalledEvent): + c.OnGroupMessageRecalled(f) + default: + return ErrEventUndefined + } + return nil +} func (c *QQClient) OnPrivateMessage(f func(*QQClient, *message.PrivateMessage)) { - c.privateMessageHandlers = append(c.privateMessageHandlers, f) + c.eventHandlers.privateMessageHandlers = append(c.eventHandlers.privateMessageHandlers, f) } func (c *QQClient) OnPrivateMessageF(filter func(*message.PrivateMessage) bool, f func(*QQClient, *message.PrivateMessage)) { - c.privateMessageHandlers = append(c.privateMessageHandlers, func(client *QQClient, msg *message.PrivateMessage) { + c.OnPrivateMessage(func(client *QQClient, msg *message.PrivateMessage) { if filter(msg) { f(client, msg) } @@ -15,7 +43,15 @@ func (c *QQClient) OnPrivateMessageF(filter func(*message.PrivateMessage) bool, } func (c *QQClient) OnGroupMessage(f func(*QQClient, *message.GroupMessage)) { - c.groupMessageHandlers = append(c.groupMessageHandlers, f) + c.eventHandlers.groupMessageHandlers = append(c.eventHandlers.groupMessageHandlers, f) +} + +func (c *QQClient) OnGroupMuted(f func(*QQClient, *GroupMuteEvent)) { + c.eventHandlers.groupMuteEventHandlers = append(c.eventHandlers.groupMuteEventHandlers, f) +} + +func (c *QQClient) OnGroupMessageRecalled(f func(*QQClient, *GroupMessageRecalledEvent)) { + c.eventHandlers.groupRecalledHandlers = append(c.eventHandlers.groupRecalledHandlers, f) } func NewUinFilterPrivate(uin int64) func(*message.PrivateMessage) bool { @@ -28,15 +64,10 @@ func (c *QQClient) dispatchFriendMessage(msg *message.PrivateMessage) { if msg == nil { return } - for _, f := range c.privateMessageHandlers { - func() { - defer func() { - if pan := recover(); pan != nil { - // - } - }() + for _, f := range c.eventHandlers.privateMessageHandlers { + cover(func() { f(c, msg) - }() + }) } } @@ -44,14 +75,40 @@ func (c *QQClient) dispatchGroupMessage(msg *message.GroupMessage) { if msg == nil { return } - for _, f := range c.groupMessageHandlers { - func() { - defer func() { - if pan := recover(); pan != nil { - // TODO: logger - } - }() + for _, f := range c.eventHandlers.groupMessageHandlers { + cover(func() { f(c, msg) - }() + }) } } + +func (c *QQClient) dispatchGroupMuteEvent(e *GroupMuteEvent) { + if e == nil { + return + } + for _, f := range c.eventHandlers.groupMuteEventHandlers { + cover(func() { + f(c, e) + }) + } +} + +func (c *QQClient) dispatchGroupMessageRecalledEvent(e *GroupMessageRecalledEvent) { + if e == nil { + return + } + for _, f := range c.eventHandlers.groupRecalledHandlers { + cover(func() { + f(c, e) + }) + } +} + +func cover(f func()) { + defer func() { + if pan := recover(); pan != nil { + + } + }() + f() +} diff --git a/client/pb/data.pb.go b/client/pb/data.pb.go index 5ed55258..e7b804e3 100644 --- a/client/pb/data.pb.go +++ b/client/pb/data.pb.go @@ -1474,6 +1474,243 @@ func (x *MessageItem) GetSig() []byte { return nil } +type NotifyMsgBody struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OptMsgRecall *MessageRecallReminder `protobuf:"bytes,11,opt,name=optMsgRecall,proto3" json:"optMsgRecall,omitempty"` + ServiceType int32 `protobuf:"varint,13,opt,name=serviceType,proto3" json:"serviceType,omitempty"` +} + +func (x *NotifyMsgBody) Reset() { + *x = NotifyMsgBody{} + if protoimpl.UnsafeEnabled { + mi := &file_data_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NotifyMsgBody) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NotifyMsgBody) ProtoMessage() {} + +func (x *NotifyMsgBody) ProtoReflect() protoreflect.Message { + mi := &file_data_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 NotifyMsgBody.ProtoReflect.Descriptor instead. +func (*NotifyMsgBody) Descriptor() ([]byte, []int) { + return file_data_proto_rawDescGZIP(), []int{15} +} + +func (x *NotifyMsgBody) GetOptMsgRecall() *MessageRecallReminder { + if x != nil { + return x.OptMsgRecall + } + return nil +} + +func (x *NotifyMsgBody) GetServiceType() int32 { + if x != nil { + return x.ServiceType + } + return 0 +} + +type MessageRecallReminder struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uin int64 `protobuf:"varint,1,opt,name=uin,proto3" json:"uin,omitempty"` + Nickname []byte `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"` + RecalledMsgList []*RecalledMessageMeta `protobuf:"bytes,3,rep,name=recalledMsgList,proto3" json:"recalledMsgList,omitempty"` + ReminderContent []byte `protobuf:"bytes,4,opt,name=reminderContent,proto3" json:"reminderContent,omitempty"` + Userdef []byte `protobuf:"bytes,5,opt,name=userdef,proto3" json:"userdef,omitempty"` + GroupType int32 `protobuf:"varint,6,opt,name=groupType,proto3" json:"groupType,omitempty"` + OpType int32 `protobuf:"varint,7,opt,name=opType,proto3" json:"opType,omitempty"` +} + +func (x *MessageRecallReminder) Reset() { + *x = MessageRecallReminder{} + if protoimpl.UnsafeEnabled { + mi := &file_data_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageRecallReminder) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageRecallReminder) ProtoMessage() {} + +func (x *MessageRecallReminder) ProtoReflect() protoreflect.Message { + mi := &file_data_proto_msgTypes[16] + 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 MessageRecallReminder.ProtoReflect.Descriptor instead. +func (*MessageRecallReminder) Descriptor() ([]byte, []int) { + return file_data_proto_rawDescGZIP(), []int{16} +} + +func (x *MessageRecallReminder) GetUin() int64 { + if x != nil { + return x.Uin + } + return 0 +} + +func (x *MessageRecallReminder) GetNickname() []byte { + if x != nil { + return x.Nickname + } + return nil +} + +func (x *MessageRecallReminder) GetRecalledMsgList() []*RecalledMessageMeta { + if x != nil { + return x.RecalledMsgList + } + return nil +} + +func (x *MessageRecallReminder) GetReminderContent() []byte { + if x != nil { + return x.ReminderContent + } + return nil +} + +func (x *MessageRecallReminder) GetUserdef() []byte { + if x != nil { + return x.Userdef + } + return nil +} + +func (x *MessageRecallReminder) GetGroupType() int32 { + if x != nil { + return x.GroupType + } + return 0 +} + +func (x *MessageRecallReminder) GetOpType() int32 { + if x != nil { + return x.OpType + } + return 0 +} + +type RecalledMessageMeta struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Seq int32 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` + Time int32 `protobuf:"varint,2,opt,name=time,proto3" json:"time,omitempty"` + MsgRandom int32 `protobuf:"varint,3,opt,name=msgRandom,proto3" json:"msgRandom,omitempty"` + MsgType int32 `protobuf:"varint,4,opt,name=msgType,proto3" json:"msgType,omitempty"` + MsgFlag int32 `protobuf:"varint,5,opt,name=msgFlag,proto3" json:"msgFlag,omitempty"` + AuthorUin int64 `protobuf:"varint,6,opt,name=authorUin,proto3" json:"authorUin,omitempty"` +} + +func (x *RecalledMessageMeta) Reset() { + *x = RecalledMessageMeta{} + if protoimpl.UnsafeEnabled { + mi := &file_data_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RecalledMessageMeta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecalledMessageMeta) ProtoMessage() {} + +func (x *RecalledMessageMeta) ProtoReflect() protoreflect.Message { + mi := &file_data_proto_msgTypes[17] + 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 RecalledMessageMeta.ProtoReflect.Descriptor instead. +func (*RecalledMessageMeta) Descriptor() ([]byte, []int) { + return file_data_proto_rawDescGZIP(), []int{17} +} + +func (x *RecalledMessageMeta) GetSeq() int32 { + if x != nil { + return x.Seq + } + return 0 +} + +func (x *RecalledMessageMeta) GetTime() int32 { + if x != nil { + return x.Time + } + return 0 +} + +func (x *RecalledMessageMeta) GetMsgRandom() int32 { + if x != nil { + return x.MsgRandom + } + return 0 +} + +func (x *RecalledMessageMeta) GetMsgType() int32 { + if x != nil { + return x.MsgType + } + return 0 +} + +func (x *RecalledMessageMeta) GetMsgFlag() int32 { + if x != nil { + return x.MsgFlag + } + return 0 +} + +func (x *RecalledMessageMeta) GetAuthorUin() int64 { + if x != nil { + return x.AuthorUin + } + return 0 +} + var File_data_proto protoreflect.FileDescriptor var file_data_proto_rawDesc = []byte{ @@ -1700,8 +1937,42 @@ var file_data_proto_rawDesc = []byte{ 0x01, 0x28, 0x05, 0x52, 0x06, 0x6d, 0x73, 0x67, 0x53, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x73, 0x67, 0x55, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x73, 0x67, 0x55, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x03, 0x73, 0x69, 0x67, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x03, 0x73, 0x69, 0x67, 0x22, 0x6d, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4d, + 0x73, 0x67, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3a, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x63, 0x61, 0x6c, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x63, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6d, 0x69, + 0x6e, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x6f, 0x70, 0x74, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x63, 0x61, + 0x6c, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x22, 0xff, 0x01, 0x0a, 0x15, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x63, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x6e, + 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x0f, + 0x72, 0x65, 0x63, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x52, 0x65, 0x63, 0x61, 0x6c, 0x6c, 0x65, 0x64, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x0f, 0x72, 0x65, 0x63, + 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, + 0x72, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x72, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x65, 0x72, 0x43, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x64, 0x65, + 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x64, 0x65, 0x66, + 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, + 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x63, 0x61, 0x6c, + 0x6c, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x10, + 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x65, 0x71, + 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, + 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x52, 0x61, 0x6e, 0x64, 0x6f, + 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6d, 0x73, 0x67, 0x52, 0x61, 0x6e, 0x64, + 0x6f, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x6d, 0x73, 0x67, 0x46, 0x6c, 0x61, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, + 0x73, 0x67, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x55, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x55, 0x69, 0x6e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1716,23 +1987,26 @@ func file_data_proto_rawDescGZIP() []byte { return file_data_proto_rawDescData } -var file_data_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_data_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_data_proto_goTypes = []interface{}{ - (*DeviceInfo)(nil), // 0: DeviceInfo - (*RequestBody)(nil), // 1: RequestBody - (*ConfigSeq)(nil), // 2: ConfigSeq - (*D50ReqBody)(nil), // 3: D50ReqBody - (*D388ReqBody)(nil), // 4: D388ReqBody - (*D388RespBody)(nil), // 5: D388RespBody - (*ReqDataHighwayHead)(nil), // 6: ReqDataHighwayHead - (*RspDataHighwayHead)(nil), // 7: RspDataHighwayHead - (*DataHighwayHead)(nil), // 8: DataHighwayHead - (*SegHead)(nil), // 9: SegHead - (*TryUpImgReq)(nil), // 10: TryUpImgReq - (*TryUpImgResp)(nil), // 11: TryUpImgResp - (*ImgInfo)(nil), // 12: ImgInfo - (*DeleteMessageRequest)(nil), // 13: DeleteMessageRequest - (*MessageItem)(nil), // 14: MessageItem + (*DeviceInfo)(nil), // 0: DeviceInfo + (*RequestBody)(nil), // 1: RequestBody + (*ConfigSeq)(nil), // 2: ConfigSeq + (*D50ReqBody)(nil), // 3: D50ReqBody + (*D388ReqBody)(nil), // 4: D388ReqBody + (*D388RespBody)(nil), // 5: D388RespBody + (*ReqDataHighwayHead)(nil), // 6: ReqDataHighwayHead + (*RspDataHighwayHead)(nil), // 7: RspDataHighwayHead + (*DataHighwayHead)(nil), // 8: DataHighwayHead + (*SegHead)(nil), // 9: SegHead + (*TryUpImgReq)(nil), // 10: TryUpImgReq + (*TryUpImgResp)(nil), // 11: TryUpImgResp + (*ImgInfo)(nil), // 12: ImgInfo + (*DeleteMessageRequest)(nil), // 13: DeleteMessageRequest + (*MessageItem)(nil), // 14: MessageItem + (*NotifyMsgBody)(nil), // 15: NotifyMsgBody + (*MessageRecallReminder)(nil), // 16: MessageRecallReminder + (*RecalledMessageMeta)(nil), // 17: RecalledMessageMeta } var file_data_proto_depIdxs = []int32{ 2, // 0: RequestBody.rpt_config_list:type_name -> ConfigSeq @@ -1744,11 +2018,13 @@ var file_data_proto_depIdxs = []int32{ 9, // 6: RspDataHighwayHead.msgSeghead:type_name -> SegHead 12, // 7: TryUpImgResp.msgImgInfo:type_name -> ImgInfo 14, // 8: DeleteMessageRequest.items:type_name -> MessageItem - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 16, // 9: NotifyMsgBody.optMsgRecall:type_name -> MessageRecallReminder + 17, // 10: MessageRecallReminder.recalledMsgList:type_name -> RecalledMessageMeta + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_data_proto_init() } @@ -1937,6 +2213,42 @@ func file_data_proto_init() { return nil } } + file_data_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NotifyMsgBody); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_data_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageRecallReminder); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_data_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RecalledMessageMeta); 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{ @@ -1944,7 +2256,7 @@ func file_data_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_data_proto_rawDesc, NumEnums: 0, - NumMessages: 15, + NumMessages: 18, NumExtensions: 0, NumServices: 0, }, diff --git a/client/pb/data.proto b/client/pb/data.proto index 6ffb1700..a9227630 100644 --- a/client/pb/data.proto +++ b/client/pb/data.proto @@ -154,4 +154,29 @@ message MessageItem { int32 msgSeq = 4; int64 msgUid = 5; bytes sig = 7; +} + +message NotifyMsgBody { + MessageRecallReminder optMsgRecall = 11; + int32 serviceType = 13; +} + +message MessageRecallReminder { + int64 uin = 1; + bytes nickname = 2; + repeated RecalledMessageMeta recalledMsgList = 3; + bytes reminderContent = 4; + bytes userdef = 5; + int32 groupType = 6; + int32 opType = 7; + +} + +message RecalledMessageMeta { + int32 seq = 1; + int32 time = 2; + int32 msgRandom = 3; + int32 msgType = 4; + int32 msgFlag = 5; + int64 authorUin = 6; } \ No newline at end of file