Handle and send isRecipientUpdate sync messages

* Handle and send isRecipientUpdate sync messages
* Disable sending isRecipientUpdates for now
This commit is contained in:
Scott Nonnenberg 2019-05-09 08:38:05 -07:00
parent 8c365b1a3a
commit 13ad4abaea
5 changed files with 128 additions and 56 deletions

View file

@ -865,12 +865,14 @@ MessageReceiver.prototype.extend({
throw e;
}
},
handleSentMessage(envelope, sentContainer, msg) {
handleSentMessage(envelope, sentContainer) {
const {
destination,
timestamp,
message: msg,
expirationStartTimestamp,
unidentifiedStatus,
isRecipientUpdate,
} = sentContainer;
let p = Promise.resolve();
@ -905,6 +907,7 @@ MessageReceiver.prototype.extend({
device: envelope.sourceDevice,
unidentifiedStatus,
message,
isRecipientUpdate,
};
if (expirationStartTimestamp) {
ev.data.expirationStartTimestamp = expirationStartTimestamp.toNumber();
@ -1090,7 +1093,7 @@ MessageReceiver.prototype.extend({
'from',
this.getEnvelopeId(envelope)
);
return this.handleSentMessage(envelope, sentMessage, sentMessage.message);
return this.handleSentMessage(envelope, sentMessage);
} else if (syncMessage.contacts) {
return this.handleContacts(envelope, syncMessage.contacts);
} else if (syncMessage.groups) {

View file

@ -23,7 +23,6 @@ function Message(options) {
this.flags = options.flags;
this.recipients = options.recipients;
this.timestamp = options.timestamp;
this.needsSync = options.needsSync;
this.expireTimer = options.expireTimer;
this.profileKey = options.profileKey;
@ -438,6 +437,7 @@ MessageSender.prototype = {
expirationStartTimestamp,
sentTo = [],
unidentifiedDeliveries = [],
isUpdate = false,
options
) {
const myNumber = textsecure.storage.user.getNumber();
@ -468,6 +468,10 @@ MessageSender.prototype = {
Object.create(null)
);
if (isUpdate) {
syncMessage.isRecipientUpdate = true;
}
// Though this field has 'unidenified' in the name, it should have entries for each
// number we sent to.
if (sentTo && sentTo.length) {
@ -841,7 +845,6 @@ MessageSender.prototype = {
attachments,
quote,
preview,
needsSync: true,
expireTimer,
profileKey,
},
@ -939,7 +942,6 @@ MessageSender.prototype = {
attachments,
quote,
preview,
needsSync: true,
expireTimer,
profileKey,
group: {
@ -1054,7 +1056,6 @@ MessageSender.prototype = {
const attrs = {
recipients: numbers,
timestamp,
needsSync: true,
expireTimer,
profileKey,
flags: textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
@ -1087,7 +1088,6 @@ MessageSender.prototype = {
{
recipients: [number],
timestamp,
needsSync: true,
expireTimer,
profileKey,
flags: textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,