From b7e875c77fd5d62abd458be64daa8c636f822631 Mon Sep 17 00:00:00 2001 From: pk5ls20 Date: Sun, 13 Oct 2024 04:15:10 +0800 Subject: [PATCH] feat: add more proto --- src/core/proto/message/c2c.ts | 11 + src/core/proto/message/component.ts | 147 ++++++++++++ src/core/proto/message/element.ts | 346 ++++++++++++++++++++++++++++ src/core/proto/message/group.ts | 19 ++ src/core/proto/message/message.ts | 78 ++++++- src/core/proto/message/notify.ts | 22 ++ src/core/proto/message/routing.ts | 41 ++++ 7 files changed, 657 insertions(+), 7 deletions(-) create mode 100644 src/core/proto/message/c2c.ts create mode 100644 src/core/proto/message/component.ts create mode 100644 src/core/proto/message/element.ts create mode 100644 src/core/proto/message/group.ts create mode 100644 src/core/proto/message/notify.ts create mode 100644 src/core/proto/message/routing.ts diff --git a/src/core/proto/message/c2c.ts b/src/core/proto/message/c2c.ts new file mode 100644 index 00000000..2a93e5eb --- /dev/null +++ b/src/core/proto/message/c2c.ts @@ -0,0 +1,11 @@ +import { ScalarType } from "@protobuf-ts/runtime"; +import { ProtoField } from "../NapProto"; + +export const C2C = { + uin: ProtoField(1, ScalarType.UINT32, true), + uid: ProtoField(2, ScalarType.STRING, true), + field3: ProtoField(3, ScalarType.UINT32, true), + sig: ProtoField(4, ScalarType.UINT32, true), + receiverUin: ProtoField(5, ScalarType.UINT32, true), + receiverUid: ProtoField(6, ScalarType.STRING, true), +}; diff --git a/src/core/proto/message/component.ts b/src/core/proto/message/component.ts new file mode 100644 index 00000000..d4d8e623 --- /dev/null +++ b/src/core/proto/message/component.ts @@ -0,0 +1,147 @@ +import { ScalarType } from "@protobuf-ts/runtime"; +import { ProtoField } from "../NapProto"; +import { Elem } from "@/core/proto/message/element"; + +export const Attr = { + codePage: ProtoField(1, ScalarType.INT32), + time: ProtoField(2, ScalarType.INT32), + random: ProtoField(3, ScalarType.INT32), + color: ProtoField(4, ScalarType.INT32), + size: ProtoField(5, ScalarType.INT32), + effect: ProtoField(6, ScalarType.INT32), + charSet: ProtoField(7, ScalarType.INT32), + pitchAndFamily: ProtoField(8, ScalarType.INT32), + fontName: ProtoField(9, ScalarType.STRING), + reserveData: ProtoField(10, ScalarType.BYTES), +}; + +export const NotOnlineFile = { + fileType: ProtoField(1, ScalarType.INT32, true), + sig: ProtoField(2, ScalarType.BYTES, true), + fileUuid: ProtoField(3, ScalarType.STRING, true), + fileMd5: ProtoField(4, ScalarType.BYTES, true), + fileName: ProtoField(5, ScalarType.STRING, true), + fileSize: ProtoField(6, ScalarType.INT64, true), + note: ProtoField(7, ScalarType.BYTES, true), + reserved: ProtoField(8, ScalarType.INT32, true), + subcmd: ProtoField(9, ScalarType.INT32, true), + microCloud: ProtoField(10, ScalarType.INT32, true), + bytesFileUrls: ProtoField(11, ScalarType.BYTES, false, true), + downloadFlag: ProtoField(12, ScalarType.INT32, true), + dangerEvel: ProtoField(50, ScalarType.INT32, true), + lifeTime: ProtoField(51, ScalarType.INT32, true), + uploadTime: ProtoField(52, ScalarType.INT32, true), + absFileType: ProtoField(53, ScalarType.INT32, true), + clientType: ProtoField(54, ScalarType.INT32, true), + expireTime: ProtoField(55, ScalarType.INT32, true), + pbReserve: ProtoField(56, ScalarType.BYTES, true), + fileHash: ProtoField(57, ScalarType.STRING, true), +}; + +export const Ptt = { + fileType: ProtoField(1, ScalarType.INT32), + srcUin: ProtoField(2, ScalarType.UINT64), + fileUuid: ProtoField(3, ScalarType.STRING), + fileMd5: ProtoField(4, ScalarType.BYTES), + fileName: ProtoField(5, ScalarType.STRING), + fileSize: ProtoField(6, ScalarType.INT32), + reserve: ProtoField(7, ScalarType.BYTES), + fileId: ProtoField(8, ScalarType.INT32), + serverIp: ProtoField(9, ScalarType.INT32), + serverPort: ProtoField(10, ScalarType.INT32), + boolValid: ProtoField(11, ScalarType.BOOL), + signature: ProtoField(12, ScalarType.BYTES), + shortcut: ProtoField(13, ScalarType.BYTES), + fileKey: ProtoField(14, ScalarType.BYTES), + magicPttIndex: ProtoField(15, ScalarType.INT32), + voiceSwitch: ProtoField(16, ScalarType.INT32), + pttUrl: ProtoField(17, ScalarType.BYTES), + groupFileKey: ProtoField(18, ScalarType.STRING), + time: ProtoField(19, ScalarType.INT32), + downPara: ProtoField(20, ScalarType.BYTES), + format: ProtoField(29, ScalarType.INT32), + pbReserve: ProtoField(30, ScalarType.BYTES), + bytesPttUrls: ProtoField(31, ScalarType.BYTES, false, true), + downloadFlag: ProtoField(32, ScalarType.INT32), +}; + +export const RichText = { + attr: ProtoField(1, () => Attr, true), + elems: ProtoField(2, () => Elem, false, true), + notOnlineFile: ProtoField(3, () => NotOnlineFile, true), + ptt: ProtoField(4, () => Ptt, true), +}; + +export const ButtonExtra = { + data: ProtoField(1, () => KeyboardData), +}; + +export const KeyboardData = { + rows: ProtoField(1, () => Row, false, true), +}; + +export const Row = { + buttons: ProtoField(1, () => Button, false, true), +}; + +export const Button = { + id: ProtoField(1, ScalarType.STRING), + renderData: ProtoField(2, () => RenderData), + action: ProtoField(3, () => Action), +}; + +export const RenderData = { + label: ProtoField(1, ScalarType.STRING), + visitedLabel: ProtoField(2, ScalarType.STRING), + style: ProtoField(3, ScalarType.INT32), +}; + +export const Action = { + type: ProtoField(1, ScalarType.INT32), + permission: ProtoField(2, () => Permission), + unsupportTips: ProtoField(4, ScalarType.STRING), + data: ProtoField(5, ScalarType.STRING), + reply: ProtoField(7, ScalarType.BOOL), + enter: ProtoField(8, ScalarType.BOOL), +}; + +export const Permission = { + type: ProtoField(1, ScalarType.INT32), + specifyRoleIds: ProtoField(2, ScalarType.STRING, false, true), + specifyUserIds: ProtoField(3, ScalarType.STRING, false, true), +}; + +export const FileExtra = { + file: ProtoField(1, () => NotOnlineFile), +}; + +export const GroupFileExtra = { + field1: ProtoField(1, ScalarType.UINT32), + fileName: ProtoField(2, ScalarType.STRING), + display: ProtoField(3, ScalarType.STRING), + inner: ProtoField(7, () => GroupFileExtraInner), +}; + +export const GroupFileExtraInner = { + info: ProtoField(2, () => GroupFileExtraInfo), +}; + +export const GroupFileExtraInfo = { + busId: ProtoField(1, ScalarType.UINT32), + fileId: ProtoField(2, ScalarType.STRING), + fileSize: ProtoField(3, ScalarType.UINT64), + fileName: ProtoField(4, ScalarType.STRING), + field5: ProtoField(5, ScalarType.UINT32), + field7: ProtoField(7, ScalarType.STRING), + fileMd5: ProtoField(8, ScalarType.STRING), +}; + +export const ImageExtraUrl = { + origUrl: ProtoField(30, ScalarType.STRING), +}; + +export const PokeExtra = { + type: ProtoField(1, ScalarType.UINT32), + field7: ProtoField(7, ScalarType.UINT32), + field8: ProtoField(8, ScalarType.UINT32), +}; diff --git a/src/core/proto/message/element.ts b/src/core/proto/message/element.ts new file mode 100644 index 00000000..5fe003f2 --- /dev/null +++ b/src/core/proto/message/element.ts @@ -0,0 +1,346 @@ +import { ScalarType } from "@protobuf-ts/runtime"; +import { ProtoField } from "../NapProto"; + +export const Elem = { + text: ProtoField(1, () => Text, true), + face: ProtoField(2, () => Face, true), + onlineImage: ProtoField(3, () => OnlineImage, true), + notOnlineImage: ProtoField(4, () => NotOnlineImage, true), + transElem: ProtoField(5, () => TransElem, true), + marketFace: ProtoField(6, () => MarketFace, true), + customFace: ProtoField(8, () => CustomFace, true), + elemFlags2: ProtoField(9, () => ElemFlags2, true), + richMsg: ProtoField(12, () => RichMsg, true), + groupFile: ProtoField(13, () => GroupFile, true), + extraInfo: ProtoField(16, () => ExtraInfo, true), + videoFile: ProtoField(19, () => VideoFile, true), + anonymousGroupMessage: ProtoField(21, () => AnonymousGroupMessage, true), + customElem: ProtoField(31, () => CustomElem, true), + generalFlags: ProtoField(37, () => GeneralFlags, true), + srcMsg: ProtoField(45, () => SrcMsg, true), + lightAppElem: ProtoField(51, () => LightAppElem, true), + commonElem: ProtoField(53, () => CommonElem, true), +} + +export const Text = { + str: ProtoField(1, ScalarType.STRING, true), + lint: ProtoField(2, ScalarType.STRING, true), + attr6Buf: ProtoField(3, ScalarType.BYTES, true), + attr7Buf: ProtoField(4, ScalarType.BYTES, true), + buf: ProtoField(11, ScalarType.BYTES, true), + pbReserve: ProtoField(12, ScalarType.BYTES, true), +} + +export const Face = { + index: ProtoField(1, ScalarType.INT32, true), + old: ProtoField(2, ScalarType.BYTES, true), + buf: ProtoField(11, ScalarType.BYTES, true), +}; + +export const OnlineImage = { + guid: ProtoField(1, ScalarType.BYTES), + filePath: ProtoField(2, ScalarType.BYTES), + oldVerSendFile: ProtoField(3, ScalarType.BYTES), +} + +export const NotOnlineImage = { + filePath: ProtoField(1, ScalarType.STRING), + fileLen: ProtoField(2, ScalarType.UINT32), + downloadPath: ProtoField(3, ScalarType.STRING), + oldVerSendFile: ProtoField(4, ScalarType.BYTES), + imgType: ProtoField(5, ScalarType.INT32), + previewsImage: ProtoField(6, ScalarType.BYTES), + picMd5: ProtoField(7, ScalarType.BYTES), + picHeight: ProtoField(8, ScalarType.UINT32), + picWidth: ProtoField(9, ScalarType.UINT32), + resId: ProtoField(10, ScalarType.STRING), + flag: ProtoField(11, ScalarType.BYTES), + thumbUrl: ProtoField(12, ScalarType.STRING), + original: ProtoField(13, ScalarType.INT32), + bigUrl: ProtoField(14, ScalarType.STRING), + origUrl: ProtoField(15, ScalarType.STRING), + bizType: ProtoField(16, ScalarType.INT32), + result: ProtoField(17, ScalarType.INT32), + index: ProtoField(18, ScalarType.INT32), + opFaceBuf: ProtoField(19, ScalarType.BYTES), + oldPicMd5: ProtoField(20, ScalarType.BOOL), + thumbWidth: ProtoField(21, ScalarType.INT32), + thumbHeight: ProtoField(22, ScalarType.INT32), + fileId: ProtoField(23, ScalarType.INT32), + showLen: ProtoField(24, ScalarType.UINT32), + downloadLen: ProtoField(25, ScalarType.UINT32), + x400Url: ProtoField(26, ScalarType.STRING), + x400Width: ProtoField(27, ScalarType.INT32), + x400Height: ProtoField(28, ScalarType.INT32), + pbRes: ProtoField(29, () => NotOnlineImage_PbReserve), +} + +export const NotOnlineImage_PbReserve = { + subType: ProtoField(1, ScalarType.INT32), + field3: ProtoField(3, ScalarType.INT32), + field4: ProtoField(4, ScalarType.INT32), + summary: ProtoField(8, ScalarType.STRING), + field10: ProtoField(10, ScalarType.INT32), + field20: ProtoField(20, () => NotOnlineImage_PbReserve2), + url: ProtoField(30, ScalarType.STRING), + md5Str: ProtoField(31, ScalarType.STRING), +} + +export const NotOnlineImage_PbReserve2 = { + field1: ProtoField(1, ScalarType.INT32), + field2: ProtoField(2, ScalarType.STRING), + field3: ProtoField(3, ScalarType.INT32), + field4: ProtoField(4, ScalarType.INT32), + field5: ProtoField(5, ScalarType.INT32), + field7: ProtoField(7, ScalarType.STRING), +} + +export const TransElem = { + elemType: ProtoField(1, ScalarType.INT32), + elemValue: ProtoField(2, ScalarType.BYTES), +} + +export const MarketFace = { + faceName: ProtoField(1, ScalarType.BYTES), + itemType: ProtoField(2, ScalarType.INT32), + faceInfo: ProtoField(3, ScalarType.INT32), + faceId: ProtoField(4, ScalarType.BYTES), + tabId: ProtoField(5, ScalarType.INT32), + subType: ProtoField(6, ScalarType.INT32), + key: ProtoField(7, ScalarType.BYTES), + param: ProtoField(8, ScalarType.BYTES), + mediaType: ProtoField(9, ScalarType.INT32), + imageWidth: ProtoField(10, ScalarType.INT32), + imageHeight: ProtoField(11, ScalarType.INT32), + mobileparam: ProtoField(12, ScalarType.BYTES), + pbReserve: ProtoField(13, ScalarType.BYTES), +} + +export const CustomFace = { + guid: ProtoField(1, ScalarType.BYTES), + filePath: ProtoField(2, ScalarType.STRING), + shortcut: ProtoField(3, ScalarType.STRING), + buffer: ProtoField(4, ScalarType.BYTES), + flag: ProtoField(5, ScalarType.BYTES), + oldData: ProtoField(6, ScalarType.BYTES, true), + fileId: ProtoField(7, ScalarType.UINT32), + serverIp: ProtoField(8, ScalarType.INT32, true), + serverPort: ProtoField(9, ScalarType.INT32, true), + fileType: ProtoField(10, ScalarType.INT32), + signature: ProtoField(11, ScalarType.BYTES), + useful: ProtoField(12, ScalarType.INT32), + md5: ProtoField(13, ScalarType.BYTES), + thumbUrl: ProtoField(14, ScalarType.STRING), + bigUrl: ProtoField(15, ScalarType.STRING), + origUrl: ProtoField(16, ScalarType.STRING), + bizType: ProtoField(17, ScalarType.INT32), + repeatIndex: ProtoField(18, ScalarType.INT32), + repeatImage: ProtoField(19, ScalarType.INT32), + imageType: ProtoField(20, ScalarType.INT32), + index: ProtoField(21, ScalarType.INT32), + width: ProtoField(22, ScalarType.INT32), + height: ProtoField(23, ScalarType.INT32), + source: ProtoField(24, ScalarType.INT32), + size: ProtoField(25, ScalarType.UINT32), + origin: ProtoField(26, ScalarType.INT32), + thumbWidth: ProtoField(27, ScalarType.INT32, true), + thumbHeight: ProtoField(28, ScalarType.INT32, true), + showLen: ProtoField(29, ScalarType.INT32), + downloadLen: ProtoField(30, ScalarType.INT32), + x400Url: ProtoField(31, ScalarType.STRING, true), + x400Width: ProtoField(32, ScalarType.INT32), + x400Height: ProtoField(33, ScalarType.INT32), + pbRes: ProtoField(34, () => CustomFace_PbReserve, true), +} + +export const CustomFace_PbReserve = { + subType: ProtoField(1, ScalarType.INT32), + summary: ProtoField(9, ScalarType.STRING), +} + +export const ElemFlags2 = { + colorTextId: ProtoField(1, ScalarType.UINT32), + msgId: ProtoField(2, ScalarType.UINT64), + whisperSessionId: ProtoField(3, ScalarType.UINT32), + pttChangeBit: ProtoField(4, ScalarType.UINT32), + vipStatus: ProtoField(5, ScalarType.UINT32), + compatibleId: ProtoField(6, ScalarType.UINT32), + insts: ProtoField(7, () => Instance, false, true), + msgRptCnt: ProtoField(8, ScalarType.UINT32), + srcInst: ProtoField(9, () => Instance), + longtitude: ProtoField(10, ScalarType.UINT32), + latitude: ProtoField(11, ScalarType.UINT32), + customFont: ProtoField(12, ScalarType.UINT32), + pcSupportDef: ProtoField(13, () => PcSupportDef), + crmFlags: ProtoField(14, ScalarType.UINT32, true), +} + +export const PcSupportDef = { + pcPtlBegin: ProtoField(1, ScalarType.UINT32), + pcPtlEnd: ProtoField(2, ScalarType.UINT32), + macPtlBegin: ProtoField(3, ScalarType.UINT32), + macPtlEnd: ProtoField(4, ScalarType.UINT32), + ptlsSupport: ProtoField(5, ScalarType.INT32, false, true), + ptlsNotSupport: ProtoField(6, ScalarType.UINT32, false, true), +} + +export const Instance = { + appId: ProtoField(1, ScalarType.UINT32), + instId: ProtoField(2, ScalarType.UINT32), +} + +export const RichMsg = { + template1: ProtoField(1, ScalarType.BYTES, true), + serviceId: ProtoField(2, ScalarType.INT32, true), + msgResId: ProtoField(3, ScalarType.BYTES, true), + rand: ProtoField(4, ScalarType.INT32, true), + seq: ProtoField(5, ScalarType.UINT32, true), +} + +export const GroupFile = { + filename: ProtoField(1, ScalarType.BYTES), + fileSize: ProtoField(2, ScalarType.UINT64), + fileId: ProtoField(3, ScalarType.BYTES), + batchId: ProtoField(4, ScalarType.BYTES), + fileKey: ProtoField(5, ScalarType.BYTES), + mark: ProtoField(6, ScalarType.BYTES), + sequence: ProtoField(7, ScalarType.UINT64), + batchItemId: ProtoField(8, ScalarType.BYTES), + feedMsgTime: ProtoField(9, ScalarType.INT32), + pbReserve: ProtoField(10, ScalarType.BYTES), +} + +export const ExtraInfo = { + nick: ProtoField(1, ScalarType.BYTES), + groupCard: ProtoField(2, ScalarType.BYTES), + level: ProtoField(3, ScalarType.INT32), + flags: ProtoField(4, ScalarType.INT32), + groupMask: ProtoField(5, ScalarType.INT32), + msgTailId: ProtoField(6, ScalarType.INT32), + senderTitle: ProtoField(7, ScalarType.BYTES), + apnsTips: ProtoField(8, ScalarType.BYTES), + uin: ProtoField(9, ScalarType.UINT64), + msgStateFlag: ProtoField(10, ScalarType.INT32), + apnsSoundType: ProtoField(11, ScalarType.INT32), + newGroupFlag: ProtoField(12, ScalarType.INT32), +} + +export const VideoFile = { + fileUuid: ProtoField(1, ScalarType.STRING), + fileMd5: ProtoField(2, ScalarType.BYTES), + fileName: ProtoField(3, ScalarType.STRING), + fileFormat: ProtoField(4, ScalarType.INT32), + fileTime: ProtoField(5, ScalarType.INT32), + fileSize: ProtoField(6, ScalarType.INT32), + thumbWidth: ProtoField(7, ScalarType.INT32), + thumbHeight: ProtoField(8, ScalarType.INT32), + thumbFileMd5: ProtoField(9, ScalarType.BYTES), + source: ProtoField(10, ScalarType.BYTES), + thumbFileSize: ProtoField(11, ScalarType.INT32), + busiType: ProtoField(12, ScalarType.INT32), + fromChatType: ProtoField(13, ScalarType.INT32), + toChatType: ProtoField(14, ScalarType.INT32), + boolSupportProgressive: ProtoField(15, ScalarType.BOOL), + fileWidth: ProtoField(16, ScalarType.INT32), + fileHeight: ProtoField(17, ScalarType.INT32), + subBusiType: ProtoField(18, ScalarType.INT32), + videoAttr: ProtoField(19, ScalarType.INT32), + bytesThumbFileUrls: ProtoField(20, ScalarType.BYTES, false, true), + bytesVideoFileUrls: ProtoField(21, ScalarType.BYTES, false, true), + thumbDownloadFlag: ProtoField(22, ScalarType.INT32), + videoDownloadFlag: ProtoField(23, ScalarType.INT32), + pbReserve: ProtoField(24, ScalarType.BYTES), +} + +export const AnonymousGroupMessage = { + flags: ProtoField(1, ScalarType.INT32), + anonId: ProtoField(2, ScalarType.BYTES), + anonNick: ProtoField(3, ScalarType.BYTES), + headPortrait: ProtoField(4, ScalarType.INT32), + expireTime: ProtoField(5, ScalarType.INT32), + bubbleId: ProtoField(6, ScalarType.INT32), + rankColor: ProtoField(7, ScalarType.BYTES), +} + +export const CustomElem = { + desc: ProtoField(1, ScalarType.BYTES), + data: ProtoField(2, ScalarType.BYTES), + enumType: ProtoField(3, ScalarType.INT32), + ext: ProtoField(4, ScalarType.BYTES), + sound: ProtoField(5, ScalarType.BYTES), +} + +export const GeneralFlags = { + bubbleDiyTextId: ProtoField(1, ScalarType.INT32), + groupFlagNew: ProtoField(2, ScalarType.INT32), + uin: ProtoField(3, ScalarType.UINT64), + rpId: ProtoField(4, ScalarType.BYTES), + prpFold: ProtoField(5, ScalarType.INT32), + longTextFlag: ProtoField(6, ScalarType.INT32), + longTextResId: ProtoField(7, ScalarType.STRING, true), + groupType: ProtoField(8, ScalarType.INT32), + toUinFlag: ProtoField(9, ScalarType.INT32), + glamourLevel: ProtoField(10, ScalarType.INT32), + memberLevel: ProtoField(11, ScalarType.INT32), + groupRankSeq: ProtoField(12, ScalarType.UINT64), + olympicTorch: ProtoField(13, ScalarType.INT32), + babyqGuideMsgCookie: ProtoField(14, ScalarType.BYTES), + uin32ExpertFlag: ProtoField(15, ScalarType.INT32), + bubbleSubId: ProtoField(16, ScalarType.INT32), + pendantId: ProtoField(17, ScalarType.UINT64), + rpIndex: ProtoField(18, ScalarType.BYTES), + pbReserve: ProtoField(19, ScalarType.BYTES), +}; + +export const SrcMsg = { + origSeqs: ProtoField(1, ScalarType.UINT32, false, true), + senderUin: ProtoField(2, ScalarType.UINT64), + time: ProtoField(3, ScalarType.INT32, true), + flag: ProtoField(4, ScalarType.INT32, true), + elems: ProtoField(5, () => Elem, false, true), + type: ProtoField(6, ScalarType.INT32, true), + richMsg: ProtoField(7, ScalarType.BYTES, true), + pbReserve: ProtoField(8, ScalarType.BYTES, true), + sourceMsg: ProtoField(9, ScalarType.BYTES, true), + toUin: ProtoField(10, ScalarType.UINT64, true), + troopName: ProtoField(11, ScalarType.BYTES, true), +} + +export const LightAppElem = { + data: ProtoField(1, ScalarType.BYTES), + msgResid: ProtoField(2, ScalarType.BYTES, true), +} + +export const CommonElem = { + serviceType: ProtoField(1, ScalarType.INT32), + pbElem: ProtoField(2, ScalarType.BYTES), + businessType: ProtoField(3, ScalarType.UINT32), +} + +export const FaceExtra = { + faceId: ProtoField(1, ScalarType.INT32, true), +} + +export const MentionExtra = { + type: ProtoField(3, ScalarType.INT32, true), + uin: ProtoField(4, ScalarType.UINT32, true), + field5: ProtoField(5, ScalarType.INT32, true), + uid: ProtoField(9, ScalarType.STRING, true), +} + +export const QFaceExtra = { + field1: ProtoField(1, ScalarType.STRING, true), + field2: ProtoField(2, ScalarType.STRING, true), + faceId: ProtoField(3, ScalarType.INT32, true), + field4: ProtoField(4, ScalarType.INT32, true), + field5: ProtoField(5, ScalarType.INT32, true), + field6: ProtoField(6, ScalarType.STRING, true), + preview: ProtoField(7, ScalarType.STRING, true), + field9: ProtoField(9, ScalarType.INT32, true), +} + +export const QSmallFaceExtra = { + faceId: ProtoField(1, ScalarType.UINT32), + preview: ProtoField(2, ScalarType.STRING), + preview2: ProtoField(3, ScalarType.STRING), +} diff --git a/src/core/proto/message/group.ts b/src/core/proto/message/group.ts new file mode 100644 index 00000000..3416f1e5 --- /dev/null +++ b/src/core/proto/message/group.ts @@ -0,0 +1,19 @@ +import { ScalarType } from "@protobuf-ts/runtime"; +import { ProtoField } from "../NapProto"; + +export const GroupRecallMsg = { + type: ProtoField(1, ScalarType.UINT32), + groupUin: ProtoField(2, ScalarType.UINT32), + field3: ProtoField(3, () => GroupRecallMsgField3), + field4: ProtoField(4, () => GroupRecallMsgField4), +}; + +export const GroupRecallMsgField3 = { + sequence: ProtoField(1, ScalarType.UINT32), + random: ProtoField(2, ScalarType.UINT32), + field3: ProtoField(3, ScalarType.UINT32), +}; + +export const GroupRecallMsgField4 = { + field1: ProtoField(1, ScalarType.UINT32), +}; diff --git a/src/core/proto/message/message.ts b/src/core/proto/message/message.ts index d81a90a7..23b92311 100644 --- a/src/core/proto/message/message.ts +++ b/src/core/proto/message/message.ts @@ -1,11 +1,75 @@ -import {ProtoField} from "@/core/proto/NapProto"; -import {ScalarType} from "@protobuf-ts/runtime"; +import { ScalarType } from "@protobuf-ts/runtime"; +import { ProtoField } from "../NapProto"; +import {ForwardHead, Grp, GrpTmp, ResponseForward, ResponseGrp, Trans0X211, WPATmp} from "@/core/proto/message/routing"; +import {RichText} from "@/core/proto/message/component"; +import {C2C} from "@/core/proto/message/c2c"; export const ContentHead = { type: ProtoField(1, ScalarType.UINT32), subType: ProtoField(2, ScalarType.UINT32, true), - msgId: ProtoField(4, ScalarType.UINT32), - sequence: ProtoField(5, ScalarType.UINT32), - timeStamp: ProtoField(6, ScalarType.UINT32), - field7: ProtoField(7, ScalarType.UINT64), -} + divSeq: ProtoField(3, ScalarType.UINT32, true), + msgId: ProtoField(4, ScalarType.UINT32, true), + sequence: ProtoField(5, ScalarType.UINT32, true), + timeStamp: ProtoField(6, ScalarType.UINT32, true), + field7: ProtoField(7, ScalarType.UINT64, true), + field8: ProtoField(8, ScalarType.UINT32, true), + field9: ProtoField(9, ScalarType.UINT32, true), + newId: ProtoField(12, ScalarType.UINT64, true), + forward: ProtoField(15, () => ForwardHead, true), +}; + +export const MessageBody = { + richText: ProtoField(1, () => RichText, true), + msgContent: ProtoField(2, ScalarType.BYTES, true), + msgEncryptContent: ProtoField(3, ScalarType.BYTES, true), +}; + +export const Message = { + routingHead: ProtoField(1, () => RoutingHead, true), + contentHead: ProtoField(2, () => ContentHead, true), + body: ProtoField(3, () => MessageBody, true), + clientSequence: ProtoField(4, ScalarType.UINT32, true), + random: ProtoField(5, ScalarType.UINT32, true), + syncCookie: ProtoField(6, ScalarType.BYTES, true), + via: ProtoField(8, ScalarType.UINT32, true), + dataStatist: ProtoField(9, ScalarType.UINT32, true), + ctrl: ProtoField(12, () => MessageControl, true), + multiSendSeq: ProtoField(14, ScalarType.UINT32), +}; + +export const MessageControl = { + msgFlag: ProtoField(1, ScalarType.INT32), +}; + +export const PushMsg = { + message: ProtoField(1, () => PushMsgBody), + status: ProtoField(3, ScalarType.INT32, true), + pingFlag: ProtoField(5, ScalarType.INT32, true), + generalFlag: ProtoField(9, ScalarType.INT32, true), +}; + +export const PushMsgBody = { + responseHead: ProtoField(1, () => ResponseHead), + contentHead: ProtoField(2, () => ContentHead), + body: ProtoField(3, () => MessageBody, true), +}; + +export const ResponseHead = { + fromUin: ProtoField(1, ScalarType.UINT32), + fromUid: ProtoField(2, ScalarType.STRING, true), + type: ProtoField(3, ScalarType.UINT32), + sigMap: ProtoField(4, ScalarType.UINT32), + toUin: ProtoField(5, ScalarType.UINT32), + toUid: ProtoField(6, ScalarType.STRING, true), + forward: ProtoField(7, () => ResponseForward, true), + grp: ProtoField(8, () => ResponseGrp, true), +}; + +export const RoutingHead = { + c2c: ProtoField(1, () => C2C, true), + grp: ProtoField(2, () => Grp, true), + grpTmp: ProtoField(3, () => GrpTmp, true), + wpaTmp: ProtoField(6, () => WPATmp, true), + trans0X211: ProtoField(15, () => Trans0X211, true), +}; + diff --git a/src/core/proto/message/notify.ts b/src/core/proto/message/notify.ts new file mode 100644 index 00000000..e739e151 --- /dev/null +++ b/src/core/proto/message/notify.ts @@ -0,0 +1,22 @@ +import { ScalarType } from "@protobuf-ts/runtime"; +import { ProtoField } from "../NapProto"; + +export const FriendRecall = { + info: ProtoField(1, () => FriendRecallInfo), + instId: ProtoField(2, ScalarType.UINT32), + appId: ProtoField(3, ScalarType.UINT32), + longMessageFlag: ProtoField(4, ScalarType.UINT32), + reserved: ProtoField(5, ScalarType.BYTES), +}; + +export const FriendRecallInfo = { + fromUid: ProtoField(1, ScalarType.STRING), + toUid: ProtoField(2, ScalarType.STRING), + sequence: ProtoField(3, ScalarType.UINT32), + newId: ProtoField(4, ScalarType.UINT64), + time: ProtoField(5, ScalarType.UINT32), + random: ProtoField(6, ScalarType.UINT32), + pkgNum: ProtoField(7, ScalarType.UINT32), + pkgIndex: ProtoField(8, ScalarType.UINT32), + divSeq: ProtoField(9, ScalarType.UINT32), +}; diff --git a/src/core/proto/message/routing.ts b/src/core/proto/message/routing.ts new file mode 100644 index 00000000..7de44012 --- /dev/null +++ b/src/core/proto/message/routing.ts @@ -0,0 +1,41 @@ +import { ScalarType } from "@protobuf-ts/runtime"; +import { ProtoField } from "../NapProto"; + +export const ForwardHead = { + field1: ProtoField(1, ScalarType.UINT32, true), + field2: ProtoField(2, ScalarType.UINT32, true), + field3: ProtoField(3, ScalarType.UINT32, true), + unknownBase64: ProtoField(5, ScalarType.STRING, true), + avatar: ProtoField(6, ScalarType.STRING, true), +}; + +export const Grp = { + groupCode: ProtoField(1, ScalarType.UINT32, true), +}; + +export const GrpTmp = { + groupUin: ProtoField(1, ScalarType.UINT32, true), + toUin: ProtoField(2, ScalarType.UINT32, true), +}; + +export const ResponseForward = { + friendName: ProtoField(6, ScalarType.STRING, true), +}; + +export const ResponseGrp = { + groupUin: ProtoField(1, ScalarType.UINT32), + memberName: ProtoField(4, ScalarType.STRING), + unknown5: ProtoField(5, ScalarType.UINT32), + groupName: ProtoField(7, ScalarType.STRING), +}; + +export const Trans0X211 = { + toUin: ProtoField(1, ScalarType.UINT64, true), + ccCmd: ProtoField(2, ScalarType.UINT32, true), + uid: ProtoField(8, ScalarType.STRING, true), +}; + +export const WPATmp = { + toUin: ProtoField(1, ScalarType.UINT64), + sig: ProtoField(2, ScalarType.BYTES), +};