Skip to content

Commit e5ab668

Browse files
committed
changing db format for identitykey stuff to be more consistent
1 parent 55f685e commit e5ab668

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

TextSecureiOS/Model/TSMessagesDatabase.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ + (BOOL)databaseCreateWithError:(NSError **)error {
6969
return;
7070
}
7171

72-
if (![db executeUpdate:@"CREATE TABLE IF NOT EXISTS contacts (registered_id TEXT PRIMARY KEY, relay TEXT, identityKey BLOB UNIQUE, device_ids BLOB, verifiedIdentity INTEGER)"]) {
72+
if (![db executeUpdate:@"CREATE TABLE IF NOT EXISTS contacts (registered_id TEXT PRIMARY KEY, relay TEXT, identity_key BLOB UNIQUE, device_ids BLOB, verified_identity INTEGER)"]) {
7373
return;
7474
}
7575

@@ -183,13 +183,13 @@ + (BOOL)storeContact:(TSContact*)contact {
183183
__block BOOL updateSuccess = YES;
184184

185185
[messagesDb.dbQueue inDatabase:^(FMDatabase *db) {
186-
NSMutableDictionary *parameterDict = [@{@"registered_id": contact.registeredID, @"verifiedIdentity": [NSNumber numberWithBool:contact.identityKeyIsVerified]} mutableCopy];
186+
NSMutableDictionary *parameterDict = [@{@"registered_id": contact.registeredID, @"verified_identity": [NSNumber numberWithBool:contact.identityKeyIsVerified]} mutableCopy];
187187

188188
[parameterDict setObject:contact.relay?:[NSNull null] forKey:@"relay"];
189-
[parameterDict setObject:contact.identityKey?:[NSNull null] forKey:@"identityKey"];
189+
[parameterDict setObject:contact.identityKey?:[NSNull null] forKey:@"identity_key"];
190190
[parameterDict setObject:contact.deviceIDs?:[NSNull null] forKey:@"device_ids"];
191191

192-
if (![db executeUpdate:@"INSERT OR REPLACE INTO contacts VALUES (:registered_id, :relay, :identityKey, :device_ids, :verifiedIdentity)" withParameterDictionary:parameterDict]){
192+
if (![db executeUpdate:@"INSERT OR REPLACE INTO contacts VALUES (:registered_id, :relay, :identity_key, :device_ids, :verified_identity)" withParameterDictionary:parameterDict]){
193193
DLog(@"Error updating DB: %@", [db lastErrorMessage]);
194194
updateSuccess = NO;
195195
}
@@ -215,12 +215,12 @@ + (TSContact*)contactForRegisteredID:(NSString*)registredID {
215215

216216
if ([searchInDB next]) {
217217
contact = [[TSContact alloc] initWithRegisteredID:[searchInDB stringForColumn:@"registered_id"] relay:[searchInDB stringForColumn:@"relay"]];
218-
contact.identityKey = [searchInDB dataForColumn:@"identityKey"];
218+
contact.identityKey = [searchInDB dataForColumn:@"identity_key"];
219219
NSData *deviceIds = [searchInDB dataForColumn:@"device_ids"];
220220
if (deviceIds) {
221221
contact.deviceIDs = [NSKeyedUnarchiver unarchiveObjectWithData:deviceIds];
222222
}
223-
contact.identityKeyIsVerified = [searchInDB boolForColumn:@"verifiedIdentity"];
223+
contact.identityKeyIsVerified = [searchInDB boolForColumn:@"verified_identity"];
224224
}
225225
[searchInDB close];
226226
}];

0 commit comments

Comments
 (0)