Apply special handling to verification sync messages

// FREEBIE
pull/749/head
lilia 8 years ago committed by Scott Nonnenberg
parent 1614a6f1b8
commit 4f2f622598

@ -85,9 +85,20 @@
'You must verify individual contacts.'); 'You must verify individual contacts.');
} }
// TODO: handle the incoming key from the sync messages - need different behavior var promise;
// if that key doesn't match the current key if (options.viaSyncMessage) {
return textsecure.storage.protocol.setVerified(this.id, DEFAULT).then(function() { // handle the incoming key from the sync messages - need different
// behavior if that key doesn't match the current key
promise = textsecure.storage.protocol.processVerifiedMessage(
this.id, DEFAULT, options.key
);
} else {
promise = textsecure.storage.protocol.setVerified(
this.id, DEFAULT
);
}
return promise.then(function() {
return this.save({verified: DEFAULT}); return this.save({verified: DEFAULT});
}.bind(this)).then(function() { }.bind(this)).then(function() {
this.addVerifiedChange(this.id, false); this.addVerifiedChange(this.id, false);
@ -107,9 +118,20 @@
'You must verify individual contacts.'); 'You must verify individual contacts.');
} }
// TODO: handle the incoming key from the sync messages - need different behavior var promise;
// if that key doesn't match the current key if (options.viaSyncMessage) {
return textsecure.storage.protocol.setVerified(this.id, VERIFIED).then(function() { // handle the incoming key from the sync messages - need different
// behavior if that key doesn't match the current key
promise = textsecure.storage.protocol.processVerifiedMessage(
this.id, VERIFIED, options.key
);
} else {
promise = textsecure.storage.protocol.setVerified(
this.id, VERIFIED
);
}
return promise.then(function() {
return this.save({verified: VERIFIED}); return this.save({verified: VERIFIED});
}.bind(this)).then(function() { }.bind(this)).then(function() {
this.addVerifiedChange(this.id, true); this.addVerifiedChange(this.id, true);

Loading…
Cancel
Save