2017-11-26 01:14:02 +00:00
|
|
|
// This file has been automatically generated by writeMessageClasses.js
|
|
|
|
|
|
2020-01-06 12:10:40 +00:00
|
|
|
import { UUID } from '../UUID';
|
|
|
|
|
import { MessageFlags } from '../../enums/MessageFlags';
|
|
|
|
|
import { MessageBase } from '../MessageBase';
|
|
|
|
|
import { Message } from '../../enums/Message';
|
2017-11-26 01:14:02 +00:00
|
|
|
|
|
|
|
|
export class EmailMessageReplyMessage implements MessageBase
|
|
|
|
|
{
|
|
|
|
|
name = 'EmailMessageReply';
|
|
|
|
|
messageFlags = MessageFlags.Trusted | MessageFlags.FrequencyLow;
|
|
|
|
|
id = Message.EmailMessageReply;
|
|
|
|
|
|
|
|
|
|
DataBlock: {
|
|
|
|
|
ObjectID: UUID;
|
|
|
|
|
More: number;
|
|
|
|
|
Time: number;
|
2017-11-26 19:47:41 +00:00
|
|
|
FromAddress: Buffer;
|
|
|
|
|
Subject: Buffer;
|
|
|
|
|
Data: Buffer;
|
|
|
|
|
MailFilter: Buffer;
|
2017-11-26 01:14:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
getSize(): number
|
|
|
|
|
{
|
|
|
|
|
return (this.DataBlock['FromAddress'].length + 1 + this.DataBlock['Subject'].length + 1 + this.DataBlock['Data'].length + 2 + this.DataBlock['MailFilter'].length + 1) + 24;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
writeToBuffer(buf: Buffer, pos: number): number
|
|
|
|
|
{
|
|
|
|
|
const startPos = pos;
|
|
|
|
|
this.DataBlock['ObjectID'].writeToBuffer(buf, pos);
|
|
|
|
|
pos += 16;
|
|
|
|
|
buf.writeUInt32LE(this.DataBlock['More'], pos);
|
|
|
|
|
pos += 4;
|
|
|
|
|
buf.writeUInt32LE(this.DataBlock['Time'], pos);
|
|
|
|
|
pos += 4;
|
|
|
|
|
buf.writeUInt8(this.DataBlock['FromAddress'].length, pos++);
|
2017-11-26 19:47:41 +00:00
|
|
|
this.DataBlock['FromAddress'].copy(buf, pos);
|
2017-11-26 01:14:02 +00:00
|
|
|
pos += this.DataBlock['FromAddress'].length;
|
|
|
|
|
buf.writeUInt8(this.DataBlock['Subject'].length, pos++);
|
2017-11-26 19:47:41 +00:00
|
|
|
this.DataBlock['Subject'].copy(buf, pos);
|
2017-11-26 01:14:02 +00:00
|
|
|
pos += this.DataBlock['Subject'].length;
|
|
|
|
|
buf.writeUInt16LE(this.DataBlock['Data'].length, pos);
|
|
|
|
|
pos += 2;
|
2017-11-26 19:47:41 +00:00
|
|
|
this.DataBlock['Data'].copy(buf, pos);
|
2017-11-26 01:14:02 +00:00
|
|
|
pos += this.DataBlock['Data'].length;
|
|
|
|
|
buf.writeUInt8(this.DataBlock['MailFilter'].length, pos++);
|
2017-11-26 19:47:41 +00:00
|
|
|
this.DataBlock['MailFilter'].copy(buf, pos);
|
2017-11-26 01:14:02 +00:00
|
|
|
pos += this.DataBlock['MailFilter'].length;
|
|
|
|
|
return pos - startPos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readFromBuffer(buf: Buffer, pos: number): number
|
|
|
|
|
{
|
|
|
|
|
const startPos = pos;
|
|
|
|
|
let varLength = 0;
|
|
|
|
|
const newObjDataBlock: {
|
|
|
|
|
ObjectID: UUID,
|
|
|
|
|
More: number,
|
|
|
|
|
Time: number,
|
2017-11-26 19:47:41 +00:00
|
|
|
FromAddress: Buffer,
|
|
|
|
|
Subject: Buffer,
|
|
|
|
|
Data: Buffer,
|
|
|
|
|
MailFilter: Buffer
|
2017-11-26 01:14:02 +00:00
|
|
|
} = {
|
|
|
|
|
ObjectID: UUID.zero(),
|
|
|
|
|
More: 0,
|
|
|
|
|
Time: 0,
|
2017-11-26 19:47:41 +00:00
|
|
|
FromAddress: Buffer.allocUnsafe(0),
|
|
|
|
|
Subject: Buffer.allocUnsafe(0),
|
|
|
|
|
Data: Buffer.allocUnsafe(0),
|
|
|
|
|
MailFilter: Buffer.allocUnsafe(0)
|
2017-11-26 01:14:02 +00:00
|
|
|
};
|
|
|
|
|
newObjDataBlock['ObjectID'] = new UUID(buf, pos);
|
|
|
|
|
pos += 16;
|
|
|
|
|
newObjDataBlock['More'] = buf.readUInt32LE(pos);
|
|
|
|
|
pos += 4;
|
|
|
|
|
newObjDataBlock['Time'] = buf.readUInt32LE(pos);
|
|
|
|
|
pos += 4;
|
|
|
|
|
varLength = buf.readUInt8(pos++);
|
2017-11-30 04:11:59 +00:00
|
|
|
newObjDataBlock['FromAddress'] = buf.slice(pos, pos + varLength);
|
2017-11-26 01:14:02 +00:00
|
|
|
pos += varLength;
|
|
|
|
|
varLength = buf.readUInt8(pos++);
|
2017-11-30 04:11:59 +00:00
|
|
|
newObjDataBlock['Subject'] = buf.slice(pos, pos + varLength);
|
2017-11-26 01:14:02 +00:00
|
|
|
pos += varLength;
|
|
|
|
|
varLength = buf.readUInt16LE(pos);
|
|
|
|
|
pos += 2;
|
2017-11-30 04:11:59 +00:00
|
|
|
newObjDataBlock['Data'] = buf.slice(pos, pos + varLength);
|
2017-11-26 01:14:02 +00:00
|
|
|
pos += varLength;
|
|
|
|
|
varLength = buf.readUInt8(pos++);
|
2017-11-30 04:11:59 +00:00
|
|
|
newObjDataBlock['MailFilter'] = buf.slice(pos, pos + varLength);
|
2017-11-26 01:14:02 +00:00
|
|
|
pos += varLength;
|
|
|
|
|
this.DataBlock = newObjDataBlock;
|
|
|
|
|
return pos - startPos;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|