From 12a10f514fb0c7436ffbe1d3b4736d246029bf3a Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 14 Aug 2008 02:18:14 +0000 Subject: [PATCH] always manually remove torrents from libT, even when removed through rpc --- macosx/Controller.h | 3 +-- macosx/Controller.m | 15 ++++++--------- macosx/Torrent.h | 1 - macosx/Torrent.m | 7 +------ 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/macosx/Controller.h b/macosx/Controller.h index 315be8495..b8ea33187 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -151,8 +151,7 @@ typedef enum deleteData: (BOOL) deleteData deleteTorrent: (BOOL) deleteData; - (void) removeSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode contextInfo: (NSDictionary *) dict; -- (void) confirmRemoveTorrents: (NSArray *) torrents deleteData: (BOOL) deleteData deleteTorrent: (BOOL) deleteTorrent - fromRPC: (BOOL) rpc; +- (void) confirmRemoveTorrents: (NSArray *) torrents deleteData: (BOOL) deleteData deleteTorrent: (BOOL) deleteTorrent; - (void) removeNoDelete: (id) sender; - (void) removeDeleteData: (id) sender; - (void) removeDeleteTorrent: (id) sender; diff --git a/macosx/Controller.m b/macosx/Controller.m index 492cec222..a671c04f3 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -140,9 +140,10 @@ typedef enum #define FORUM_URL @"http://forum.transmissionbt.com/" #define DONATE_URL @"http://www.transmissionbt.com/donate.php" -static void rpcCallback(tr_handle * handle UNUSED, tr_rpc_callback_type type, struct tr_torrent * torrentStruct, void * controller) +static tr_rpc_callback_status rpcCallback(tr_handle * handle UNUSED, tr_rpc_callback_type type, struct tr_torrent * torrentStruct, void * controller) { [(Controller *)controller rpcCallback: type forTorrentStruct: torrentStruct]; + return TR_RPC_NOREMOVE; //we'll do the remove manually } static void sleepCallback(void * controller, io_service_t y, natural_t messageType, void * messageArgument) @@ -1217,7 +1218,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy } } - [self confirmRemoveTorrents: torrents deleteData: deleteData deleteTorrent: deleteTorrent fromRPC: NO]; + [self confirmRemoveTorrents: torrents deleteData: deleteData deleteTorrent: deleteTorrent]; } - (void) removeSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode contextInfo: (NSDictionary *) dict @@ -1225,7 +1226,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy NSArray * torrents = [dict objectForKey: @"Torrents"]; if (returnCode == NSAlertDefaultReturn) [self confirmRemoveTorrents: torrents deleteData: [[dict objectForKey: @"DeleteData"] boolValue] - deleteTorrent: [[dict objectForKey: @"DeleteTorrent"] boolValue] fromRPC: NO]; + deleteTorrent: [[dict objectForKey: @"DeleteTorrent"] boolValue]]; else [torrents release]; @@ -1233,7 +1234,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy } - (void) confirmRemoveTorrents: (NSArray *) torrents deleteData: (BOOL) deleteData deleteTorrent: (BOOL) deleteTorrent - fromRPC: (BOOL) rpc { //don't want any of these starting then stopping NSEnumerator * enumerator = [torrents objectEnumerator]; @@ -1257,10 +1257,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy lowestOrderValue = MIN(lowestOrderValue, [torrent orderValue]); - if (rpc) - [torrent closeRemoveTorrentInterface]; - else - [torrent closeRemoveTorrent]; + [torrent closeRemoveTorrent]; } [torrents release]; @@ -4287,7 +4284,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy - (void) rpcRemoveTorrent: (Torrent *) torrent { - [self confirmRemoveTorrents: [[NSArray arrayWithObject: torrent] retain] deleteData: NO deleteTorrent: NO fromRPC: YES]; + [self confirmRemoveTorrents: [[NSArray arrayWithObject: torrent] retain] deleteData: NO deleteTorrent: NO]; [torrent release]; } diff --git a/macosx/Torrent.h b/macosx/Torrent.h index 607993942..46af0daf8 100644 --- a/macosx/Torrent.h +++ b/macosx/Torrent.h @@ -81,7 +81,6 @@ typedef enum - (NSDictionary *) history; -- (void) closeRemoveTorrentInterface; - (void) closeRemoveTorrent; - (void) changeIncompleteDownloadFolder: (NSString *) folder; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index e7e66cc60..1f626db56 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -191,15 +191,10 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * return [@"Torrent: " stringByAppendingString: [self name]]; } -- (void) closeRemoveTorrentInterface +- (void) closeRemoveTorrent { //allow the file to be index by Time Machine [self setTimeMachineExclude: NO forPath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]]; -} - -- (void) closeRemoveTorrent -{ - [self closeRemoveTorrentInterface]; tr_torrentRemove(fHandle); }