|
|
@ -25,6 +25,7 @@ function Message(options) {
|
|
|
|
this.needsSync = options.needsSync;
|
|
|
|
this.needsSync = options.needsSync;
|
|
|
|
this.expireTimer = options.expireTimer;
|
|
|
|
this.expireTimer = options.expireTimer;
|
|
|
|
this.profileKey = options.profileKey;
|
|
|
|
this.profileKey = options.profileKey;
|
|
|
|
|
|
|
|
this.profile = options.profile;
|
|
|
|
|
|
|
|
|
|
|
|
if (!(this.recipients instanceof Array) || this.recipients.length < 1) {
|
|
|
|
if (!(this.recipients instanceof Array) || this.recipients.length < 1) {
|
|
|
|
throw new Error('Invalid recipient list');
|
|
|
|
throw new Error('Invalid recipient list');
|
|
|
@ -132,6 +133,12 @@ Message.prototype = {
|
|
|
|
proto.profileKey = this.profileKey;
|
|
|
|
proto.profileKey = this.profileKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.profile) {
|
|
|
|
|
|
|
|
const contact = new textsecure.protobuf.DataMessage.Contact();
|
|
|
|
|
|
|
|
contact.name = this.profile.name;
|
|
|
|
|
|
|
|
proto.contact.push(contact);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.dataMessage = proto;
|
|
|
|
this.dataMessage = proto;
|
|
|
|
return proto;
|
|
|
|
return proto;
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -656,6 +663,8 @@ MessageSender.prototype = {
|
|
|
|
profileKey,
|
|
|
|
profileKey,
|
|
|
|
options
|
|
|
|
options
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
|
|
|
|
const myNumber = textsecure.storage.user.getNumber();
|
|
|
|
|
|
|
|
const profile = textsecure.storage.impl.getProfile(myNumber);
|
|
|
|
return this.sendMessage(
|
|
|
|
return this.sendMessage(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
recipients: [number],
|
|
|
|
recipients: [number],
|
|
|
@ -666,6 +675,7 @@ MessageSender.prototype = {
|
|
|
|
needsSync: true,
|
|
|
|
needsSync: true,
|
|
|
|
expireTimer,
|
|
|
|
expireTimer,
|
|
|
|
profileKey,
|
|
|
|
profileKey,
|
|
|
|
|
|
|
|
profile,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options
|
|
|
|
options
|
|
|
|
);
|
|
|
|
);
|
|
|
|