Skip to content

Commit

Permalink
Add protocol support for disappearing messages
Browse files Browse the repository at this point in the history
  • Loading branch information
liliakai committed Sep 29, 2016
1 parent 11ed42a commit b3e932d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
12 changes: 7 additions & 5 deletions js/libtextsecure.js
Expand Up @@ -38237,7 +38237,7 @@ MessageReceiver.prototype.extend({
throw e;
});
},
handleSentMessage: function(destination, timestamp, message) {
handleSentMessage: function(destination, timestamp, message, expirationStartTimestamp) {
var p = Promise.resolve();
if ((message.flags & textsecure.protobuf.DataMessage.Flags.END_SESSION) ==
textsecure.protobuf.DataMessage.Flags.END_SESSION ) {
Expand All @@ -38247,9 +38247,10 @@ MessageReceiver.prototype.extend({
return this.processDecrypted(message, this.number).then(function(message) {
var ev = new Event('sent');
ev.data = {
destination : destination,
timestamp : timestamp.toNumber(),
message : message
destination : destination,
timestamp : timestamp.toNumber(),
message : message,
expirationStartTimestamp : expirationStartTimestamp
};
this.dispatchEvent(ev);
}.bind(this));
Expand Down Expand Up @@ -38310,7 +38311,8 @@ MessageReceiver.prototype.extend({
return this.handleSentMessage(
sentMessage.destination,
sentMessage.timestamp,
sentMessage.message
sentMessage.message,
sentMessage.expirationStartTimestamp
);
} else if (syncMessage.contacts) {
this.handleContacts(syncMessage.contacts);
Expand Down
12 changes: 7 additions & 5 deletions libtextsecure/message_receiver.js
Expand Up @@ -166,7 +166,7 @@ MessageReceiver.prototype.extend({
throw e;
});
},
handleSentMessage: function(destination, timestamp, message) {
handleSentMessage: function(destination, timestamp, message, expirationStartTimestamp) {
var p = Promise.resolve();
if ((message.flags & textsecure.protobuf.DataMessage.Flags.END_SESSION) ==
textsecure.protobuf.DataMessage.Flags.END_SESSION ) {
Expand All @@ -176,9 +176,10 @@ MessageReceiver.prototype.extend({
return this.processDecrypted(message, this.number).then(function(message) {
var ev = new Event('sent');
ev.data = {
destination : destination,
timestamp : timestamp.toNumber(),
message : message
destination : destination,
timestamp : timestamp.toNumber(),
message : message,
expirationStartTimestamp : expirationStartTimestamp
};
this.dispatchEvent(ev);
}.bind(this));
Expand Down Expand Up @@ -239,7 +240,8 @@ MessageReceiver.prototype.extend({
return this.handleSentMessage(
sentMessage.destination,
sentMessage.timestamp,
sentMessage.message
sentMessage.message,
sentMessage.expirationStartTimestamp
);
} else if (syncMessage.contacts) {
this.handleContacts(syncMessage.contacts);
Expand Down
3 changes: 3 additions & 0 deletions protos/IncomingPushMessageSignal.proto
Expand Up @@ -29,19 +29,22 @@ message Content {
message DataMessage {
enum Flags {
END_SESSION = 1;
EXPIRATION_TIMER_UPDATE = 2;
}

optional string body = 1;
repeated AttachmentPointer attachments = 2;
optional GroupContext group = 3;
optional uint32 flags = 4;
optional uint32 expireTimer = 5;
}

message SyncMessage {
message Sent {
optional string destination = 1;
optional uint64 timestamp = 2;
optional DataMessage message = 3;
optional uint64 expirationStartTimestamp = 4;
}

message Contacts {
Expand Down

0 comments on commit b3e932d

Please sign in to comment.