Sync with android protos

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 0106b1a429
commit 2975d4d5d2

@ -2,8 +2,8 @@
PROTOC=protoc \ PROTOC=protoc \
--plugin=/usr/local/bin/protoc-gen-objc \ --plugin=/usr/local/bin/protoc-gen-objc \
--proto_path="${HOME}/src/WhisperSystems/protobuf-objc/src/compiler/" \ --proto_path="${HOME}/src/signal/protobuf-objc/src/compiler/" \
--proto_path="${HOME}/src/WhisperSystems/protobuf-objc/src/compiler/google/protobuf/" \ --proto_path="${HOME}/src/signal/protobuf-objc/src/compiler/google/protobuf/" \
--proto_path='./' --proto_path='./'
all: signal_service_proto provisioning_protos fingerprint_protos all: signal_service_proto provisioning_protos fingerprint_protos

@ -87,12 +87,11 @@ message DataMessage {
PROFILE_KEY_UPDATE = 4; PROFILE_KEY_UPDATE = 4;
} }
message Quote message Quote {
{ optional uint64 id = 1;
optional uint64 id = 1; optional string author = 2;
optional string author = 2; optional string text = 3;
optional string text = 3; repeated AttachmentPointer attachments = 4;
optional AttachmentPointer attachment = 4;
} }
optional string body = 1; optional string body = 1;
@ -102,7 +101,7 @@ message DataMessage {
optional uint32 expireTimer = 5; optional uint32 expireTimer = 5;
optional bytes profileKey = 6; optional bytes profileKey = 6;
optional uint64 timestamp = 7; optional uint64 timestamp = 7;
optional Quote quote = 8; optional Quote quote = 8;
} }
message NullMessage { message NullMessage {

@ -473,7 +473,7 @@ NSString *const kTSOutgoingMessageSentRecipientAll = @"kTSOutgoingMessageSentRec
[attachmentBuilder setFileName:self.quotedMessage.sourceFilename]; [attachmentBuilder setFileName:self.quotedMessage.sourceFilename];
} }
[attachmentBuilder setContentType:self.quotedMessage.contentType]; [attachmentBuilder setContentType:self.quotedMessage.contentType];
[quoteBuilder setAttachmentBuilder:attachmentBuilder]; [quoteBuilder.attachments addObject:[attachmentBuilder build]];
hasQuotedAttachment = YES; hasQuotedAttachment = YES;
} }

@ -1097,8 +1097,8 @@ NS_ASSUME_NONNULL_BEGIN
NSData *_Nullable thumbnailData = nil; NSData *_Nullable thumbnailData = nil;
NSString *_Nullable contentType = nil; NSString *_Nullable contentType = nil;
if ([quoteProto hasAttachment]) { if (quoteProto.attachments.count > 0) {
OWSSignalServiceProtosAttachmentPointer *attachmentProto = [quoteProto attachment]; OWSSignalServiceProtosAttachmentPointer *attachmentProto = quoteProto.attachments.firstObject;
if ([attachmentProto hasContentType] && attachmentProto.contentType.length > 0) { if ([attachmentProto hasContentType] && attachmentProto.contentType.length > 0) {
contentType = attachmentProto.contentType; contentType = attachmentProto.contentType;

@ -1,6 +1,4 @@
// // Generated by the protocol buffer compiler. DO NOT EDIT!
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <ProtocolBuffers/ProtocolBuffers.h> #import <ProtocolBuffers/ProtocolBuffers.h>
@ -105,6 +103,7 @@
@class PBUninterpretedOptionNamePart; @class PBUninterpretedOptionNamePart;
@class PBUninterpretedOptionNamePartBuilder; @class PBUninterpretedOptionNamePartBuilder;
typedef NS_ENUM(SInt32, OWSSignalServiceProtosEnvelopeType) { typedef NS_ENUM(SInt32, OWSSignalServiceProtosEnvelopeType) {
OWSSignalServiceProtosEnvelopeTypeUnknown = 0, OWSSignalServiceProtosEnvelopeTypeUnknown = 0,
OWSSignalServiceProtosEnvelopeTypeCiphertext = 1, OWSSignalServiceProtosEnvelopeTypeCiphertext = 1,
@ -860,26 +859,25 @@ NSString *NSStringFromOWSSignalServiceProtosGroupContextType(OWSSignalServicePro
#define Quote_id @"id" #define Quote_id @"id"
#define Quote_author @"author" #define Quote_author @"author"
#define Quote_text @"text" #define Quote_text @"text"
#define Quote_attachment @"attachment" #define Quote_attachments @"attachments"
@interface OWSSignalServiceProtosDataMessageQuote : PBGeneratedMessage <GeneratedMessageProtocol> { @interface OWSSignalServiceProtosDataMessageQuote : PBGeneratedMessage <GeneratedMessageProtocol> {
@private @private
BOOL hasId_ : 1; BOOL hasId_ : 1;
BOOL hasAuthor_ : 1; BOOL hasAuthor_ : 1;
BOOL hasText_ : 1; BOOL hasText_ : 1;
BOOL hasAttachment_ : 1;
UInt64 id; UInt64 id;
NSString *author; NSString *author;
NSString *text; NSString *text;
OWSSignalServiceProtosAttachmentPointer *attachment; NSMutableArray *attachmentsArray;
} }
- (BOOL)hasId; - (BOOL)hasId;
- (BOOL)hasAuthor; - (BOOL)hasAuthor;
- (BOOL)hasText; - (BOOL)hasText;
- (BOOL)hasAttachment;
@property (readonly) UInt64 id; @property (readonly) UInt64 id;
@property (readonly, strong) NSString *author; @property (readonly, strong) NSString *author;
@property (readonly, strong) NSString *text; @property (readonly, strong) NSString *text;
@property (readonly, strong) OWSSignalServiceProtosAttachmentPointer *attachment; @property (readonly, strong) NSArray<OWSSignalServiceProtosAttachmentPointer *> *attachments;
- (OWSSignalServiceProtosAttachmentPointer *)attachmentsAtIndex:(NSUInteger)index;
+ (instancetype)defaultInstance; + (instancetype)defaultInstance;
- (instancetype)defaultInstance; - (instancetype)defaultInstance;
@ -936,13 +934,12 @@ NSString *NSStringFromOWSSignalServiceProtosGroupContextType(OWSSignalServicePro
- (OWSSignalServiceProtosDataMessageQuoteBuilder *)setText:(NSString *)value; - (OWSSignalServiceProtosDataMessageQuoteBuilder *)setText:(NSString *)value;
- (OWSSignalServiceProtosDataMessageQuoteBuilder *)clearText; - (OWSSignalServiceProtosDataMessageQuoteBuilder *)clearText;
- (BOOL)hasAttachment; - (NSMutableArray<OWSSignalServiceProtosAttachmentPointer *> *)attachments;
- (OWSSignalServiceProtosAttachmentPointer *)attachment; - (OWSSignalServiceProtosAttachmentPointer *)attachmentsAtIndex:(NSUInteger)index;
- (OWSSignalServiceProtosDataMessageQuoteBuilder *)setAttachment:(OWSSignalServiceProtosAttachmentPointer *)value; - (OWSSignalServiceProtosDataMessageQuoteBuilder *)addAttachments:(OWSSignalServiceProtosAttachmentPointer *)value;
- (OWSSignalServiceProtosDataMessageQuoteBuilder *)setAttachmentBuilder: - (OWSSignalServiceProtosDataMessageQuoteBuilder *)setAttachmentsArray:
(OWSSignalServiceProtosAttachmentPointerBuilder *)builderForValue; (NSArray<OWSSignalServiceProtosAttachmentPointer *> *)array;
- (OWSSignalServiceProtosDataMessageQuoteBuilder *)mergeAttachment:(OWSSignalServiceProtosAttachmentPointer *)value; - (OWSSignalServiceProtosDataMessageQuoteBuilder *)clearAttachments;
- (OWSSignalServiceProtosDataMessageQuoteBuilder *)clearAttachment;
@end @end
@interface OWSSignalServiceProtosDataMessageBuilder : PBGeneratedMessageBuilder { @interface OWSSignalServiceProtosDataMessageBuilder : PBGeneratedMessageBuilder {

@ -1,9 +1,6 @@
// // Generated by the protocol buffer compiler. DO NOT EDIT!
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSSignalServiceProtos.pb.h" #import "OWSSignalServiceProtos.pb.h"
// @@protoc_insertion_point(imports) // @@protoc_insertion_point(imports)
@implementation OWSSignalServiceProtosOwssignalServiceProtosRoot @implementation OWSSignalServiceProtosOwssignalServiceProtosRoot
@ -3255,7 +3252,7 @@ NSString *NSStringFromOWSSignalServiceProtosDataMessageFlags(OWSSignalServicePro
@property UInt64 id; @property UInt64 id;
@property (strong) NSString *author; @property (strong) NSString *author;
@property (strong) NSString *text; @property (strong) NSString *text;
@property (strong) OWSSignalServiceProtosAttachmentPointer *attachment; @property (strong) NSMutableArray<OWSSignalServiceProtosAttachmentPointer *> *attachmentsArray;
@end @end
@implementation OWSSignalServiceProtosDataMessageQuote @implementation OWSSignalServiceProtosDataMessageQuote
@ -3287,22 +3284,14 @@ NSString *NSStringFromOWSSignalServiceProtosDataMessageFlags(OWSSignalServicePro
hasText_ = !!_value_; hasText_ = !!_value_;
} }
@synthesize text; @synthesize text;
- (BOOL)hasAttachment @synthesize attachmentsArray;
{ @dynamic attachments;
return !!hasAttachment_;
}
- (void)setHasAttachment:(BOOL)_value_
{
hasAttachment_ = !!_value_;
}
@synthesize attachment;
- (instancetype)init - (instancetype)init
{ {
if ((self = [super init])) { if ((self = [super init])) {
self.id = 0L; self.id = 0L;
self.author = @""; self.author = @"";
self.text = @""; self.text = @"";
self.attachment = [OWSSignalServiceProtosAttachmentPointer defaultInstance];
} }
return self; return self;
} }
@ -3321,6 +3310,14 @@ static OWSSignalServiceProtosDataMessageQuote *defaultOWSSignalServiceProtosData
{ {
return defaultOWSSignalServiceProtosDataMessageQuoteInstance; return defaultOWSSignalServiceProtosDataMessageQuoteInstance;
} }
- (NSArray<OWSSignalServiceProtosAttachmentPointer *> *)attachments
{
return attachmentsArray;
}
- (OWSSignalServiceProtosAttachmentPointer *)attachmentsAtIndex:(NSUInteger)index
{
return [attachmentsArray objectAtIndex:index];
}
- (BOOL)isInitialized - (BOOL)isInitialized
{ {
return YES; return YES;
@ -3336,9 +3333,10 @@ static OWSSignalServiceProtosDataMessageQuote *defaultOWSSignalServiceProtosData
if (self.hasText) { if (self.hasText) {
[output writeString:3 value:self.text]; [output writeString:3 value:self.text];
} }
if (self.hasAttachment) { [self.attachmentsArray
[output writeMessage:4 value:self.attachment]; enumerateObjectsUsingBlock:^(OWSSignalServiceProtosAttachmentPointer *element, NSUInteger idx, BOOL *stop) {
} [output writeMessage:4 value:element];
}];
[self.unknownFields writeToCodedOutputStream:output]; [self.unknownFields writeToCodedOutputStream:output];
} }
- (SInt32)serializedSize - (SInt32)serializedSize
@ -3358,9 +3356,10 @@ static OWSSignalServiceProtosDataMessageQuote *defaultOWSSignalServiceProtosData
if (self.hasText) { if (self.hasText) {
size_ += computeStringSize(3, self.text); size_ += computeStringSize(3, self.text);
} }
if (self.hasAttachment) { [self.attachmentsArray
size_ += computeMessageSize(4, self.attachment); enumerateObjectsUsingBlock:^(OWSSignalServiceProtosAttachmentPointer *element, NSUInteger idx, BOOL *stop) {
} size_ += computeMessageSize(4, element);
}];
size_ += self.unknownFields.serializedSize; size_ += self.unknownFields.serializedSize;
memoizedSerializedSize = size_; memoizedSerializedSize = size_;
return size_; return size_;
@ -3429,11 +3428,12 @@ static OWSSignalServiceProtosDataMessageQuote *defaultOWSSignalServiceProtosData
if (self.hasText) { if (self.hasText) {
[output appendFormat:@"%@%@: %@\n", indent, @"text", self.text]; [output appendFormat:@"%@%@: %@\n", indent, @"text", self.text];
} }
if (self.hasAttachment) { [self.attachmentsArray
[output appendFormat:@"%@%@ {\n", indent, @"attachment"]; enumerateObjectsUsingBlock:^(OWSSignalServiceProtosAttachmentPointer *element, NSUInteger idx, BOOL *stop) {
[self.attachment writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@%@ {\n", indent, @"attachments"];
[output appendFormat:@"%@}\n", indent]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]];
} [output appendFormat:@"%@}\n", indent];
}];
[self.unknownFields writeDescriptionTo:output withIndent:indent]; [self.unknownFields writeDescriptionTo:output withIndent:indent];
} }
- (void)storeInDictionary:(NSMutableDictionary *)dictionary - (void)storeInDictionary:(NSMutableDictionary *)dictionary
@ -3447,10 +3447,10 @@ static OWSSignalServiceProtosDataMessageQuote *defaultOWSSignalServiceProtosData
if (self.hasText) { if (self.hasText) {
[dictionary setObject:self.text forKey:@"text"]; [dictionary setObject:self.text forKey:@"text"];
} }
if (self.hasAttachment) { for (OWSSignalServiceProtosAttachmentPointer *element in self.attachmentsArray) {
NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary];
[self.attachment storeInDictionary:messageDictionary]; [element storeInDictionary:elementDictionary];
[dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"attachment"]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"attachments"];
} }
[self.unknownFields storeInDictionary:dictionary]; [self.unknownFields storeInDictionary:dictionary];
} }
@ -3465,9 +3465,8 @@ static OWSSignalServiceProtosDataMessageQuote *defaultOWSSignalServiceProtosData
OWSSignalServiceProtosDataMessageQuote *otherMessage = other; OWSSignalServiceProtosDataMessageQuote *otherMessage = other;
return self.hasId == otherMessage.hasId && (!self.hasId || self.id == otherMessage.id) return self.hasId == otherMessage.hasId && (!self.hasId || self.id == otherMessage.id)
&& self.hasAuthor == otherMessage.hasAuthor && (!self.hasAuthor || [self.author isEqual:otherMessage.author]) && self.hasAuthor == otherMessage.hasAuthor && (!self.hasAuthor || [self.author isEqual:otherMessage.author])
&& self.hasText == otherMessage.hasText && (!self.hasText || [self.text isEqual:otherMessage.text]) && self.hasText == otherMessage.hasText && (!self.hasText || [self.text isEqual:otherMessage.text]) &&
&& self.hasAttachment == otherMessage.hasAttachment [self.attachmentsArray isEqualToArray:otherMessage.attachmentsArray]
&& (!self.hasAttachment || [self.attachment isEqual:otherMessage.attachment])
&& (self.unknownFields == otherMessage.unknownFields && (self.unknownFields == otherMessage.unknownFields
|| (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields]));
} }
@ -3483,9 +3482,10 @@ static OWSSignalServiceProtosDataMessageQuote *defaultOWSSignalServiceProtosData
if (self.hasText) { if (self.hasText) {
hashCode = hashCode * 31 + [self.text hash]; hashCode = hashCode * 31 + [self.text hash];
} }
if (self.hasAttachment) { [self.attachmentsArray
hashCode = hashCode * 31 + [self.attachment hash]; enumerateObjectsUsingBlock:^(OWSSignalServiceProtosAttachmentPointer *element, NSUInteger idx, BOOL *stop) {
} hashCode = hashCode * 31 + [element hash];
}];
hashCode = hashCode * 31 + [self.unknownFields hash]; hashCode = hashCode * 31 + [self.unknownFields hash];
return hashCode; return hashCode;
} }
@ -3546,8 +3546,12 @@ static OWSSignalServiceProtosDataMessageQuote *defaultOWSSignalServiceProtosData
if (other.hasText) { if (other.hasText) {
[self setText:other.text]; [self setText:other.text];
} }
if (other.hasAttachment) { if (other.attachmentsArray.count > 0) {
[self mergeAttachment:other.attachment]; if (resultQuote.attachmentsArray == nil) {
resultQuote.attachmentsArray = [[NSMutableArray alloc] initWithArray:other.attachmentsArray];
} else {
[resultQuote.attachmentsArray addObjectsFromArray:other.attachmentsArray];
}
} }
[self mergeUnknownFields:other.unknownFields]; [self mergeUnknownFields:other.unknownFields];
return self; return self;
@ -3591,11 +3595,8 @@ static OWSSignalServiceProtosDataMessageQuote *defaultOWSSignalServiceProtosData
case 34: { case 34: {
OWSSignalServiceProtosAttachmentPointerBuilder *subBuilder = OWSSignalServiceProtosAttachmentPointerBuilder *subBuilder =
[OWSSignalServiceProtosAttachmentPointer builder]; [OWSSignalServiceProtosAttachmentPointer builder];
if (self.hasAttachment) {
[subBuilder mergeFrom:self.attachment];
}
[input readMessage:subBuilder extensionRegistry:extensionRegistry]; [input readMessage:subBuilder extensionRegistry:extensionRegistry];
[self setAttachment:[subBuilder buildPartial]]; [self addAttachments:[subBuilder buildPartial]];
break; break;
} }
} }
@ -3661,41 +3662,31 @@ static OWSSignalServiceProtosDataMessageQuote *defaultOWSSignalServiceProtosData
resultQuote.text = @""; resultQuote.text = @"";
return self; return self;
} }
- (BOOL)hasAttachment - (NSMutableArray<OWSSignalServiceProtosAttachmentPointer *> *)attachments
{ {
return resultQuote.hasAttachment; return resultQuote.attachmentsArray;
} }
- (OWSSignalServiceProtosAttachmentPointer *)attachment - (OWSSignalServiceProtosAttachmentPointer *)attachmentsAtIndex:(NSUInteger)index
{ {
return resultQuote.attachment; return [resultQuote attachmentsAtIndex:index];
} }
- (OWSSignalServiceProtosDataMessageQuoteBuilder *)setAttachment:(OWSSignalServiceProtosAttachmentPointer *)value - (OWSSignalServiceProtosDataMessageQuoteBuilder *)addAttachments:(OWSSignalServiceProtosAttachmentPointer *)value
{ {
resultQuote.hasAttachment = YES; if (resultQuote.attachmentsArray == nil) {
resultQuote.attachment = value; resultQuote.attachmentsArray = [[NSMutableArray alloc] init];
}
[resultQuote.attachmentsArray addObject:value];
return self; return self;
} }
- (OWSSignalServiceProtosDataMessageQuoteBuilder *)setAttachmentBuilder: - (OWSSignalServiceProtosDataMessageQuoteBuilder *)setAttachmentsArray:
(OWSSignalServiceProtosAttachmentPointerBuilder *)builderForValue (NSArray<OWSSignalServiceProtosAttachmentPointer *> *)array
{
return [self setAttachment:[builderForValue build]];
}
- (OWSSignalServiceProtosDataMessageQuoteBuilder *)mergeAttachment:(OWSSignalServiceProtosAttachmentPointer *)value
{ {
if (resultQuote.hasAttachment resultQuote.attachmentsArray = [[NSMutableArray alloc] initWithArray:array];
&& resultQuote.attachment != [OWSSignalServiceProtosAttachmentPointer defaultInstance]) {
resultQuote.attachment = [[[OWSSignalServiceProtosAttachmentPointer builderWithPrototype:resultQuote.attachment]
mergeFrom:value] buildPartial];
} else {
resultQuote.attachment = value;
}
resultQuote.hasAttachment = YES;
return self; return self;
} }
- (OWSSignalServiceProtosDataMessageQuoteBuilder *)clearAttachment - (OWSSignalServiceProtosDataMessageQuoteBuilder *)clearAttachments
{ {
resultQuote.hasAttachment = NO; resultQuote.attachmentsArray = nil;
resultQuote.attachment = [OWSSignalServiceProtosAttachmentPointer defaultInstance];
return self; return self;
} }
@end @end

Loading…
Cancel
Save