Skip to content

Commit

Permalink
Update protos with planned changes for stories
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Nonnenberg <scott@signal.org>
  • Loading branch information
automated-signal and scottnonnenberg-signal committed Nov 16, 2021
1 parent 99e40c0 commit 749bd6b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
14 changes: 14 additions & 0 deletions protos/SignalService.proto
Expand Up @@ -43,6 +43,7 @@ message Content {
optional TypingMessage typingMessage = 6;
optional bytes senderKeyDistributionMessage = 7;
optional bytes decryptionErrorMessage = 8;
optional StoryMessage storyMessage = 9;
}

// Everything in CallingMessage must be kept in sync with RingRTC (ringrtc-node).
Expand Down Expand Up @@ -248,6 +249,11 @@ message DataMessage {
optional string eraId = 1;
}

message StoryContext {
optional string authorUuid = 1;
optional uint64 sentTimestamp = 2;
}

enum ProtocolVersion {
option allow_alias = true;

Expand Down Expand Up @@ -280,6 +286,8 @@ message DataMessage {
optional Delete delete = 17;
repeated BodyRange bodyRanges = 18;
optional GroupCallUpdate groupCallUpdate = 19;
reserved /* Payment payment */ 20;
optional StoryContext storyContext = 21;
}

message NullMessage {
Expand Down Expand Up @@ -308,6 +316,12 @@ message TypingMessage {
optional bytes groupId = 3;
}

message StoryMessage {
optional bytes profileKey = 1;
optional GroupContextV2 group = 2;
optional AttachmentPointer attachment = 3;
}

message Verified {
enum State {
DEFAULT = 0;
Expand Down
20 changes: 19 additions & 1 deletion ts/textsecure/MessageReceiver.ts
Expand Up @@ -1607,7 +1607,17 @@ export default class MessageReceiver
envelope: UnsealedEnvelope,
msg: Proto.IDataMessage
): Promise<void> {
log.info('MessageReceiver.handleDataMessage', this.getEnvelopeId(envelope));
const logId = this.getEnvelopeId(envelope);
log.info('MessageReceiver.handleDataMessage', logId);

if (msg.storyContext) {
log.info(
`MessageReceiver.handleDataMessage/${logId}: Dropping incoming dataMessage with storyContext field`
);
this.removeFromCache(envelope);
return undefined;
}

let p: Promise<void> = Promise.resolve();
// eslint-disable-next-line no-bitwise
const destination = envelope.sourceUuid;
Expand Down Expand Up @@ -1792,6 +1802,14 @@ export default class MessageReceiver
await this.handleTypingMessage(envelope, content.typingMessage);
return;
}
if (content.storyMessage) {
const logId = this.getEnvelopeId(envelope);
log.info(
`innerHandleContentMessage/${logId}: Dropping incoming message with storyMessage field`
);
this.removeFromCache(envelope);
return;
}

this.removeFromCache(envelope);

Expand Down

0 comments on commit 749bd6b

Please sign in to comment.