|
|
|
@ -38815,6 +38815,7 @@ function Message(options) {
|
|
|
|
|
this.recipients = options.recipients;
|
|
|
|
|
this.timestamp = options.timestamp;
|
|
|
|
|
this.needsSync = options.needsSync;
|
|
|
|
|
this.expireTimer = options.expireTimer;
|
|
|
|
|
|
|
|
|
|
if (!(this.recipients instanceof Array) || this.recipients.length < 1) {
|
|
|
|
|
throw new Error('Invalid recipient list');
|
|
|
|
@ -38828,6 +38829,12 @@ function Message(options) {
|
|
|
|
|
throw new Error('Invalid timestamp');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.expireTimer !== undefined) {
|
|
|
|
|
if (typeof this.expireTimer !== 'number' || !(this.expireTimer >= 0)) {
|
|
|
|
|
throw new Error('Invalid expireTimer');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.attachments) {
|
|
|
|
|
if (!(this.attachments instanceof Array)) {
|
|
|
|
|
throw new Error('Invalid message attachments');
|
|
|
|
@ -38876,6 +38883,9 @@ Message.prototype = {
|
|
|
|
|
proto.group.id = stringToArrayBuffer(this.group.id);
|
|
|
|
|
proto.group.type = this.group.type
|
|
|
|
|
}
|
|
|
|
|
if (this.expireTimer) {
|
|
|
|
|
proto.expireTimer = this.expireTimer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.dataMessage = proto;
|
|
|
|
|
return proto;
|
|
|
|
@ -39072,13 +39082,14 @@ MessageSender.prototype = {
|
|
|
|
|
}.bind(this));
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
sendMessageToNumber: function(number, messageText, attachments, timestamp) {
|
|
|
|
|
sendMessageToNumber: function(number, messageText, attachments, timestamp, expireTimer) {
|
|
|
|
|
return this.sendMessage({
|
|
|
|
|
recipients : [number],
|
|
|
|
|
body : messageText,
|
|
|
|
|
timestamp : timestamp,
|
|
|
|
|
attachments : attachments,
|
|
|
|
|
needsSync : true
|
|
|
|
|
needsSync : true,
|
|
|
|
|
expireTimer : expireTimer
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -39101,7 +39112,7 @@ MessageSender.prototype = {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
sendMessageToGroup: function(groupId, messageText, attachments, timestamp) {
|
|
|
|
|
sendMessageToGroup: function(groupId, messageText, attachments, timestamp, expireTimer) {
|
|
|
|
|
return textsecure.storage.groups.getNumbers(groupId).then(function(numbers) {
|
|
|
|
|
if (numbers === undefined)
|
|
|
|
|
return Promise.reject(new Error("Unknown Group"));
|
|
|
|
@ -39118,6 +39129,7 @@ MessageSender.prototype = {
|
|
|
|
|
timestamp : timestamp,
|
|
|
|
|
attachments : attachments,
|
|
|
|
|
needsSync : true,
|
|
|
|
|
expireTimer : expireTimer,
|
|
|
|
|
group: {
|
|
|
|
|
id: groupId,
|
|
|
|
|
type: textsecure.protobuf.GroupContext.Type.DELIVER
|
|
|
|
|