Skip to content

Commit

Permalink
Add missing db transaction in DataLayer addSelfChatForAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
tmolitor-stud-tu committed Nov 21, 2024
1 parent 5f5ad7e commit cd929f8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Monal/Classes/DataLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,14 @@ -(void) persistState:(NSDictionary*) state forAccount:(NSNumber*) accountID

-(BOOL) addSelfChatForAccount:(NSNumber*) accountID
{
BOOL encrypt = NO;
return [self.db boolWriteTransaction:^{
BOOL encrypt = NO;
#ifndef DISABLE_OMEMO
encrypt = [[HelperTools defaultsDB] boolForKey:@"OMEMODefaultOn"];
encrypt = [[HelperTools defaultsDB] boolForKey:@"OMEMODefaultOn"];
#endif// DISABLE_OMEMO
NSDictionary* accountDetails = [self detailsForAccount:accountID];
return [self.db executeNonQuery:@"INSERT INTO buddylist ('account_id', 'buddy_name', 'full_name', 'nick_name', 'muc', 'muc_nick', 'encrypt') VALUES(?, ?, ?, ?, ?, ?, ?) ON CONFLICT(account_id, buddy_name) DO UPDATE SET subscription='both';" andArguments:@[accountID, [NSString stringWithFormat:@"%@@%@", accountDetails[kUsername], accountDetails[kDomain]], @"", @"", @0, @"", @(encrypt)]];
NSDictionary* accountDetails = [self detailsForAccount:accountID];
return [self.db executeNonQuery:@"INSERT INTO buddylist ('account_id', 'buddy_name', 'full_name', 'nick_name', 'muc', 'muc_nick', 'encrypt') VALUES(?, ?, ?, ?, ?, ?, ?) ON CONFLICT(account_id, buddy_name) DO UPDATE SET subscription='both';" andArguments:@[accountID, [NSString stringWithFormat:@"%@@%@", accountDetails[kUsername], accountDetails[kDomain]], @"", @"", @0, @"", @(encrypt)]];
}];
}

-(BOOL) addContact:(NSString*) contact forAccount:(NSNumber*) accountID nickname:(NSString*) nickName
Expand Down

0 comments on commit cd929f8

Please sign in to comment.