mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 02:18:42 +00:00
Revert "Merge pull request #1039 from MaddTheSane/patch-4"
This reverts commitc0c463d660, reversing changes made tocd2587a435.
This commit is contained in:
@@ -132,7 +132,7 @@ BlocklistDownloader * fBLDownloader = nil;
|
|||||||
[self decompressBlocklist];
|
[self decompressBlocklist];
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
const int count = tr_blocklistSetContent([(Controller *)[NSApp delegate] sessionHandle], [fDestination fileSystemRepresentation]);
|
const int count = tr_blocklistSetContent([(Controller *)[NSApp delegate] sessionHandle], [fDestination UTF8String]);
|
||||||
|
|
||||||
//delete downloaded file
|
//delete downloaded file
|
||||||
[[NSFileManager defaultManager] removeItemAtPath: fDestination error: NULL];
|
[[NSFileManager defaultManager] removeItemAtPath: fDestination error: NULL];
|
||||||
|
|||||||
@@ -343,13 +343,13 @@ static void removeKeRangerRansomware()
|
|||||||
tr_variantDictAddStr(&settings, TR_KEY_blocklist_url, [[fDefaults stringForKey: @"BlocklistURL"] UTF8String]);
|
tr_variantDictAddStr(&settings, TR_KEY_blocklist_url, [[fDefaults stringForKey: @"BlocklistURL"] UTF8String]);
|
||||||
tr_variantDictAddBool(&settings, TR_KEY_dht_enabled, [fDefaults boolForKey: @"DHTGlobal"]);
|
tr_variantDictAddBool(&settings, TR_KEY_dht_enabled, [fDefaults boolForKey: @"DHTGlobal"]);
|
||||||
tr_variantDictAddStr(&settings, TR_KEY_download_dir, [[[fDefaults stringForKey: @"DownloadFolder"]
|
tr_variantDictAddStr(&settings, TR_KEY_download_dir, [[[fDefaults stringForKey: @"DownloadFolder"]
|
||||||
stringByExpandingTildeInPath] fileSystemRepresentation]);
|
stringByExpandingTildeInPath] UTF8String]);
|
||||||
tr_variantDictAddBool(&settings, TR_KEY_download_queue_enabled, [fDefaults boolForKey: @"Queue"]);
|
tr_variantDictAddBool(&settings, TR_KEY_download_queue_enabled, [fDefaults boolForKey: @"Queue"]);
|
||||||
tr_variantDictAddInt(&settings, TR_KEY_download_queue_size, [fDefaults integerForKey: @"QueueDownloadNumber"]);
|
tr_variantDictAddInt(&settings, TR_KEY_download_queue_size, [fDefaults integerForKey: @"QueueDownloadNumber"]);
|
||||||
tr_variantDictAddInt(&settings, TR_KEY_idle_seeding_limit, [fDefaults integerForKey: @"IdleLimitMinutes"]);
|
tr_variantDictAddInt(&settings, TR_KEY_idle_seeding_limit, [fDefaults integerForKey: @"IdleLimitMinutes"]);
|
||||||
tr_variantDictAddBool(&settings, TR_KEY_idle_seeding_limit_enabled, [fDefaults boolForKey: @"IdleLimitCheck"]);
|
tr_variantDictAddBool(&settings, TR_KEY_idle_seeding_limit_enabled, [fDefaults boolForKey: @"IdleLimitCheck"]);
|
||||||
tr_variantDictAddStr(&settings, TR_KEY_incomplete_dir, [[[fDefaults stringForKey: @"IncompleteDownloadFolder"]
|
tr_variantDictAddStr(&settings, TR_KEY_incomplete_dir, [[[fDefaults stringForKey: @"IncompleteDownloadFolder"]
|
||||||
stringByExpandingTildeInPath] fileSystemRepresentation]);
|
stringByExpandingTildeInPath] UTF8String]);
|
||||||
tr_variantDictAddBool(&settings, TR_KEY_incomplete_dir_enabled, [fDefaults boolForKey: @"UseIncompleteDownloadFolder"]);
|
tr_variantDictAddBool(&settings, TR_KEY_incomplete_dir_enabled, [fDefaults boolForKey: @"UseIncompleteDownloadFolder"]);
|
||||||
tr_variantDictAddBool(&settings, TR_KEY_lpd_enabled, [fDefaults boolForKey: @"LocalPeerDiscoveryGlobal"]);
|
tr_variantDictAddBool(&settings, TR_KEY_lpd_enabled, [fDefaults boolForKey: @"LocalPeerDiscoveryGlobal"]);
|
||||||
tr_variantDictAddInt(&settings, TR_KEY_message_level, TR_LOG_DEBUG);
|
tr_variantDictAddInt(&settings, TR_KEY_message_level, TR_LOG_DEBUG);
|
||||||
@@ -382,7 +382,7 @@ static void removeKeRangerRansomware()
|
|||||||
tr_variantDictAddInt(&settings, TR_KEY_seed_queue_size, [fDefaults integerForKey: @"QueueSeedNumber"]);
|
tr_variantDictAddInt(&settings, TR_KEY_seed_queue_size, [fDefaults integerForKey: @"QueueSeedNumber"]);
|
||||||
tr_variantDictAddBool(&settings, TR_KEY_start_added_torrents, [fDefaults boolForKey: @"AutoStartDownload"]);
|
tr_variantDictAddBool(&settings, TR_KEY_start_added_torrents, [fDefaults boolForKey: @"AutoStartDownload"]);
|
||||||
tr_variantDictAddBool(&settings, TR_KEY_script_torrent_done_enabled, [fDefaults boolForKey: @"DoneScriptEnabled"]);
|
tr_variantDictAddBool(&settings, TR_KEY_script_torrent_done_enabled, [fDefaults boolForKey: @"DoneScriptEnabled"]);
|
||||||
tr_variantDictAddStr(&settings, TR_KEY_script_torrent_done_filename, [[fDefaults stringForKey: @"DoneScriptPath"] fileSystemRepresentation]);
|
tr_variantDictAddStr(&settings, TR_KEY_script_torrent_done_filename, [[fDefaults stringForKey: @"DoneScriptPath"] UTF8String]);
|
||||||
tr_variantDictAddBool(&settings, TR_KEY_utp_enabled, [fDefaults boolForKey: @"UTPGlobal"]);
|
tr_variantDictAddBool(&settings, TR_KEY_utp_enabled, [fDefaults boolForKey: @"UTPGlobal"]);
|
||||||
|
|
||||||
// TODO: Add to GUI
|
// TODO: Add to GUI
|
||||||
@@ -424,7 +424,7 @@ static void removeKeRangerRansomware()
|
|||||||
fLib = tr_sessionInit(configDir, YES, &settings);
|
fLib = tr_sessionInit(configDir, YES, &settings);
|
||||||
tr_variantFree(&settings);
|
tr_variantFree(&settings);
|
||||||
|
|
||||||
fConfigDirectory = [[NSFileManager defaultManager] stringWithFileSystemRepresentation: configDir length: strlen(configDir)];
|
fConfigDirectory = [[NSString alloc] initWithUTF8String: configDir];
|
||||||
|
|
||||||
[NSApp setDelegate: self];
|
[NSApp setDelegate: self];
|
||||||
|
|
||||||
@@ -922,7 +922,7 @@ static void removeKeRangerRansomware()
|
|||||||
{
|
{
|
||||||
//ensure torrent doesn't already exist
|
//ensure torrent doesn't already exist
|
||||||
tr_ctor * ctor = tr_ctorNew(fLib);
|
tr_ctor * ctor = tr_ctorNew(fLib);
|
||||||
tr_ctorSetMetainfoFromFile(ctor, [torrentPath fileSystemRepresentation]);
|
tr_ctorSetMetainfoFromFile(ctor, [torrentPath UTF8String]);
|
||||||
|
|
||||||
tr_info info;
|
tr_info info;
|
||||||
const tr_parse_result result = tr_torrentParse(ctor, &info);
|
const tr_parse_result result = tr_torrentParse(ctor, &info);
|
||||||
@@ -2842,7 +2842,7 @@ static void removeKeRangerRansomware()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
tr_ctor * ctor = tr_ctorNew(fLib);
|
tr_ctor * ctor = tr_ctorNew(fLib);
|
||||||
tr_ctorSetMetainfoFromFile(ctor, [fullFile fileSystemRepresentation]);
|
tr_ctorSetMetainfoFromFile(ctor, [fullFile UTF8String]);
|
||||||
|
|
||||||
switch (tr_torrentParse(ctor, NULL))
|
switch (tr_torrentParse(ctor, NULL))
|
||||||
{
|
{
|
||||||
@@ -3130,7 +3130,7 @@ static void removeKeRangerRansomware()
|
|||||||
{
|
{
|
||||||
torrent = YES;
|
torrent = YES;
|
||||||
tr_ctor * ctor = tr_ctorNew(fLib);
|
tr_ctor * ctor = tr_ctorNew(fLib);
|
||||||
tr_ctorSetMetainfoFromFile(ctor, [file fileSystemRepresentation]);
|
tr_ctorSetMetainfoFromFile(ctor, [file UTF8String]);
|
||||||
if (tr_torrentParse(ctor, NULL) == TR_PARSE_OK)
|
if (tr_torrentParse(ctor, NULL) == TR_PARSE_OK)
|
||||||
{
|
{
|
||||||
if (!fOverlayWindow)
|
if (!fOverlayWindow)
|
||||||
@@ -3192,7 +3192,7 @@ static void removeKeRangerRansomware()
|
|||||||
{
|
{
|
||||||
torrent = YES;
|
torrent = YES;
|
||||||
tr_ctor * ctor = tr_ctorNew(fLib);
|
tr_ctor * ctor = tr_ctorNew(fLib);
|
||||||
tr_ctorSetMetainfoFromFile(ctor, [file fileSystemRepresentation]);
|
tr_ctorSetMetainfoFromFile(ctor, [file UTF8String]);
|
||||||
if (tr_torrentParse(ctor, NULL) == TR_PARSE_OK)
|
if (tr_torrentParse(ctor, NULL) == TR_PARSE_OK)
|
||||||
[filesToOpen addObject: file];
|
[filesToOpen addObject: file];
|
||||||
tr_ctorFree(ctor);
|
tr_ctorFree(ctor);
|
||||||
@@ -4588,10 +4588,8 @@ static void removeKeRangerRansomware()
|
|||||||
- (void) rpcAddTorrentStruct: (struct tr_torrent *) torrentStruct
|
- (void) rpcAddTorrentStruct: (struct tr_torrent *) torrentStruct
|
||||||
{
|
{
|
||||||
NSString * location = nil;
|
NSString * location = nil;
|
||||||
if (tr_torrentGetDownloadDir(torrentStruct) != NULL) {
|
if (tr_torrentGetDownloadDir(torrentStruct) != NULL)
|
||||||
const char * tmpLoc = tr_torrentGetDownloadDir(torrentStruct);
|
location = @(tr_torrentGetDownloadDir(torrentStruct));
|
||||||
location = [[NSFileManager defaultManager] stringWithFileSystemRepresentation: tmpLoc length: strlen(tmpLoc)];
|
|
||||||
}
|
|
||||||
|
|
||||||
Torrent * torrent = [[Torrent alloc] initWithTorrentStruct: torrentStruct location: location lib: fLib];
|
Torrent * torrent = [[Torrent alloc] initWithTorrentStruct: torrentStruct location: location lib: fLib];
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ NSMutableSet *creatorWindowControllerSet = nil;
|
|||||||
fStarted = NO;
|
fStarted = NO;
|
||||||
|
|
||||||
fPath = path;
|
fPath = path;
|
||||||
fInfo = tr_metaInfoBuilderCreate([fPath fileSystemRepresentation]);
|
fInfo = tr_metaInfoBuilderCreate([[fPath path] UTF8String]);
|
||||||
|
|
||||||
if (fInfo->fileCount == 0)
|
if (fInfo->fileCount == 0)
|
||||||
{
|
{
|
||||||
@@ -536,7 +536,7 @@ NSMutableSet *creatorWindowControllerSet = nil;
|
|||||||
[[self window] setRestorable: NO];
|
[[self window] setRestorable: NO];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"BeginCreateTorrentFile" object: fLocation userInfo: nil];
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"BeginCreateTorrentFile" object: fLocation userInfo: nil];
|
||||||
tr_makeMetaInfo(fInfo, [fLocation fileSystemRepresentation], trackerInfo, [fTrackers count], [[fCommentView string] UTF8String], [fPrivateCheck state] == NSOnState);
|
tr_makeMetaInfo(fInfo, [[fLocation path] UTF8String], trackerInfo, [fTrackers count], [[fCommentView string] UTF8String], [fPrivateCheck state] == NSOnState);
|
||||||
tr_free(trackerInfo);
|
tr_free(trackerInfo);
|
||||||
|
|
||||||
fTimer = [NSTimer scheduledTimerWithTimeInterval: 0.1 target: self selector: @selector(checkProgress) userInfo: nil repeats: YES];
|
fTimer = [NSTimer scheduledTimerWithTimeInterval: 0.1 target: self selector: @selector(checkProgress) userInfo: nil repeats: YES];
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
|| [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
|
|| [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
|
||||||
{
|
{
|
||||||
tr_ctor * ctor = tr_ctorNew(fLib);
|
tr_ctor * ctor = tr_ctorNew(fLib);
|
||||||
tr_ctorSetMetainfoFromFile(ctor, [file fileSystemRepresentation]);
|
tr_ctorSetMetainfoFromFile(ctor, [file UTF8String]);
|
||||||
tr_info info;
|
tr_info info;
|
||||||
if (tr_torrentParse(ctor, &info) == TR_PARSE_OK)
|
if (tr_torrentParse(ctor, &info) == TR_PARSE_OK)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1320,8 +1320,7 @@
|
|||||||
const BOOL doneScriptEnabled = tr_sessionIsTorrentDoneScriptEnabled(fHandle);
|
const BOOL doneScriptEnabled = tr_sessionIsTorrentDoneScriptEnabled(fHandle);
|
||||||
[fDefaults setBool: doneScriptEnabled forKey: @"DoneScriptEnabled"];
|
[fDefaults setBool: doneScriptEnabled forKey: @"DoneScriptEnabled"];
|
||||||
|
|
||||||
const char * doneScriptCStr = tr_sessionGetTorrentDoneScript(fHandle);
|
NSString * doneScriptPath = @(tr_sessionGetTorrentDoneScript(fHandle));
|
||||||
NSString * doneScriptPath = [[NSFileManager defaultManager] stringWithFileSystemRepresentation: doneScriptCStr length: strlen(doneScriptCStr)];
|
|
||||||
[fDefaults setObject: doneScriptPath forKey: @"DoneScriptPath"];
|
[fDefaults setObject: doneScriptPath forKey: @"DoneScriptPath"];
|
||||||
|
|
||||||
//update gui if loaded
|
//update gui if loaded
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
|
|||||||
//try to parse the torrent file
|
//try to parse the torrent file
|
||||||
tr_info inf;
|
tr_info inf;
|
||||||
tr_ctor * ctor = tr_ctorNew(NULL);
|
tr_ctor * ctor = tr_ctorNew(NULL);
|
||||||
tr_ctorSetMetainfoFromFile(ctor, [(__bridge NSURL *)url fileSystemRepresentation]);
|
tr_ctorSetMetainfoFromFile(ctor, [[(__bridge NSURL *)url path] UTF8String]);
|
||||||
const int err = tr_torrentParse(ctor, &inf);
|
const int err = tr_torrentParse(ctor, &inf);
|
||||||
tr_ctorFree(ctor);
|
tr_ctorFree(ctor);
|
||||||
if (err)
|
if (err)
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
|
|||||||
//if data existed in original download location, unexclude it before changing the location
|
//if data existed in original download location, unexclude it before changing the location
|
||||||
[self setTimeMachineExclude: NO];
|
[self setTimeMachineExclude: NO];
|
||||||
|
|
||||||
tr_torrentSetDownloadDir(fHandle, [folder fileSystemRepresentation]);
|
tr_torrentSetDownloadDir(fHandle, [folder UTF8String]);
|
||||||
|
|
||||||
fDownloadFolderDetermination = determinationType;
|
fDownloadFolderDetermination = determinationType;
|
||||||
}
|
}
|
||||||
@@ -562,7 +562,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
volatile int status;
|
volatile int status;
|
||||||
tr_torrentSetLocation(fHandle, [folder fileSystemRepresentation], YES, NULL, &status);
|
tr_torrentSetLocation(fHandle, [folder UTF8String], YES, NULL, &status);
|
||||||
|
|
||||||
while (status == TR_LOC_MOVING) //block while moving (for now)
|
while (status == TR_LOC_MOVING) //block while moving (for now)
|
||||||
[NSThread sleepForTimeInterval: 0.05];
|
[NSThread sleepForTimeInterval: 0.05];
|
||||||
@@ -846,7 +846,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
|
|||||||
NSDictionary * contextInfo = @{ @"Torrent" : self, @"Nodes" : @[ node ], @"CompletionHandler" : [completionHandler copy] };
|
NSDictionary * contextInfo = @{ @"Torrent" : self, @"Nodes" : @[ node ], @"CompletionHandler" : [completionHandler copy] };
|
||||||
|
|
||||||
NSString * oldPath = [[node path] stringByAppendingPathComponent: [node name]];
|
NSString * oldPath = [[node path] stringByAppendingPathComponent: [node name]];
|
||||||
tr_torrentRenamePath(fHandle, [oldPath fileSystemRepresentation], [newName UTF8String], renameCallback, (__bridge_retained void *)(contextInfo));
|
tr_torrentRenamePath(fHandle, [oldPath UTF8String], [newName UTF8String], renameCallback, (__bridge_retained void *)(contextInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat) progress
|
- (CGFloat) progress
|
||||||
@@ -1662,13 +1662,13 @@ bool trashDataFile(const char * filename, tr_error ** error)
|
|||||||
|
|
||||||
tr_ctorSetPaused(ctor, TR_FORCE, YES);
|
tr_ctorSetPaused(ctor, TR_FORCE, YES);
|
||||||
if (downloadFolder)
|
if (downloadFolder)
|
||||||
tr_ctorSetDownloadDir(ctor, TR_FORCE, [downloadFolder fileSystemRepresentation]);
|
tr_ctorSetDownloadDir(ctor, TR_FORCE, [downloadFolder UTF8String]);
|
||||||
if (incompleteFolder)
|
if (incompleteFolder)
|
||||||
tr_ctorSetIncompleteDir(ctor, [incompleteFolder fileSystemRepresentation]);
|
tr_ctorSetIncompleteDir(ctor, [incompleteFolder UTF8String]);
|
||||||
|
|
||||||
tr_parse_result result = TR_PARSE_ERR;
|
tr_parse_result result = TR_PARSE_ERR;
|
||||||
if (path)
|
if (path)
|
||||||
result = tr_ctorSetMetainfoFromFile(ctor, [path fileSystemRepresentation]);
|
result = tr_ctorSetMetainfoFromFile(ctor, [path UTF8String]);
|
||||||
|
|
||||||
if (result != TR_PARSE_OK && magnetAddress)
|
if (result != TR_PARSE_OK && magnetAddress)
|
||||||
result = tr_ctorSetMetainfoFromMagnetLink(ctor, [magnetAddress UTF8String]);
|
result = tr_ctorSetMetainfoFromMagnetLink(ctor, [magnetAddress UTF8String]);
|
||||||
@@ -1853,7 +1853,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
|
|||||||
{
|
{
|
||||||
NSString * dataLocation = [[self currentDirectory] stringByAppendingPathComponent: [self name]];
|
NSString * dataLocation = [[self currentDirectory] stringByAppendingPathComponent: [self name]];
|
||||||
FSRef ref;
|
FSRef ref;
|
||||||
if (FSPathMakeRef((const UInt8 *)[dataLocation fileSystemRepresentation], &ref, NULL) == noErr)
|
if (FSPathMakeRef((const UInt8 *)[dataLocation UTF8String], &ref, NULL) == noErr)
|
||||||
{
|
{
|
||||||
if (LSSetItemAttribute(&ref, kLSRolesAll, kLSItemQuarantineProperties, (__bridge CFTypeRef)(quarantineProperties)) != noErr)
|
if (LSSetItemAttribute(&ref, kLSRolesAll, kLSItemQuarantineProperties, (__bridge CFTypeRef)(quarantineProperties)) != noErr)
|
||||||
NSLog(@"Failed to quarantine: %@", dataLocation);
|
NSLog(@"Failed to quarantine: %@", dataLocation);
|
||||||
|
|||||||
Reference in New Issue
Block a user