From 10c404d4558475e1a7a92dc9ff8b22349a98042b Mon Sep 17 00:00:00 2001 From: pk5ls20 Date: Fri, 18 Oct 2024 16:57:55 +0800 Subject: [PATCH] feat: adjust packetElement & packetMsg --- src/core/packet/msg/element.ts | 7 ++++--- src/core/packet/msg/message.ts | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/packet/msg/element.ts b/src/core/packet/msg/element.ts index f66b6609..3aa9f936 100644 --- a/src/core/packet/msg/element.ts +++ b/src/core/packet/msg/element.ts @@ -19,7 +19,6 @@ import { SendFileElement, SendMarkdownElement, SendMarketFaceElement, - SendMessageElement, SendPicElement, SendPttElement, SendReplyElement, @@ -28,13 +27,13 @@ import { SendVideoElement } from "@/core"; import {MsgInfo} from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq"; -import {PacketMsg} from "@/core/packet/msg/message"; +import {PacketMsg, PacketSendMsgElement} from "@/core/packet/msg/message"; // raw <-> packet // TODO: check ob11 -> raw impl! // TODO: parse to raw element // TODO: SendStructLongMsgElement -export abstract class IPacketMsgElement { +export abstract class IPacketMsgElement { protected constructor(rawElement: T) { } @@ -149,6 +148,7 @@ export class PacketMsgReplyElement extends IPacketMsgElement { targetUin: number; targetUid: string; time: number; + elems: PacketMsg[]; constructor(element: SendReplyElement) { super(element); @@ -158,6 +158,7 @@ export class PacketMsgReplyElement extends IPacketMsgElement { this.targetUin = Number(element.replyElement.senderUin ?? 0); this.targetUid = element.replyElement.senderUidStr ?? ''; this.time = Number(element.replyElement.replyMsgTime ?? 0); + this.elems = []; // TODO: in replyElement.sourceMsgTextElems } get isGroupReply(): boolean { diff --git a/src/core/packet/msg/message.ts b/src/core/packet/msg/message.ts index 6c8b9f29..5ce10f54 100644 --- a/src/core/packet/msg/message.ts +++ b/src/core/packet/msg/message.ts @@ -1,5 +1,7 @@ import {IPacketMsgElement} from "@/core/packet/msg/element"; -import {SendMessageElement} from "@/core"; +import {SendMessageElement, SendStructLongMsgElement} from "@/core"; + +export type PacketSendMsgElement = SendMessageElement | SendStructLongMsgElement export interface PacketMsg { seq?: number; @@ -9,5 +11,5 @@ export interface PacketMsg { senderUin: number; senderName: string; time: number; - msg: IPacketMsgElement[] + msg: IPacketMsgElement[] }