NullMessage sent before verification sync should not be silent (#1857)
This commit is contained in:
parent
c195ba2630
commit
2fdb048721
3 changed files with 72 additions and 64 deletions
|
@ -39085,8 +39085,7 @@ MessageReceiver.prototype.extend({
|
|||
console.log('Got SyncMessage Request');
|
||||
return this.removeFromCache(envelope);
|
||||
} else if (syncMessage.read && syncMessage.read.length) {
|
||||
console.log('read messages',
|
||||
'from', envelope.source + '.' + envelope.sourceDevice);
|
||||
console.log('read messages from', this.getEnvelopeId(envelope));
|
||||
return this.handleRead(envelope, syncMessage.read);
|
||||
} else if (syncMessage.verified) {
|
||||
return this.handleVerified(envelope, syncMessage.verified);
|
||||
|
@ -40095,7 +40094,12 @@ MessageSender.prototype = {
|
|||
syncVerification: function(destination, state, identityKey) {
|
||||
var myNumber = textsecure.storage.user.getNumber();
|
||||
var myDevice = textsecure.storage.user.getDeviceId();
|
||||
if (myDevice != 1) {
|
||||
var now = Date.now();
|
||||
|
||||
if (myDevice === 1) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
// First send a null message to mask the sync message.
|
||||
var nullMessage = new textsecure.protobuf.NullMessage();
|
||||
|
||||
|
@ -40109,8 +40113,10 @@ MessageSender.prototype = {
|
|||
var contentMessage = new textsecure.protobuf.Content();
|
||||
contentMessage.nullMessage = nullMessage;
|
||||
|
||||
var silent = true;
|
||||
return this.sendIndividualProto(destination, contentMessage, Date.now(), silent).then(function() {
|
||||
// We want the NullMessage to look like a normal outgoing message; not silent
|
||||
const promise = this.sendIndividualProto(destination, contentMessage, now);
|
||||
|
||||
return promise.then(function() {
|
||||
var verified = new textsecure.protobuf.Verified();
|
||||
verified.state = state;
|
||||
verified.destination = destination;
|
||||
|
@ -40123,11 +40129,9 @@ MessageSender.prototype = {
|
|||
var contentMessage = new textsecure.protobuf.Content();
|
||||
contentMessage.syncMessage = syncMessage;
|
||||
|
||||
return this.sendIndividualProto(myNumber, contentMessage, Date.now(), silent);
|
||||
var silent = true;
|
||||
return this.sendIndividualProto(myNumber, contentMessage, now, silent);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
sendGroupProto: function(numbers, proto, timestamp) {
|
||||
|
|
|
@ -618,8 +618,7 @@ MessageReceiver.prototype.extend({
|
|||
console.log('Got SyncMessage Request');
|
||||
return this.removeFromCache(envelope);
|
||||
} else if (syncMessage.read && syncMessage.read.length) {
|
||||
console.log('read messages',
|
||||
'from', envelope.source + '.' + envelope.sourceDevice);
|
||||
console.log('read messages from', this.getEnvelopeId(envelope));
|
||||
return this.handleRead(envelope, syncMessage.read);
|
||||
} else if (syncMessage.verified) {
|
||||
return this.handleVerified(envelope, syncMessage.verified);
|
||||
|
|
|
@ -420,7 +420,12 @@ MessageSender.prototype = {
|
|||
syncVerification: function(destination, state, identityKey) {
|
||||
var myNumber = textsecure.storage.user.getNumber();
|
||||
var myDevice = textsecure.storage.user.getDeviceId();
|
||||
if (myDevice != 1) {
|
||||
var now = Date.now();
|
||||
|
||||
if (myDevice === 1) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
// First send a null message to mask the sync message.
|
||||
var nullMessage = new textsecure.protobuf.NullMessage();
|
||||
|
||||
|
@ -434,8 +439,10 @@ MessageSender.prototype = {
|
|||
var contentMessage = new textsecure.protobuf.Content();
|
||||
contentMessage.nullMessage = nullMessage;
|
||||
|
||||
var silent = true;
|
||||
return this.sendIndividualProto(destination, contentMessage, Date.now(), silent).then(function() {
|
||||
// We want the NullMessage to look like a normal outgoing message; not silent
|
||||
const promise = this.sendIndividualProto(destination, contentMessage, now);
|
||||
|
||||
return promise.then(function() {
|
||||
var verified = new textsecure.protobuf.Verified();
|
||||
verified.state = state;
|
||||
verified.destination = destination;
|
||||
|
@ -448,11 +455,9 @@ MessageSender.prototype = {
|
|||
var contentMessage = new textsecure.protobuf.Content();
|
||||
contentMessage.syncMessage = syncMessage;
|
||||
|
||||
return this.sendIndividualProto(myNumber, contentMessage, Date.now(), silent);
|
||||
var silent = true;
|
||||
return this.sendIndividualProto(myNumber, contentMessage, now, silent);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
sendGroupProto: function(numbers, proto, timestamp) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue