feat: adjust packetElement & packetMsg

This commit is contained in:
pk5ls20 2024-10-18 16:57:55 +08:00
parent dfdca11155
commit 10c404d455
No known key found for this signature in database
GPG Key ID: 6370ED7A169F493A
2 changed files with 8 additions and 5 deletions

View File

@ -19,7 +19,6 @@ import {
SendFileElement, SendFileElement,
SendMarkdownElement, SendMarkdownElement,
SendMarketFaceElement, SendMarketFaceElement,
SendMessageElement,
SendPicElement, SendPicElement,
SendPttElement, SendPttElement,
SendReplyElement, SendReplyElement,
@ -28,13 +27,13 @@ import {
SendVideoElement SendVideoElement
} from "@/core"; } from "@/core";
import {MsgInfo} from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq"; 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 // raw <-> packet
// TODO: check ob11 -> raw impl! // TODO: check ob11 -> raw impl!
// TODO: parse to raw element // TODO: parse to raw element
// TODO: SendStructLongMsgElement // TODO: SendStructLongMsgElement
export abstract class IPacketMsgElement<T extends SendMessageElement | SendStructLongMsgElement> { export abstract class IPacketMsgElement<T extends PacketSendMsgElement> {
protected constructor(rawElement: T) { protected constructor(rawElement: T) {
} }
@ -149,6 +148,7 @@ export class PacketMsgReplyElement extends IPacketMsgElement<SendReplyElement> {
targetUin: number; targetUin: number;
targetUid: string; targetUid: string;
time: number; time: number;
elems: PacketMsg[];
constructor(element: SendReplyElement) { constructor(element: SendReplyElement) {
super(element); super(element);
@ -158,6 +158,7 @@ export class PacketMsgReplyElement extends IPacketMsgElement<SendReplyElement> {
this.targetUin = Number(element.replyElement.senderUin ?? 0); this.targetUin = Number(element.replyElement.senderUin ?? 0);
this.targetUid = element.replyElement.senderUidStr ?? ''; this.targetUid = element.replyElement.senderUidStr ?? '';
this.time = Number(element.replyElement.replyMsgTime ?? 0); this.time = Number(element.replyElement.replyMsgTime ?? 0);
this.elems = []; // TODO: in replyElement.sourceMsgTextElems
} }
get isGroupReply(): boolean { get isGroupReply(): boolean {

View File

@ -1,5 +1,7 @@
import {IPacketMsgElement} from "@/core/packet/msg/element"; import {IPacketMsgElement} from "@/core/packet/msg/element";
import {SendMessageElement} from "@/core"; import {SendMessageElement, SendStructLongMsgElement} from "@/core";
export type PacketSendMsgElement = SendMessageElement | SendStructLongMsgElement
export interface PacketMsg { export interface PacketMsg {
seq?: number; seq?: number;
@ -9,5 +11,5 @@ export interface PacketMsg {
senderUin: number; senderUin: number;
senderName: string; senderName: string;
time: number; time: number;
msg: IPacketMsgElement<SendMessageElement>[] msg: IPacketMsgElement<PacketSendMsgElement>[]
} }