rcs-data
Version:
RCS消息数据结构
60 lines • 2.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImdnDemand = void 0;
const RcsMsgDecorator_1 = require("./RcsMsgDecorator");
const cpim_1 = require("../cpim");
const mime_1 = require("../mime");
const constants_1 = require("./constants");
const debug = require('debug')('rcs:imdndemand');
var DispositionNotification;
(function (DispositionNotification) {
DispositionNotification["positive-delivery"] = "positive-delivery";
DispositionNotification["display"] = "display";
})(DispositionNotification || (DispositionNotification = {}));
class ImdnDemand extends RcsMsgDecorator_1.RcsMsgDecorator {
constructor(rcsmsg, dateTime = true, messageId, dispositionNotification) {
let { from, to } = rcsmsg;
let cpimmsg = (0, cpim_1.factory)({ from, to, dateTime, mime: rcsmsg.mime });
let mime = (0, mime_1.factory)({
contentType: 'message/cpim',
body: () => cpimmsg.toString(),
});
super(rcsmsg, mime);
this._dispositionNotification = dispositionNotification || [
DispositionNotification['positive-delivery'],
DispositionNotification.display,
];
cpimmsg.addNS(constants_1.IMDN_NS_URI, constants_1.IMDN_NS_PREFIX);
cpimmsg.header(constants_1.IMDN_NS_URI, 'Disposition-Notification', this._dispositionNotification.join(','));
if (messageId)
cpimmsg.header(constants_1.IMDN_NS_URI, 'Message-ID', messageId);
cpimmsg.orderedHeaderNames.push(...constants_1.Cpim_Ordered_Header_Names);
this._cpimmsg = cpimmsg;
}
get from() {
return this.rcsmsg.from;
}
get to() {
return this._rcsmsg.to;
}
get dateTime() {
return this._cpimmsg.dateTime;
}
set messageId(value) {
this._cpimmsg.header(constants_1.IMDN_NS_URI, 'Message-ID', value);
}
get messageId() {
return this._cpimmsg.header(constants_1.IMDN_NS_URI, 'Message-ID');
}
get content() {
return this._rcsmsg.content;
}
get suggestions() {
return this._rcsmsg.suggestions;
}
get messagePlainObject() {
return this._rcsmsg.messagePlainObject;
}
}
exports.ImdnDemand = ImdnDemand;
//# sourceMappingURL=ImdnDemand.js.map