Add protocol support for disappearing messages

This commit is contained in:
lilia 2016-09-20 14:36:57 -07:00
parent 11ed42a379
commit b3e932dce8
3 changed files with 17 additions and 10 deletions

View file

@ -38237,7 +38237,7 @@ MessageReceiver.prototype.extend({
throw e; throw e;
}); });
}, },
handleSentMessage: function(destination, timestamp, message) { handleSentMessage: function(destination, timestamp, message, expirationStartTimestamp) {
var p = Promise.resolve(); var p = Promise.resolve();
if ((message.flags & textsecure.protobuf.DataMessage.Flags.END_SESSION) == if ((message.flags & textsecure.protobuf.DataMessage.Flags.END_SESSION) ==
textsecure.protobuf.DataMessage.Flags.END_SESSION ) { textsecure.protobuf.DataMessage.Flags.END_SESSION ) {
@ -38247,9 +38247,10 @@ MessageReceiver.prototype.extend({
return this.processDecrypted(message, this.number).then(function(message) { return this.processDecrypted(message, this.number).then(function(message) {
var ev = new Event('sent'); var ev = new Event('sent');
ev.data = { ev.data = {
destination : destination, destination : destination,
timestamp : timestamp.toNumber(), timestamp : timestamp.toNumber(),
message : message message : message,
expirationStartTimestamp : expirationStartTimestamp
}; };
this.dispatchEvent(ev); this.dispatchEvent(ev);
}.bind(this)); }.bind(this));
@ -38310,7 +38311,8 @@ MessageReceiver.prototype.extend({
return this.handleSentMessage( return this.handleSentMessage(
sentMessage.destination, sentMessage.destination,
sentMessage.timestamp, sentMessage.timestamp,
sentMessage.message sentMessage.message,
sentMessage.expirationStartTimestamp
); );
} else if (syncMessage.contacts) { } else if (syncMessage.contacts) {
this.handleContacts(syncMessage.contacts); this.handleContacts(syncMessage.contacts);

View file

@ -166,7 +166,7 @@ MessageReceiver.prototype.extend({
throw e; throw e;
}); });
}, },
handleSentMessage: function(destination, timestamp, message) { handleSentMessage: function(destination, timestamp, message, expirationStartTimestamp) {
var p = Promise.resolve(); var p = Promise.resolve();
if ((message.flags & textsecure.protobuf.DataMessage.Flags.END_SESSION) == if ((message.flags & textsecure.protobuf.DataMessage.Flags.END_SESSION) ==
textsecure.protobuf.DataMessage.Flags.END_SESSION ) { textsecure.protobuf.DataMessage.Flags.END_SESSION ) {
@ -176,9 +176,10 @@ MessageReceiver.prototype.extend({
return this.processDecrypted(message, this.number).then(function(message) { return this.processDecrypted(message, this.number).then(function(message) {
var ev = new Event('sent'); var ev = new Event('sent');
ev.data = { ev.data = {
destination : destination, destination : destination,
timestamp : timestamp.toNumber(), timestamp : timestamp.toNumber(),
message : message message : message,
expirationStartTimestamp : expirationStartTimestamp
}; };
this.dispatchEvent(ev); this.dispatchEvent(ev);
}.bind(this)); }.bind(this));
@ -239,7 +240,8 @@ MessageReceiver.prototype.extend({
return this.handleSentMessage( return this.handleSentMessage(
sentMessage.destination, sentMessage.destination,
sentMessage.timestamp, sentMessage.timestamp,
sentMessage.message sentMessage.message,
sentMessage.expirationStartTimestamp
); );
} else if (syncMessage.contacts) { } else if (syncMessage.contacts) {
this.handleContacts(syncMessage.contacts); this.handleContacts(syncMessage.contacts);

View file

@ -29,12 +29,14 @@ message Content {
message DataMessage { message DataMessage {
enum Flags { enum Flags {
END_SESSION = 1; END_SESSION = 1;
EXPIRATION_TIMER_UPDATE = 2;
} }
optional string body = 1; optional string body = 1;
repeated AttachmentPointer attachments = 2; repeated AttachmentPointer attachments = 2;
optional GroupContext group = 3; optional GroupContext group = 3;
optional uint32 flags = 4; optional uint32 flags = 4;
optional uint32 expireTimer = 5;
} }
message SyncMessage { message SyncMessage {
@ -42,6 +44,7 @@ message SyncMessage {
optional string destination = 1; optional string destination = 1;
optional uint64 timestamp = 2; optional uint64 timestamp = 2;
optional DataMessage message = 3; optional DataMessage message = 3;
optional uint64 expirationStartTimestamp = 4;
} }
message Contacts { message Contacts {