Skip to content

Commit

Permalink
occurred to me that since multiple apps could have had their prefs fi…
Browse files Browse the repository at this point in the history
…le infected, we'd want to merge those prefs with the external prefs file; this commit takes care of that, and has been tested with Hulu Desktop
  • Loading branch information
Simone Manganelli authored and Simone Manganelli committed Jun 25, 2009
1 parent d15afcb commit e379669
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Plugin/Plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,21 @@ - (void) _migratePrefsToExternalFile
NSString *currentParasiticDefault = [parasiticDefaultsNameArray objectAtIndex:i];
id prefValue = [[NSUserDefaults standardUserDefaults] objectForKey:currentParasiticDefault];
if (prefValue) {
[externalFileDefaults setObject:prefValue forKey:[externalDefaultsNameArray objectAtIndex:i]];
NSString *externalPrefDefaultName = [externalDefaultsNameArray objectAtIndex:i];
id existingExternalPref = [[CTFUserDefaultsController standardUserDefaults] objectForKey:externalPrefDefaultName];
if (! existingExternalPref) {
// don't overwrite existing external preferences
[externalFileDefaults setObject:prefValue forKey:externalPrefDefaultName];
} else {
if ([currentParasiticDefault isEqualToString:@"ClickToFlash_siteInfo"]) {
// merge the arrays of whitelisted sites, in case they're not identical

NSMutableArray *combinedWhitelist = [NSMutableArray arrayWithArray:prefValue];
[combinedWhitelist addObjectsFromArray:existingExternalPref];
[externalFileDefaults setObject:combinedWhitelist forKey:externalPrefDefaultName];
}
}
// eliminate the parasitic default, regardless of whether we transferred them or not
[[NSUserDefaults standardUserDefaults] removeObjectForKey:currentParasiticDefault];
}
}
Expand Down

0 comments on commit e379669

Please sign in to comment.