Merge branch 'mkirk/sync-whitelist'

pull/1/head
Michael Kirk 8 years ago
commit 1e31eb6cdd

@ -715,13 +715,14 @@ NS_ASSUME_NONNULL_BEGIN
OWSSignalServiceProtosDataMessage *dataMessage = syncMessage.sent.message; OWSSignalServiceProtosDataMessage *dataMessage = syncMessage.sent.message;
OWSAssert(dataMessage); OWSAssert(dataMessage);
NSString *destination = syncMessage.sent.destination; NSString *destination = syncMessage.sent.destination;
if (dataMessage && destination.length > 0 && [dataMessage hasProfileKey]) { if (dataMessage && destination.length > 0 && dataMessage.hasProfileKey) {
// If we observe a linked device sending our profile key to another // If we observe a linked device sending our profile key to another
// user, we can infer that that user belongs in our profile whitelist. // user, we can infer that that user belongs in our profile whitelist.
[self.profileManager addUserToProfileWhitelist:destination]; if (dataMessage.hasGroup) {
[self.profileManager addGroupIdToProfileWhitelist:dataMessage.group.id];
// TODO: Can we also infer when groups are added to the whitelist } else {
// from sent messages to groups? [self.profileManager addUserToProfileWhitelist:destination];
}
} }
if ([self isDataMessageGroupAvatarUpdate:syncMessage.sent.message]) { if ([self isDataMessageGroupAvatarUpdate:syncMessage.sent.message]) {

@ -19,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL)isThreadInProfileWhitelist:(TSThread *)thread; - (BOOL)isThreadInProfileWhitelist:(TSThread *)thread;
- (void)addUserToProfileWhitelist:(NSString *)recipientId; - (void)addUserToProfileWhitelist:(NSString *)recipientId;
- (void)addGroupIdToProfileWhitelist:(NSData *)groupId;
@end @end

Loading…
Cancel
Save