You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
//
|
|
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "OWSSyncGroupsRequestMessage.h"
|
|
|
|
#import "NSDate+OWS.h"
|
|
|
|
#import "OWSSignalServiceProtos.pb.h"
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
@interface OWSSyncGroupsRequestMessage ()
|
|
|
|
|
|
|
|
@property (nonatomic) NSData *groupId;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
|
|
|
|
@implementation OWSSyncGroupsRequestMessage
|
|
|
|
|
|
|
|
- (instancetype)initWithThread:(nullable TSThread *)thread groupId:(NSData *)groupId
|
|
|
|
{
|
|
|
|
self = [super initWithTimestamp:[NSDate ows_millisecondTimeStamp] inThread:thread];
|
|
|
|
if (!self) {
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
OWSAssert(groupId.length > 0);
|
|
|
|
_groupId = groupId;
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)saveWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
|
|
|
{
|
|
|
|
// override superclass with no-op.
|
|
|
|
//
|
|
|
|
// There's no need to save this message, since it's not displayed to the user.
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)shouldSyncTranscript
|
|
|
|
{
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)isSilent
|
|
|
|
{
|
|
|
|
// Avoid "phantom messages"
|
|
|
|
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (OWSSignalServiceProtosDataMessageBuilder *)dataMessageBuilder
|
|
|
|
{
|
|
|
|
OWSSignalServiceProtosGroupContextBuilder *groupContextBuilder = [OWSSignalServiceProtosGroupContextBuilder new];
|
|
|
|
[groupContextBuilder setType:OWSSignalServiceProtosGroupContextTypeRequestInfo];
|
|
|
|
[groupContextBuilder setId:self.groupId];
|
|
|
|
|
|
|
|
OWSSignalServiceProtosDataMessageBuilder *builder = [OWSSignalServiceProtosDataMessageBuilder new];
|
|
|
|
[builder setGroupBuilder:groupContextBuilder];
|
|
|
|
|
|
|
|
return builder;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|