Change license to AGPL
This commit:
- Updates the `LICENSE` file
- Start every file with something like:
// Copyright YEAR_FIRST_PUBLISHED Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
---
First, I removed existing license headers with this Ruby 3.1.2 script:
require 'set'
EXTENSIONS_TO_CHECK = Set['.h', '.hpp', '.cpp', '.m', '.mm', '.pch', '.swift']
same = 0
different = 0
all_files = `git ls-files`.lines.map { |line| line.strip }
all_files.each do |relative_path|
if relative_path == 'Pods'
next
end
unless EXTENSIONS_TO_CHECK.include? File.extname(relative_path)
next
end
path = File.expand_path(relative_path)
contents = File.read(path)
new_contents = contents.sub(/\/\/\n\/\/ Copyright .*\n\/\/\n\n/, '')
if contents == new_contents
same += 1
else
different += 1
end
File.write(path, new_contents)
end
puts "updated #{different} file(s), left #{same} untouched"
I'm sure this script could be improved, but it worked well enough.
Then, I created `Scripts/lint/lint-license-headers` and ran it to auto-
fix a lot of files. This changed the mode of some files, but I think
that's actually desirable. For example,
`SignalServiceKit/src/Util/AppContext.m` previously had a mode of
`0755/-rwxr-xr-x`, and it's now `0644/-rw-r--r--`.
Then I fixed some stragglers and updated the precommit script.
See [a similar change in the Desktop app][0].
[0]: 8bfaf598af
94 lines
2.9 KiB
Objective-C
94 lines
2.9 KiB
Objective-C
//
|
|
// Copyright 2017 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
#import <Mantle/MTLModel+NSCoding.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@class SDSAnyWriteTransaction;
|
|
@class SDSDatabaseStorage;
|
|
|
|
@protocol SDSRecordDelegate
|
|
|
|
- (void)updateRowId:(int64_t)rowId;
|
|
|
|
@end
|
|
|
|
/// Controls whether the full text search index is updated when the model object is updated.
|
|
typedef NS_ENUM(NSUInteger, TSFTSIndexMode) {
|
|
/// This object is not part of the full text search index.
|
|
TSFTSIndexModeNever,
|
|
/// This object is automatically indexed when inserted or removed,
|
|
/// but updates must be indexed manually (usually by `SDSDatabase.touch(...)`).
|
|
TSFTSIndexModeManualUpdates,
|
|
/// This object is automatically (re)indexed when inserted, updated, or removed.
|
|
TSFTSIndexModeAlways
|
|
};
|
|
|
|
#pragma mark -
|
|
|
|
// TODO: Rename and/or merge with BaseModel.
|
|
@interface TSYapDatabaseObject : MTLModel <SDSRecordDelegate>
|
|
|
|
/**
|
|
* The unique identifier of the stored object
|
|
*/
|
|
@property (nonatomic, readonly) NSString *uniqueId;
|
|
|
|
// This property should only ever be accesssed within a GRDB write transaction.
|
|
@property (atomic, readonly, nullable) NSNumber *grdbId;
|
|
|
|
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
|
|
|
/**
|
|
* Initializes a new database object with a unique identifier
|
|
*
|
|
* @param uniqueId Key used for the key-value store
|
|
*
|
|
* @return Initialized object
|
|
*/
|
|
- (instancetype)initWithUniqueId:(NSString *)uniqueId NS_DESIGNATED_INITIALIZER;
|
|
|
|
- (instancetype)initWithGrdbId:(int64_t)grdbId uniqueId:(NSString *)uniqueId NS_DESIGNATED_INITIALIZER;
|
|
|
|
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
|
|
|
/**
|
|
* Returns the collection to which the object belongs.
|
|
*
|
|
* @return Key (string) identifying the collection
|
|
*/
|
|
+ (NSString *)collection;
|
|
|
|
// These methods should only ever be called within a GRDB write transaction.
|
|
- (void)clearRowId;
|
|
// This method is used to facilitate a database object replacement. See:
|
|
// OWSRecoverableDecryptionPlaceholder.
|
|
- (void)replaceRowId:(int64_t)rowId uniqueId:(NSString *)uniqueId;
|
|
|
|
@property (nonatomic, readonly) NSString *transactionFinalizationKey;
|
|
|
|
#pragma mark -
|
|
|
|
// GRDB TODO: As a perf optimization, we could only call these
|
|
// methods for certain kinds of models which we could
|
|
// detect at compile time.
|
|
@property (nonatomic, readonly) BOOL shouldBeSaved;
|
|
|
|
@property (class, nonatomic, readonly) TSFTSIndexMode FTSIndexMode;
|
|
|
|
#pragma mark - Data Store Write Hooks
|
|
|
|
- (void)anyWillInsertWithTransaction:(SDSAnyWriteTransaction *)transaction;
|
|
- (void)anyDidInsertWithTransaction:(SDSAnyWriteTransaction *)transaction;
|
|
- (void)anyWillUpdateWithTransaction:(SDSAnyWriteTransaction *)transaction;
|
|
- (void)anyDidUpdateWithTransaction:(SDSAnyWriteTransaction *)transaction;
|
|
- (void)anyWillRemoveWithTransaction:(SDSAnyWriteTransaction *)transaction;
|
|
- (void)anyDidRemoveWithTransaction:(SDSAnyWriteTransaction *)transaction;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|