From 31424dec79b144f09815ccfdebeb060b5c467760 Mon Sep 17 00:00:00 2001 From: Mrs4s <1844812067@qq.com> Date: Sat, 30 Jan 2021 18:36:57 +0800 Subject: [PATCH] fix sync. --- binary/jce/structs.go | 12 +- binary/jce/writer.go | 5 +- client/client.go | 12 + client/decoders.go | 126 +---- client/pb/msf/register_proxy.pb.go | 791 +++++++++++++++++++++++++++++ client/pb/msf/register_proxy.proto | 59 +++ client/pb/oidb/oidb0xd79.pb.go | 72 +-- client/sync.go | 295 ++++++++++- 8 files changed, 1205 insertions(+), 167 deletions(-) create mode 100644 client/pb/msf/register_proxy.pb.go create mode 100644 client/pb/msf/register_proxy.proto diff --git a/binary/jce/structs.go b/binary/jce/structs.go index b1cd22dc..52c07470 100644 --- a/binary/jce/structs.go +++ b/binary/jce/structs.go @@ -138,11 +138,13 @@ type ( SvcReqRegisterNew struct { IJceStruct - RequestOptional int64 `jceId:"0"` - C2CMsg IJceStruct `jceId:"1"` // SvcReqGetMsgV2 - GroupMsg IJceStruct `jceId:"2"` // SvcReqPullGroupMsgSeq - GroupMask byte `jceId:"15"` - EndSeq int64 `jceId:"16"` + RequestOptional int64 `jceId:"0"` + C2CMsg IJceStruct `jceId:"1"` // SvcReqGetMsgV2 + GroupMsg IJceStruct `jceId:"2"` // SvcReqPullGroupMsgSeq + DisGroupMsgFilter byte `jceId:"14"` + GroupMask byte `jceId:"15"` + EndSeq int64 `jceId:"16"` + O769Body []byte `jceId:"20"` } SvcReqGetMsgV2 struct { diff --git a/binary/jce/writer.go b/binary/jce/writer.go index e86a6756..b6728b82 100644 --- a/binary/jce/writer.go +++ b/binary/jce/writer.go @@ -214,7 +214,10 @@ func (w *JceWriter) WriteJceStructRaw(s IJceStruct) { if err != nil { continue } - w.WriteObject(v.Field(i).Interface(), id) + obj := v.Field(i).Interface() + if obj != nil { + w.WriteObject(v.Field(i).Interface(), id) + } } } diff --git a/client/client.go b/client/client.go index b91fab45..0ed50ffa 100644 --- a/client/client.go +++ b/client/client.go @@ -52,6 +52,7 @@ type QQClient struct { ConnectTime time.Time handlers HandlerMap + waiters sync.Map servers []*net.TCPAddr currServerIndex int retryTimes int @@ -825,6 +826,15 @@ func (c *QQClient) sendAndWait(seq uint16, pkt []byte) (interface{}, error) { return nil, nil } +// 等待一个或多个数据包解析, 优先级低于 sendAndWait +// 返回终止解析函数 +func (c *QQClient) waitPacket(cmd string, f func(interface{}, error)) func() { + c.waiters.Store(cmd, f) + return func() { + c.waiters.Delete(cmd) + } +} + func (c *QQClient) netLoop() { if c.NetLooping { return @@ -902,6 +912,8 @@ func (c *QQClient) netLoop() { } if f, ok := c.handlers.LoadAndDelete(pkt.SequenceId); ok { f(rsp, err) + } else if f, ok := c.waiters.Load(pkt.CommandName); ok { // 在不存在handler的情况下触发wait + f.(func(interface{}, error))(rsp, err) } } else if f, ok := c.handlers.LoadAndDelete(pkt.SequenceId); ok { // does not need decoder diff --git a/client/decoders.go b/client/decoders.go index d076e0dc..03872122 100644 --- a/client/decoders.go +++ b/client/decoders.go @@ -11,7 +11,6 @@ import ( "strconv" "strings" "sync" - "sync/atomic" "time" "github.com/Mrs4s/MiraiGo/client/pb/notify" @@ -296,127 +295,8 @@ func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{}, if err != nil { return nil, errors.Wrap(err, "failed to unmarshal protobuf message") } - if rsp.GetResult() != 0 { - return nil, errors.New("message svc result unsuccessful") - } - c.syncCookie = rsp.SyncCookie - c.pubAccountCookie = rsp.PubAccountCookie - c.msgCtrlBuf = rsp.MsgCtrlBuf - if rsp.UinPairMsgs == nil { - return nil, nil - } - var delItems []*pb.MessageItem - for _, pairMsg := range rsp.UinPairMsgs { - for _, message := range pairMsg.Messages { - // delete message - delItem := &pb.MessageItem{ - FromUin: message.Head.GetFromUin(), - ToUin: message.Head.GetToUin(), - MsgType: 187, - MsgSeq: message.Head.GetMsgSeq(), - MsgUid: message.Head.GetMsgUid(), - } - delItems = append(delItems, delItem) - if message.Head.GetToUin() != c.Uin { - continue - } - if (int64(pairMsg.GetLastReadTime()) & 4294967295) > int64(message.Head.GetMsgTime()) { - continue - } - strKey := fmt.Sprintf("%d%d%d%d", message.Head.FromUin, message.Head.ToUin, message.Head.MsgSeq, message.Head.MsgUid) - if _, ok := c.msgSvcCache.Get(strKey); ok { - continue - } - c.msgSvcCache.Add(strKey, "", time.Minute) - switch message.Head.GetMsgType() { - case 33: // 加群同步 - func() { - groupJoinLock.Lock() - defer groupJoinLock.Unlock() - group := c.FindGroupByUin(message.Head.GetFromUin()) - if message.Head.GetAuthUin() == c.Uin { - if group == nil && c.ReloadGroupList() == nil { - c.dispatchJoinGroupEvent(c.FindGroupByUin(message.Head.GetFromUin())) - } - } else { - if group != nil && group.FindMember(message.Head.GetAuthUin()) == nil { - mem, err := c.getMemberInfo(group.Code, message.Head.GetAuthUin()) - if err != nil { - c.Debug("error to fetch new member info: %v", err) - return - } - group.Update(func(info *GroupInfo) { - info.Members = append(info.Members, mem) - }) - c.dispatchNewMemberEvent(&MemberJoinGroupEvent{ - Group: group, - Member: mem, - }) - } - } - }() - case 84, 87: - c.exceptAndDispatchGroupSysMsg() - case 141: // 临时会话 - if message.Head.C2CTmpMsgHead == nil { - continue - } - group := c.FindGroupByUin(message.Head.C2CTmpMsgHead.GetGroupUin()) - if group == nil { - continue - } - if message.Head.GetFromUin() == c.Uin { - continue - } - c.dispatchTempMessage(c.parseTempMessage(message)) - case 166, 208: // 好友消息 - if message.Head.GetFromUin() == c.Uin { - for { - frdSeq := atomic.LoadInt32(&c.friendSeq) - if frdSeq < message.Head.GetMsgSeq() { - if atomic.CompareAndSwapInt32(&c.friendSeq, frdSeq, message.Head.GetMsgSeq()) { - break - } - } else { - break - } - } - } - if message.Body.RichText == nil || message.Body.RichText.Elems == nil { - continue - } - c.dispatchFriendMessage(c.parsePrivateMessage(message)) - case 187: - _, pkt := c.buildSystemMsgNewFriendPacket() - _ = c.send(pkt) - case 529: - sub4 := msg.SubMsgType0X4Body{} - if err := proto.Unmarshal(message.Body.MsgContent, &sub4); err != nil { - err = errors.Wrap(err, "unmarshal sub msg 0x4 error") - c.Error("unmarshal sub msg 0x4 error: %v", err) - continue - } - if sub4.NotOnlineFile != nil { - rsp, err := c.sendAndWait(c.buildOfflineFileDownloadRequestPacket(sub4.NotOnlineFile.FileUuid)) // offline_file.go - if err != nil { - continue - } - c.dispatchOfflineFileEvent(&OfflineFileEvent{ - FileName: string(sub4.NotOnlineFile.FileName), - FileSize: sub4.NotOnlineFile.GetFileSize(), - Sender: message.Head.GetFromUin(), - DownloadUrl: rsp.(string), - }) - } - } - } - } - _, _ = c.sendAndWait(c.buildDeleteMessageRequestPacket(delItems)) - if rsp.GetSyncFlag() != msg.SyncFlag_STOP { - c.Debug("continue sync with flag: %v", rsp.SyncFlag.String()) - _, _ = c.sendAndWait(c.buildGetMessageRequestPacket(rsp.GetSyncFlag(), time.Now().Unix())) - } - return nil, err + c.c2cMessageSyncProcessor(&rsp) + return nil, nil } // MessageSvc.PushNotify @@ -576,7 +456,7 @@ func decodeGroupMemberInfoResponse(c *QQClient, _ uint16, payload []byte) (inter if err := proto.Unmarshal(payload, &rsp); err != nil { return nil, errors.Wrap(err, "failed to unmarshal protobuf message") } - if rsp.MemInfo.Nick == nil && rsp.MemInfo.Age == 0 { + if rsp.MemInfo == nil || (rsp.MemInfo.Nick == nil && rsp.MemInfo.Age == 0) { return nil, errors.WithStack(ErrMemberNotFound) } group := c.FindGroup(rsp.GroupCode) diff --git a/client/pb/msf/register_proxy.pb.go b/client/pb/msf/register_proxy.pb.go new file mode 100644 index 00000000..daef5d70 --- /dev/null +++ b/client/pb/msf/register_proxy.pb.go @@ -0,0 +1,791 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.11.4 +// source: register_proxy.proto + +package msf + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type DiscussList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DiscussCode *uint64 `protobuf:"varint,1,opt,name=discussCode" json:"discussCode,omitempty"` + DiscussSeq *uint64 `protobuf:"varint,2,opt,name=discussSeq" json:"discussSeq,omitempty"` + MemberSeq *uint64 `protobuf:"varint,3,opt,name=memberSeq" json:"memberSeq,omitempty"` + InfoSeq *uint64 `protobuf:"varint,4,opt,name=infoSeq" json:"infoSeq,omitempty"` + BHotGroup *bool `protobuf:"varint,5,opt,name=bHotGroup" json:"bHotGroup,omitempty"` + RedpackTime *uint64 `protobuf:"varint,6,opt,name=redpackTime" json:"redpackTime,omitempty"` + HasMsg *bool `protobuf:"varint,7,opt,name=hasMsg" json:"hasMsg,omitempty"` + DicussFlag *int64 `protobuf:"varint,8,opt,name=dicussFlag" json:"dicussFlag,omitempty"` +} + +func (x *DiscussList) Reset() { + *x = DiscussList{} + if protoimpl.UnsafeEnabled { + mi := &file_register_proxy_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DiscussList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DiscussList) ProtoMessage() {} + +func (x *DiscussList) ProtoReflect() protoreflect.Message { + mi := &file_register_proxy_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 DiscussList.ProtoReflect.Descriptor instead. +func (*DiscussList) Descriptor() ([]byte, []int) { + return file_register_proxy_proto_rawDescGZIP(), []int{0} +} + +func (x *DiscussList) GetDiscussCode() uint64 { + if x != nil && x.DiscussCode != nil { + return *x.DiscussCode + } + return 0 +} + +func (x *DiscussList) GetDiscussSeq() uint64 { + if x != nil && x.DiscussSeq != nil { + return *x.DiscussSeq + } + return 0 +} + +func (x *DiscussList) GetMemberSeq() uint64 { + if x != nil && x.MemberSeq != nil { + return *x.MemberSeq + } + return 0 +} + +func (x *DiscussList) GetInfoSeq() uint64 { + if x != nil && x.InfoSeq != nil { + return *x.InfoSeq + } + return 0 +} + +func (x *DiscussList) GetBHotGroup() bool { + if x != nil && x.BHotGroup != nil { + return *x.BHotGroup + } + return false +} + +func (x *DiscussList) GetRedpackTime() uint64 { + if x != nil && x.RedpackTime != nil { + return *x.RedpackTime + } + return 0 +} + +func (x *DiscussList) GetHasMsg() bool { + if x != nil && x.HasMsg != nil { + return *x.HasMsg + } + return false +} + +func (x *DiscussList) GetDicussFlag() int64 { + if x != nil && x.DicussFlag != nil { + return *x.DicussFlag + } + return 0 +} + +type GroupList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GroupCode *uint64 `protobuf:"varint,1,opt,name=groupCode" json:"groupCode,omitempty"` + GroupSeq *uint64 `protobuf:"varint,2,opt,name=groupSeq" json:"groupSeq,omitempty"` + MemberSeq *uint64 `protobuf:"varint,3,opt,name=memberSeq" json:"memberSeq,omitempty"` + Mask *uint64 `protobuf:"varint,4,opt,name=mask" json:"mask,omitempty"` + RedpackTime *uint64 `protobuf:"varint,5,opt,name=redpackTime" json:"redpackTime,omitempty"` + HasMsg *bool `protobuf:"varint,6,opt,name=hasMsg" json:"hasMsg,omitempty"` + GroupFlag *int64 `protobuf:"varint,7,opt,name=groupFlag" json:"groupFlag,omitempty"` + GroupType *uint64 `protobuf:"varint,8,opt,name=groupType" json:"groupType,omitempty"` + GroupNameSeq *uint32 `protobuf:"varint,9,opt,name=groupNameSeq" json:"groupNameSeq,omitempty"` + GroupMemberSeq *uint32 `protobuf:"varint,10,opt,name=groupMemberSeq" json:"groupMemberSeq,omitempty"` + UinFlagEx2 *uint32 `protobuf:"varint,11,opt,name=uinFlagEx2" json:"uinFlagEx2,omitempty"` + ImportantMsgLatestSeq *uint32 `protobuf:"varint,12,opt,name=importantMsgLatestSeq" json:"importantMsgLatestSeq,omitempty"` +} + +func (x *GroupList) Reset() { + *x = GroupList{} + if protoimpl.UnsafeEnabled { + mi := &file_register_proxy_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GroupList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GroupList) ProtoMessage() {} + +func (x *GroupList) ProtoReflect() protoreflect.Message { + mi := &file_register_proxy_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 GroupList.ProtoReflect.Descriptor instead. +func (*GroupList) Descriptor() ([]byte, []int) { + return file_register_proxy_proto_rawDescGZIP(), []int{1} +} + +func (x *GroupList) GetGroupCode() uint64 { + if x != nil && x.GroupCode != nil { + return *x.GroupCode + } + return 0 +} + +func (x *GroupList) GetGroupSeq() uint64 { + if x != nil && x.GroupSeq != nil { + return *x.GroupSeq + } + return 0 +} + +func (x *GroupList) GetMemberSeq() uint64 { + if x != nil && x.MemberSeq != nil { + return *x.MemberSeq + } + return 0 +} + +func (x *GroupList) GetMask() uint64 { + if x != nil && x.Mask != nil { + return *x.Mask + } + return 0 +} + +func (x *GroupList) GetRedpackTime() uint64 { + if x != nil && x.RedpackTime != nil { + return *x.RedpackTime + } + return 0 +} + +func (x *GroupList) GetHasMsg() bool { + if x != nil && x.HasMsg != nil { + return *x.HasMsg + } + return false +} + +func (x *GroupList) GetGroupFlag() int64 { + if x != nil && x.GroupFlag != nil { + return *x.GroupFlag + } + return 0 +} + +func (x *GroupList) GetGroupType() uint64 { + if x != nil && x.GroupType != nil { + return *x.GroupType + } + return 0 +} + +func (x *GroupList) GetGroupNameSeq() uint32 { + if x != nil && x.GroupNameSeq != nil { + return *x.GroupNameSeq + } + return 0 +} + +func (x *GroupList) GetGroupMemberSeq() uint32 { + if x != nil && x.GroupMemberSeq != nil { + return *x.GroupMemberSeq + } + return 0 +} + +func (x *GroupList) GetUinFlagEx2() uint32 { + if x != nil && x.UinFlagEx2 != nil { + return *x.UinFlagEx2 + } + return 0 +} + +func (x *GroupList) GetImportantMsgLatestSeq() uint32 { + if x != nil && x.ImportantMsgLatestSeq != nil { + return *x.ImportantMsgLatestSeq + } + return 0 +} + +type SvcPbResponsePullDisMsgProxy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MemberSeq *uint64 `protobuf:"varint,1,opt,name=memberSeq" json:"memberSeq,omitempty"` + Content []byte `protobuf:"bytes,2,opt,name=content" json:"content,omitempty"` +} + +func (x *SvcPbResponsePullDisMsgProxy) Reset() { + *x = SvcPbResponsePullDisMsgProxy{} + if protoimpl.UnsafeEnabled { + mi := &file_register_proxy_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SvcPbResponsePullDisMsgProxy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SvcPbResponsePullDisMsgProxy) ProtoMessage() {} + +func (x *SvcPbResponsePullDisMsgProxy) ProtoReflect() protoreflect.Message { + mi := &file_register_proxy_proto_msgTypes[2] + 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 SvcPbResponsePullDisMsgProxy.ProtoReflect.Descriptor instead. +func (*SvcPbResponsePullDisMsgProxy) Descriptor() ([]byte, []int) { + return file_register_proxy_proto_rawDescGZIP(), []int{2} +} + +func (x *SvcPbResponsePullDisMsgProxy) GetMemberSeq() uint64 { + if x != nil && x.MemberSeq != nil { + return *x.MemberSeq + } + return 0 +} + +func (x *SvcPbResponsePullDisMsgProxy) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +type SvcRegisterProxyMsgResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Result *uint32 `protobuf:"varint,1,opt,name=result" json:"result,omitempty"` + ErrMsg []byte `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` + Flag *uint32 `protobuf:"varint,3,opt,name=flag" json:"flag,omitempty"` + Seq *uint32 `protobuf:"varint,4,opt,name=seq" json:"seq,omitempty"` + Info *SvcResponseMsgInfo `protobuf:"bytes,5,opt,name=info" json:"info,omitempty"` + GroupList []*GroupList `protobuf:"bytes,6,rep,name=groupList" json:"groupList,omitempty"` + DiscussList []*DiscussList `protobuf:"bytes,7,rep,name=discussList" json:"discussList,omitempty"` + GroupMsg []*SvcResponsePbPullGroupMsgProxy `protobuf:"bytes,8,rep,name=groupMsg" json:"groupMsg,omitempty"` + DiscussMsg []*SvcPbResponsePullDisMsgProxy `protobuf:"bytes,9,rep,name=discussMsg" json:"discussMsg,omitempty"` + C2CMsg []byte `protobuf:"bytes,10,opt,name=c2CMsg" json:"c2CMsg,omitempty"` + PubAccountMsg []byte `protobuf:"bytes,11,opt,name=pubAccountMsg" json:"pubAccountMsg,omitempty"` + DiscussListFlag *uint32 `protobuf:"varint,12,opt,name=discussListFlag" json:"discussListFlag,omitempty"` +} + +func (x *SvcRegisterProxyMsgResp) Reset() { + *x = SvcRegisterProxyMsgResp{} + if protoimpl.UnsafeEnabled { + mi := &file_register_proxy_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SvcRegisterProxyMsgResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SvcRegisterProxyMsgResp) ProtoMessage() {} + +func (x *SvcRegisterProxyMsgResp) ProtoReflect() protoreflect.Message { + mi := &file_register_proxy_proto_msgTypes[3] + 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 SvcRegisterProxyMsgResp.ProtoReflect.Descriptor instead. +func (*SvcRegisterProxyMsgResp) Descriptor() ([]byte, []int) { + return file_register_proxy_proto_rawDescGZIP(), []int{3} +} + +func (x *SvcRegisterProxyMsgResp) GetResult() uint32 { + if x != nil && x.Result != nil { + return *x.Result + } + return 0 +} + +func (x *SvcRegisterProxyMsgResp) GetErrMsg() []byte { + if x != nil { + return x.ErrMsg + } + return nil +} + +func (x *SvcRegisterProxyMsgResp) GetFlag() uint32 { + if x != nil && x.Flag != nil { + return *x.Flag + } + return 0 +} + +func (x *SvcRegisterProxyMsgResp) GetSeq() uint32 { + if x != nil && x.Seq != nil { + return *x.Seq + } + return 0 +} + +func (x *SvcRegisterProxyMsgResp) GetInfo() *SvcResponseMsgInfo { + if x != nil { + return x.Info + } + return nil +} + +func (x *SvcRegisterProxyMsgResp) GetGroupList() []*GroupList { + if x != nil { + return x.GroupList + } + return nil +} + +func (x *SvcRegisterProxyMsgResp) GetDiscussList() []*DiscussList { + if x != nil { + return x.DiscussList + } + return nil +} + +func (x *SvcRegisterProxyMsgResp) GetGroupMsg() []*SvcResponsePbPullGroupMsgProxy { + if x != nil { + return x.GroupMsg + } + return nil +} + +func (x *SvcRegisterProxyMsgResp) GetDiscussMsg() []*SvcPbResponsePullDisMsgProxy { + if x != nil { + return x.DiscussMsg + } + return nil +} + +func (x *SvcRegisterProxyMsgResp) GetC2CMsg() []byte { + if x != nil { + return x.C2CMsg + } + return nil +} + +func (x *SvcRegisterProxyMsgResp) GetPubAccountMsg() []byte { + if x != nil { + return x.PubAccountMsg + } + return nil +} + +func (x *SvcRegisterProxyMsgResp) GetDiscussListFlag() uint32 { + if x != nil && x.DiscussListFlag != nil { + return *x.DiscussListFlag + } + return 0 +} + +type SvcResponseMsgInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GroupNum *uint32 `protobuf:"varint,1,opt,name=groupNum" json:"groupNum,omitempty"` + DiscussNum *uint32 `protobuf:"varint,2,opt,name=discussNum" json:"discussNum,omitempty"` +} + +func (x *SvcResponseMsgInfo) Reset() { + *x = SvcResponseMsgInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_register_proxy_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SvcResponseMsgInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SvcResponseMsgInfo) ProtoMessage() {} + +func (x *SvcResponseMsgInfo) ProtoReflect() protoreflect.Message { + mi := &file_register_proxy_proto_msgTypes[4] + 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 SvcResponseMsgInfo.ProtoReflect.Descriptor instead. +func (*SvcResponseMsgInfo) Descriptor() ([]byte, []int) { + return file_register_proxy_proto_rawDescGZIP(), []int{4} +} + +func (x *SvcResponseMsgInfo) GetGroupNum() uint32 { + if x != nil && x.GroupNum != nil { + return *x.GroupNum + } + return 0 +} + +func (x *SvcResponseMsgInfo) GetDiscussNum() uint32 { + if x != nil && x.DiscussNum != nil { + return *x.DiscussNum + } + return 0 +} + +type SvcResponsePbPullGroupMsgProxy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MemberSeq *uint64 `protobuf:"varint,1,opt,name=memberSeq" json:"memberSeq,omitempty"` + Content []byte `protobuf:"bytes,2,opt,name=content" json:"content,omitempty"` +} + +func (x *SvcResponsePbPullGroupMsgProxy) Reset() { + *x = SvcResponsePbPullGroupMsgProxy{} + if protoimpl.UnsafeEnabled { + mi := &file_register_proxy_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SvcResponsePbPullGroupMsgProxy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SvcResponsePbPullGroupMsgProxy) ProtoMessage() {} + +func (x *SvcResponsePbPullGroupMsgProxy) ProtoReflect() protoreflect.Message { + mi := &file_register_proxy_proto_msgTypes[5] + 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 SvcResponsePbPullGroupMsgProxy.ProtoReflect.Descriptor instead. +func (*SvcResponsePbPullGroupMsgProxy) Descriptor() ([]byte, []int) { + return file_register_proxy_proto_rawDescGZIP(), []int{5} +} + +func (x *SvcResponsePbPullGroupMsgProxy) GetMemberSeq() uint64 { + if x != nil && x.MemberSeq != nil { + return *x.MemberSeq + } + return 0 +} + +func (x *SvcResponsePbPullGroupMsgProxy) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +var File_register_proxy_proto protoreflect.FileDescriptor + +var file_register_proxy_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xff, 0x01, 0x0a, 0x0b, 0x44, 0x69, 0x73, 0x63, 0x75, + 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x63, 0x75, 0x73, + 0x73, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x64, 0x69, 0x73, + 0x63, 0x75, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x73, 0x63, + 0x75, 0x73, 0x73, 0x53, 0x65, 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x64, 0x69, + 0x73, 0x63, 0x75, 0x73, 0x73, 0x53, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x53, 0x65, 0x71, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x53, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6e, 0x66, 0x6f, 0x53, 0x65, + 0x71, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x69, 0x6e, 0x66, 0x6f, 0x53, 0x65, 0x71, + 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x48, 0x6f, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x62, 0x48, 0x6f, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x20, + 0x0a, 0x0b, 0x72, 0x65, 0x64, 0x70, 0x61, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x70, 0x61, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x68, 0x61, 0x73, 0x4d, 0x73, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x06, 0x68, 0x61, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x63, 0x75, + 0x73, 0x73, 0x46, 0x6c, 0x61, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x64, 0x69, + 0x63, 0x75, 0x73, 0x73, 0x46, 0x6c, 0x61, 0x67, 0x22, 0x8f, 0x03, 0x0a, 0x09, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x43, + 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x65, 0x71, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x65, 0x71, + 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x53, 0x65, 0x71, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x09, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x53, 0x65, 0x71, 0x12, 0x12, + 0x0a, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x6d, 0x61, + 0x73, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x64, 0x70, 0x61, 0x63, 0x6b, 0x54, 0x69, 0x6d, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x70, 0x61, 0x63, 0x6b, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x61, 0x73, 0x4d, 0x73, 0x67, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x68, 0x61, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x1c, 0x0a, 0x09, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x6c, 0x61, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x54, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x71, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x0e, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x53, 0x65, 0x71, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x53, 0x65, 0x71, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x69, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x45, + 0x78, 0x32, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x75, 0x69, 0x6e, 0x46, 0x6c, 0x61, + 0x67, 0x45, 0x78, 0x32, 0x12, 0x34, 0x0a, 0x15, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6e, + 0x74, 0x4d, 0x73, 0x67, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x65, 0x71, 0x18, 0x0c, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x15, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6e, 0x74, 0x4d, 0x73, + 0x67, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x65, 0x71, 0x22, 0x56, 0x0a, 0x1c, 0x53, 0x76, + 0x63, 0x50, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x75, 0x6c, 0x6c, 0x44, + 0x69, 0x73, 0x4d, 0x73, 0x67, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x53, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x53, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x22, 0xd6, 0x03, 0x0a, 0x17, 0x53, 0x76, 0x63, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x65, 0x72, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, + 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, + 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x12, + 0x0a, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x66, 0x6c, + 0x61, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x03, 0x73, 0x65, 0x71, 0x12, 0x27, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x53, 0x76, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x28, 0x0a, + 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0a, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x09, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x63, 0x75, + 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, + 0x69, 0x73, 0x63, 0x75, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x63, + 0x75, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x4d, 0x73, 0x67, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x53, 0x76, 0x63, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x62, 0x50, 0x75, 0x6c, 0x6c, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x4d, 0x73, 0x67, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x4d, 0x73, 0x67, 0x12, 0x3d, 0x0a, 0x0a, 0x64, 0x69, 0x73, 0x63, 0x75, 0x73, 0x73, 0x4d, + 0x73, 0x67, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x53, 0x76, 0x63, 0x50, 0x62, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x75, 0x6c, 0x6c, 0x44, 0x69, 0x73, 0x4d, + 0x73, 0x67, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x0a, 0x64, 0x69, 0x73, 0x63, 0x75, 0x73, 0x73, + 0x4d, 0x73, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x32, 0x43, 0x4d, 0x73, 0x67, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x32, 0x43, 0x4d, 0x73, 0x67, 0x12, 0x24, 0x0a, 0x0d, 0x70, + 0x75, 0x62, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4d, 0x73, 0x67, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x0d, 0x70, 0x75, 0x62, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4d, 0x73, + 0x67, 0x12, 0x28, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x63, 0x75, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, + 0x46, 0x6c, 0x61, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x64, 0x69, 0x73, 0x63, + 0x75, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x6c, 0x61, 0x67, 0x22, 0x50, 0x0a, 0x12, 0x53, + 0x76, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x75, 0x6d, 0x12, 0x1e, 0x0a, + 0x0a, 0x64, 0x69, 0x73, 0x63, 0x75, 0x73, 0x73, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0a, 0x64, 0x69, 0x73, 0x63, 0x75, 0x73, 0x73, 0x4e, 0x75, 0x6d, 0x22, 0x58, 0x0a, + 0x1e, 0x53, 0x76, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x62, 0x50, 0x75, + 0x6c, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x73, 0x67, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, + 0x1c, 0x0a, 0x09, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x53, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x09, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x53, 0x65, 0x71, 0x12, 0x18, 0x0a, + 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x42, 0x07, 0x5a, 0x05, 0x2e, 0x3b, 0x6d, 0x73, 0x66, +} + +var ( + file_register_proxy_proto_rawDescOnce sync.Once + file_register_proxy_proto_rawDescData = file_register_proxy_proto_rawDesc +) + +func file_register_proxy_proto_rawDescGZIP() []byte { + file_register_proxy_proto_rawDescOnce.Do(func() { + file_register_proxy_proto_rawDescData = protoimpl.X.CompressGZIP(file_register_proxy_proto_rawDescData) + }) + return file_register_proxy_proto_rawDescData +} + +var file_register_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_register_proxy_proto_goTypes = []interface{}{ + (*DiscussList)(nil), // 0: DiscussList + (*GroupList)(nil), // 1: GroupList + (*SvcPbResponsePullDisMsgProxy)(nil), // 2: SvcPbResponsePullDisMsgProxy + (*SvcRegisterProxyMsgResp)(nil), // 3: SvcRegisterProxyMsgResp + (*SvcResponseMsgInfo)(nil), // 4: SvcResponseMsgInfo + (*SvcResponsePbPullGroupMsgProxy)(nil), // 5: SvcResponsePbPullGroupMsgProxy +} +var file_register_proxy_proto_depIdxs = []int32{ + 4, // 0: SvcRegisterProxyMsgResp.info:type_name -> SvcResponseMsgInfo + 1, // 1: SvcRegisterProxyMsgResp.groupList:type_name -> GroupList + 0, // 2: SvcRegisterProxyMsgResp.discussList:type_name -> DiscussList + 5, // 3: SvcRegisterProxyMsgResp.groupMsg:type_name -> SvcResponsePbPullGroupMsgProxy + 2, // 4: SvcRegisterProxyMsgResp.discussMsg:type_name -> SvcPbResponsePullDisMsgProxy + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_register_proxy_proto_init() } +func file_register_proxy_proto_init() { + if File_register_proxy_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_register_proxy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DiscussList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_register_proxy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GroupList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_register_proxy_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SvcPbResponsePullDisMsgProxy); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_register_proxy_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SvcRegisterProxyMsgResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_register_proxy_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SvcResponseMsgInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_register_proxy_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SvcResponsePbPullGroupMsgProxy); 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_register_proxy_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_register_proxy_proto_goTypes, + DependencyIndexes: file_register_proxy_proto_depIdxs, + MessageInfos: file_register_proxy_proto_msgTypes, + }.Build() + File_register_proxy_proto = out.File + file_register_proxy_proto_rawDesc = nil + file_register_proxy_proto_goTypes = nil + file_register_proxy_proto_depIdxs = nil +} diff --git a/client/pb/msf/register_proxy.proto b/client/pb/msf/register_proxy.proto new file mode 100644 index 00000000..50ea1117 --- /dev/null +++ b/client/pb/msf/register_proxy.proto @@ -0,0 +1,59 @@ +syntax = "proto2"; + +option go_package = ".;msf"; + +message DiscussList { + optional uint64 discussCode = 1; + optional uint64 discussSeq = 2; + optional uint64 memberSeq = 3; + optional uint64 infoSeq = 4; + optional bool bHotGroup = 5; + optional uint64 redpackTime = 6; + optional bool hasMsg = 7; + optional int64 dicussFlag = 8; +} + +message GroupList { + optional uint64 groupCode = 1; + optional uint64 groupSeq = 2; + optional uint64 memberSeq = 3; + optional uint64 mask = 4; + optional uint64 redpackTime = 5; + optional bool hasMsg = 6; + optional int64 groupFlag = 7; + optional uint64 groupType = 8; + optional uint32 groupNameSeq = 9; + optional uint32 groupMemberSeq = 10; + optional uint32 uinFlagEx2 = 11; + optional uint32 importantMsgLatestSeq = 12; +} + +message SvcPbResponsePullDisMsgProxy { + optional uint64 memberSeq = 1; + optional bytes content = 2; +} + +message SvcRegisterProxyMsgResp { + optional uint32 result = 1; + optional bytes errMsg = 2; + optional uint32 flag = 3; + optional uint32 seq = 4; + optional SvcResponseMsgInfo info = 5; + repeated GroupList groupList = 6; + repeated DiscussList discussList = 7; + repeated SvcResponsePbPullGroupMsgProxy groupMsg = 8; + repeated SvcPbResponsePullDisMsgProxy discussMsg = 9; + optional bytes c2CMsg = 10; + optional bytes pubAccountMsg = 11; + optional uint32 discussListFlag = 12; +} + +message SvcResponseMsgInfo { + optional uint32 groupNum = 1; + optional uint32 discussNum = 2; +} + +message SvcResponsePbPullGroupMsgProxy { + optional uint64 memberSeq = 1; + optional bytes content = 2; +} diff --git a/client/pb/oidb/oidb0xd79.pb.go b/client/pb/oidb/oidb0xd79.pb.go index 67ab09cb..4c6dab9c 100644 --- a/client/pb/oidb/oidb0xd79.pb.go +++ b/client/pb/oidb/oidb0xd79.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.25.0 // protoc v3.11.4 -// source: oidb0xD79.proto +// source: oidb0xd79.proto package oidb @@ -42,7 +42,7 @@ type D79ReqBody struct { func (x *D79ReqBody) Reset() { *x = D79ReqBody{} if protoimpl.UnsafeEnabled { - mi := &file_oidb0xD79_proto_msgTypes[0] + mi := &file_oidb0xd79_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -55,7 +55,7 @@ func (x *D79ReqBody) String() string { func (*D79ReqBody) ProtoMessage() {} func (x *D79ReqBody) ProtoReflect() protoreflect.Message { - mi := &file_oidb0xD79_proto_msgTypes[0] + mi := &file_oidb0xd79_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -68,7 +68,7 @@ func (x *D79ReqBody) ProtoReflect() protoreflect.Message { // Deprecated: Use D79ReqBody.ProtoReflect.Descriptor instead. func (*D79ReqBody) Descriptor() ([]byte, []int) { - return file_oidb0xD79_proto_rawDescGZIP(), []int{0} + return file_oidb0xd79_proto_rawDescGZIP(), []int{0} } func (x *D79ReqBody) GetSeq() uint64 { @@ -135,7 +135,7 @@ type D79RspBody struct { func (x *D79RspBody) Reset() { *x = D79RspBody{} if protoimpl.UnsafeEnabled { - mi := &file_oidb0xD79_proto_msgTypes[1] + mi := &file_oidb0xd79_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -148,7 +148,7 @@ func (x *D79RspBody) String() string { func (*D79RspBody) ProtoMessage() {} func (x *D79RspBody) ProtoReflect() protoreflect.Message { - mi := &file_oidb0xD79_proto_msgTypes[1] + mi := &file_oidb0xd79_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -161,7 +161,7 @@ func (x *D79RspBody) ProtoReflect() protoreflect.Message { // Deprecated: Use D79RspBody.ProtoReflect.Descriptor instead. func (*D79RspBody) Descriptor() ([]byte, []int) { - return file_oidb0xD79_proto_rawDescGZIP(), []int{1} + return file_oidb0xd79_proto_rawDescGZIP(), []int{1} } func (x *D79RspBody) GetRet() uint32 { @@ -210,7 +210,7 @@ type D79Content struct { func (x *D79Content) Reset() { *x = D79Content{} if protoimpl.UnsafeEnabled { - mi := &file_oidb0xD79_proto_msgTypes[2] + mi := &file_oidb0xd79_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -223,7 +223,7 @@ func (x *D79Content) String() string { func (*D79Content) ProtoMessage() {} func (x *D79Content) ProtoReflect() protoreflect.Message { - mi := &file_oidb0xD79_proto_msgTypes[2] + mi := &file_oidb0xd79_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -236,7 +236,7 @@ func (x *D79Content) ProtoReflect() protoreflect.Message { // Deprecated: Use D79Content.ProtoReflect.Descriptor instead. func (*D79Content) Descriptor() ([]byte, []int) { - return file_oidb0xD79_proto_rawDescGZIP(), []int{2} + return file_oidb0xd79_proto_rawDescGZIP(), []int{2} } func (x *D79Content) GetSliceContent() [][]byte { @@ -246,10 +246,10 @@ func (x *D79Content) GetSliceContent() [][]byte { return nil } -var File_oidb0xD79_proto protoreflect.FileDescriptor +var File_oidb0xd79_proto protoreflect.FileDescriptor -var file_oidb0xD79_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x6f, 0x69, 0x64, 0x62, 0x30, 0x78, 0x44, 0x37, 0x39, 0x2e, 0x70, 0x72, 0x6f, 0x74, +var file_oidb0xd79_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x6f, 0x69, 0x64, 0x62, 0x30, 0x78, 0x64, 0x37, 0x39, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbb, 0x01, 0x0a, 0x0a, 0x44, 0x37, 0x39, 0x52, 0x65, 0x71, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, @@ -279,24 +279,24 @@ var file_oidb0xD79_proto_rawDesc = []byte{ } var ( - file_oidb0xD79_proto_rawDescOnce sync.Once - file_oidb0xD79_proto_rawDescData = file_oidb0xD79_proto_rawDesc + file_oidb0xd79_proto_rawDescOnce sync.Once + file_oidb0xd79_proto_rawDescData = file_oidb0xd79_proto_rawDesc ) -func file_oidb0xD79_proto_rawDescGZIP() []byte { - file_oidb0xD79_proto_rawDescOnce.Do(func() { - file_oidb0xD79_proto_rawDescData = protoimpl.X.CompressGZIP(file_oidb0xD79_proto_rawDescData) +func file_oidb0xd79_proto_rawDescGZIP() []byte { + file_oidb0xd79_proto_rawDescOnce.Do(func() { + file_oidb0xd79_proto_rawDescData = protoimpl.X.CompressGZIP(file_oidb0xd79_proto_rawDescData) }) - return file_oidb0xD79_proto_rawDescData + return file_oidb0xd79_proto_rawDescData } -var file_oidb0xD79_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_oidb0xD79_proto_goTypes = []interface{}{ +var file_oidb0xd79_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_oidb0xd79_proto_goTypes = []interface{}{ (*D79ReqBody)(nil), // 0: D79ReqBody (*D79RspBody)(nil), // 1: D79RspBody (*D79Content)(nil), // 2: D79Content } -var file_oidb0xD79_proto_depIdxs = []int32{ +var file_oidb0xd79_proto_depIdxs = []int32{ 2, // 0: D79RspBody.content:type_name -> D79Content 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type @@ -305,13 +305,13 @@ var file_oidb0xD79_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_oidb0xD79_proto_init() } -func file_oidb0xD79_proto_init() { - if File_oidb0xD79_proto != nil { +func init() { file_oidb0xd79_proto_init() } +func file_oidb0xd79_proto_init() { + if File_oidb0xd79_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_oidb0xD79_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_oidb0xd79_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*D79ReqBody); i { case 0: return &v.state @@ -323,7 +323,7 @@ func file_oidb0xD79_proto_init() { return nil } } - file_oidb0xD79_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_oidb0xd79_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*D79RspBody); i { case 0: return &v.state @@ -335,7 +335,7 @@ func file_oidb0xD79_proto_init() { return nil } } - file_oidb0xD79_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_oidb0xd79_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*D79Content); i { case 0: return &v.state @@ -352,18 +352,18 @@ func file_oidb0xD79_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_oidb0xD79_proto_rawDesc, + RawDescriptor: file_oidb0xd79_proto_rawDesc, NumEnums: 0, NumMessages: 3, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_oidb0xD79_proto_goTypes, - DependencyIndexes: file_oidb0xD79_proto_depIdxs, - MessageInfos: file_oidb0xD79_proto_msgTypes, + GoTypes: file_oidb0xd79_proto_goTypes, + DependencyIndexes: file_oidb0xd79_proto_depIdxs, + MessageInfos: file_oidb0xd79_proto_msgTypes, }.Build() - File_oidb0xD79_proto = out.File - file_oidb0xD79_proto_rawDesc = nil - file_oidb0xD79_proto_goTypes = nil - file_oidb0xD79_proto_depIdxs = nil + File_oidb0xd79_proto = out.File + file_oidb0xd79_proto_rawDesc = nil + file_oidb0xd79_proto_goTypes = nil + file_oidb0xd79_proto_depIdxs = nil } diff --git a/client/sync.go b/client/sync.go index 550cfab9..2c5c568d 100644 --- a/client/sync.go +++ b/client/sync.go @@ -1,12 +1,19 @@ package client import ( + "fmt" "github.com/Mrs4s/MiraiGo/binary/jce" + "github.com/Mrs4s/MiraiGo/client/pb" + "github.com/Mrs4s/MiraiGo/client/pb/msf" "github.com/Mrs4s/MiraiGo/client/pb/msg" + "github.com/Mrs4s/MiraiGo/client/pb/oidb" + "github.com/Mrs4s/MiraiGo/message" "github.com/Mrs4s/MiraiGo/protocol/packets" "github.com/golang/protobuf/proto" "github.com/pkg/errors" + "math/rand" "sync" + "sync/atomic" "time" ) @@ -18,8 +25,29 @@ func init() { decoders["RegPrxySvc.PbGetMsg"] = ignoreDecoder decoders["RegPrxySvc.NoticeEnd"] = ignoreDecoder decoders["RegPrxySvc.PushParam"] = decodePushParamPacket + decoders["RegPrxySvc.PbSyncMsg"] = decodeMsgSyncResponse } +type ( + + // SessionSyncResponse 会话同步结果 + SessionSyncResponse struct { + GroupSessions []*GroupSessionInfo + } + + // GroupSessionInfo 群会话信息 + GroupSessionInfo struct { + GroupCode int64 + UnreadCount uint32 + LatestMessages []*message.GroupMessage + } + + sessionSyncEvent struct { + IsEnd bool + GroupSessions []*GroupSessionInfo + } +) + // GetAllowedClients 获取已允许的其他客户端 func (c *QQClient) GetAllowedClients() ([]*OtherClientInfo, error) { i, err := c.sendAndWait(c.buildDeviceListRequestPacket()) @@ -40,10 +68,44 @@ func (c *QQClient) GetAllowedClients() ([]*OtherClientInfo, error) { // RefreshStatus 刷新客户端状态 func (c *QQClient) RefreshStatus() error { - _, err := c.sendAndWait(c.buildGetOfflineMsgRequest()) + _, err := c.sendAndWait(c.buildGetOfflineMsgRequestPacket()) return err } +func (c *QQClient) SyncSessions() (*SessionSyncResponse, error) { + _, pkt := c.buildSyncMsgRequestPacket() + if err := c.send(pkt); err != nil { + return nil, err + } + ret := &SessionSyncResponse{} + notifyChan := make(chan bool) + ended := false + p := 0 + stop := c.waitPacket("RegPrxySvc.PbSyncMsg", func(i interface{}, err error) { + if err != nil { + return + } + p++ + e := i.(*sessionSyncEvent) + if len(e.GroupSessions) > 0 { + ret.GroupSessions = append(ret.GroupSessions, e.GroupSessions...) + } + if e.IsEnd { + ended = true + } + if p > 1 { + notifyChan <- true + } + }) + select { + case <-notifyChan: + stop() + case <-time.After(time.Second * 5): + stop() + } + return ret, nil +} + // StatSvc.GetDevLoginInfo func (c *QQClient) buildDeviceListRequestPacket() (uint16, []byte) { seq := c.nextSeq() @@ -68,7 +130,7 @@ func (c *QQClient) buildDeviceListRequestPacket() (uint16, []byte) { } // RegPrxySvc.getOffMsg -func (c *QQClient) buildGetOfflineMsgRequest() (uint16, []byte) { +func (c *QQClient) buildGetOfflineMsgRequestPacket() (uint16, []byte) { seq := c.nextSeq() regReq := &jce.SvcReqRegisterNew{ RequestOptional: 0x101C2 | 32, @@ -122,6 +184,78 @@ func (c *QQClient) buildGetOfflineMsgRequest() (uint16, []byte) { return seq, packet } +// RegPrxySvc.PbSyncMsg +func (c *QQClient) buildSyncMsgRequestPacket() (uint16, []byte) { + seq := c.nextSeq() + oidbReq, _ := proto.Marshal(&oidb.D769RspBody{ + ConfigList: []*oidb.D769ConfigSeq{ + { + Type: proto.Uint32(46), + Version: proto.Uint32(0), + }, + { + Type: proto.Uint32(283), + Version: proto.Uint32(0), + }, + }}) + regReq := &jce.SvcReqRegisterNew{ + RequestOptional: 128 | 0 | 64 | 256 | 2 | 8192 | 16384 | 65536, + DisGroupMsgFilter: 1, + C2CMsg: &jce.SvcReqGetMsgV2{ + Uin: c.Uin, + DateTime: func() int32 { + if c.stat.LastMessageTime == 0 { + return 1 + } + return int32(c.stat.LastMessageTime) + }(), + RecivePic: 1, + Ability: 15, + Channel: 4, + Inst: 1, + ChannelEx: 1, + SyncCookie: c.syncCookie, + SyncFlag: 0, // START + RambleFlag: 0, + GeneralAbi: 1, + PubAccountCookie: c.pubAccountCookie, + }, + GroupMask: 2, + EndSeq: int64(rand.Uint32()), + O769Body: oidbReq, + } + flag := msg.SyncFlag_START + msgReq := &msg.GetMessageRequest{ + SyncFlag: &flag, + SyncCookie: c.syncCookie, + RambleFlag: proto.Int32(0), + ContextFlag: proto.Int32(1), + OnlineSyncFlag: proto.Int32(0), + LatestRambleNumber: proto.Int32(20), + OtherRambleNumber: proto.Int32(3), + MsgReqType: proto.Int32(1), + } + offMsg, _ := proto.Marshal(msgReq) + msgReq.MsgReqType = proto.Int32(2) + msgReq.SyncCookie = nil + msgReq.PubaccountCookie = c.pubAccountCookie + pubMsg, _ := proto.Marshal(msgReq) + buf := &jce.RequestDataVersion3{Map: map[string][]byte{ + "req_PbOffMsg": jce.NewJceWriter().WriteBytes(append([]byte{0, 0, 0, 0}, offMsg...), 0).Bytes(), + "req_PbPubMsg": jce.NewJceWriter().WriteBytes(append([]byte{0, 0, 0, 0}, pubMsg...), 0).Bytes(), + "req_OffMsg": packUniRequestData(regReq.ToBytes()), + }} + pkt := &jce.RequestPacket{ + IVersion: 3, + SServantName: "RegPrxySvc", + SBuffer: buf.ToBytes(), + Context: make(map[string]string), + Status: make(map[string]string), + } + packet := packets.BuildUniPacket(c.Uin, seq, "RegPrxySvc.infoSync", 1, c.OutGoingPacketSessionId, []byte{}, c.sigInfo.d2Key, pkt.ToBytes()) + return seq, packet +} + // StatSvc.GetDevLoginInfo func decodeDevListResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) { request := &jce.RequestPacket{} @@ -190,6 +324,43 @@ func decodePushParamPacket(c *QQClient, _ uint16, payload []byte) (interface{}, return nil, nil } +// RegPrxySvc.PbSyncMsg +func decodeMsgSyncResponse(c *QQClient, _ uint16, payload []byte) (interface{}, error) { + rsp := &msf.SvcRegisterProxyMsgResp{} + if err := proto.Unmarshal(payload, rsp); err != nil { + return nil, err + } + ret := &sessionSyncEvent{ + IsEnd: (rsp.GetFlag() & 2) == 2, + } + if len(rsp.GroupMsg) > 0 { + for _, gm := range rsp.GroupMsg { + gmRsp := &msg.GetGroupMsgResp{} + if err := proto.Unmarshal(gm.Content[4:], gmRsp); err != nil { + continue + } + var latest []*message.GroupMessage + for _, m := range gmRsp.Msg { + if m.Head.GetFromUin() != 0 { + latest = append(latest, c.parseGroupMessage(m)) + } + } + ret.GroupSessions = append(ret.GroupSessions, &GroupSessionInfo{ + GroupCode: int64(gmRsp.GetGroupCode()), + UnreadCount: uint32(gmRsp.GetReturnEndSeq() - gmRsp.GetReturnBeginSeq()), // todo fix this + LatestMessages: latest, + }) + } + } + if len(rsp.C2CMsg) > 4 { + c2cRsp := &msg.GetMessageResponse{} + if proto.Unmarshal(rsp.C2CMsg[4:], c2cRsp) == nil { + c.c2cMessageSyncProcessor(c2cRsp) // todo rewrite c2c processor + } + } + return ret, nil +} + var loginNotifyLock sync.Mutex // StatSvc.SvcReqMSFLoginNotify @@ -243,3 +414,123 @@ func decodeLoginNotifyPacket(c *QQClient, _ uint16, payload []byte) (interface{} } return nil, nil } + +func (c *QQClient) c2cMessageSyncProcessor(rsp *msg.GetMessageResponse) { + c.syncCookie = rsp.SyncCookie + c.pubAccountCookie = rsp.PubAccountCookie + c.msgCtrlBuf = rsp.MsgCtrlBuf + if rsp.UinPairMsgs == nil { + return + } + var delItems []*pb.MessageItem + for _, pairMsg := range rsp.UinPairMsgs { + for _, pMsg := range pairMsg.Messages { + // delete message + delItem := &pb.MessageItem{ + FromUin: pMsg.Head.GetFromUin(), + ToUin: pMsg.Head.GetToUin(), + MsgType: 187, + MsgSeq: pMsg.Head.GetMsgSeq(), + MsgUid: pMsg.Head.GetMsgUid(), + } + delItems = append(delItems, delItem) + if pMsg.Head.GetToUin() != c.Uin { + continue + } + if (int64(pairMsg.GetLastReadTime()) & 4294967295) > int64(pMsg.Head.GetMsgTime()) { + continue + } + strKey := fmt.Sprintf("%d%d%d%d", pMsg.Head.FromUin, pMsg.Head.ToUin, pMsg.Head.MsgSeq, pMsg.Head.MsgUid) + if _, ok := c.msgSvcCache.Get(strKey); ok { + continue + } + c.msgSvcCache.Add(strKey, "", time.Minute) + switch pMsg.Head.GetMsgType() { + case 33: // 加群同步 + func() { + groupJoinLock.Lock() + defer groupJoinLock.Unlock() + group := c.FindGroupByUin(pMsg.Head.GetFromUin()) + if pMsg.Head.GetAuthUin() == c.Uin { + if group == nil && c.ReloadGroupList() == nil { + c.dispatchJoinGroupEvent(c.FindGroupByUin(pMsg.Head.GetFromUin())) + } + } else { + if group != nil && group.FindMember(pMsg.Head.GetAuthUin()) == nil { + mem, err := c.getMemberInfo(group.Code, pMsg.Head.GetAuthUin()) + if err != nil { + c.Debug("error to fetch new member info: %v", err) + return + } + group.Update(func(info *GroupInfo) { + info.Members = append(info.Members, mem) + }) + c.dispatchNewMemberEvent(&MemberJoinGroupEvent{ + Group: group, + Member: mem, + }) + } + } + }() + case 84, 87: + c.exceptAndDispatchGroupSysMsg() + case 141: // 临时会话 + if pMsg.Head.C2CTmpMsgHead == nil { + continue + } + group := c.FindGroupByUin(pMsg.Head.C2CTmpMsgHead.GetGroupUin()) + if group == nil { + continue + } + if pMsg.Head.GetFromUin() == c.Uin { + continue + } + c.dispatchTempMessage(c.parseTempMessage(pMsg)) + case 166, 208: // 好友消息 + if pMsg.Head.GetFromUin() == c.Uin { + for { + frdSeq := atomic.LoadInt32(&c.friendSeq) + if frdSeq < pMsg.Head.GetMsgSeq() { + if atomic.CompareAndSwapInt32(&c.friendSeq, frdSeq, pMsg.Head.GetMsgSeq()) { + break + } + } else { + break + } + } + } + if pMsg.Body.RichText == nil || pMsg.Body.RichText.Elems == nil { + continue + } + c.dispatchFriendMessage(c.parsePrivateMessage(pMsg)) + case 187: + _, pkt := c.buildSystemMsgNewFriendPacket() + _ = c.send(pkt) + case 529: + sub4 := msg.SubMsgType0X4Body{} + if err := proto.Unmarshal(pMsg.Body.MsgContent, &sub4); err != nil { + err = errors.Wrap(err, "unmarshal sub msg 0x4 error") + c.Error("unmarshal sub msg 0x4 error: %v", err) + continue + } + if sub4.NotOnlineFile != nil { + rsp, err := c.sendAndWait(c.buildOfflineFileDownloadRequestPacket(sub4.NotOnlineFile.FileUuid)) // offline_file.go + if err != nil { + continue + } + c.dispatchOfflineFileEvent(&OfflineFileEvent{ + FileName: string(sub4.NotOnlineFile.FileName), + FileSize: sub4.NotOnlineFile.GetFileSize(), + Sender: pMsg.Head.GetFromUin(), + DownloadUrl: rsp.(string), + }) + } + } + } + } + _, _ = c.sendAndWait(c.buildDeleteMessageRequestPacket(delItems)) + if rsp.GetSyncFlag() != msg.SyncFlag_STOP { + c.Debug("continue sync with flag: %v", rsp.SyncFlag.String()) + _, _ = c.sendAndWait(c.buildGetMessageRequestPacket(rsp.GetSyncFlag(), time.Now().Unix())) + } +}